Mixin
Mixin copied to clipboard
Comparison Redirectors
Basically replacing specialised comparison instructions, such as LCMP
, IF_ACMPEQ
, IF_ICMPGT
etc with calls to handler methods that take two arguments and return a boolean.
Could possibly use the existing JUMP
point, but that wouldn't be able to handle float, double and long comparisons, and may lead to confusion, as the jump itself is not really being changed, rather the comparison that triggers the jump.
For these reasons a specialised COMPARE
injection point might be best.
The more I think about it the more this makes sense as at least a pale reflection of what I always really wanted rerouters to do. @Redirect
is already fairly heavily overloaded so I'm minded to do this as a "specialised redirect" the same way @ModifyConstant
is. That provides some scope for having the injection point declared in a more intuitive way (see, CONSTANT
vs the @Constant
style) where required.
So this is two parts:
- A specialised injector to handle the condition, which is ultimately just modifying what's on top of the stack
- A specialised companion injection point which works like
BeforeConstant
in an enhanced or standard mode