Fix custom operator dispatch missing receiver#295
Conversation
|
|
|
Changed to compiler fixed. |
|
I'm a bit confused about this one. If we have enough information at compile-time to know whether to set _hasReceiver to true or false why couldn't we just PushArg() the receiver instead of making a change to the runtime? |
|
When the type is known, the compiler pushes the receiver. But for dynamic, the same InvokeDynamic op could resolve to either a $InstanceImpl (needs receiver in args for PushScope) or a bridge $Instance (receiver passed separately via method.call). The flag lets the runtime know which case it's in. |
|
I see, next question. You added these If that's accurate, then the only time this is useful is when the receiver type is |
|
Yeah, the flag only matters for dynamic. For known bridges the $InstanceImpl branch isn't reached anyway. If the bytecode overhead isn't worth it for that edge case, we could drop the flag and use the previous identical check, it only runs in the $InstanceImpl branch so it's already scoped correctly. The compiler-side fix for known instance classes is the main fix either way. |
Custom operators on eval-defined classes ([], []=, +, *, /, %, etc.) crash because InvokeDynamic doesn't pass the instance as the first arg.