Mixin icon indicating copy to clipboard operation
Mixin copied to clipboard

Add support for redirecting LOAD and STORE

Open Ueaj-Kerman opened this issue 5 years ago • 2 comments

if(object != null) { // we want to change this
   ...
}

which in bytecode, would (roughly) translate to

ALOAD 0
IFNULL
...

At the moment, there is no way of redirecting the ALOAD (or swapping the top value on the stack after the instruction) at the location to change the logic of the if statement.

You could use a ModifyLocal here, however, you may not want to modify the original value, but just swap the top value on the stack prior to the IFNULL with a different value, to, for example, change the logic of the if statement.

Ueaj-Kerman avatar Feb 23 '20 01:02 Ueaj-Kerman

Could that also be extended to cover array access equivalents, similar to field array redirects?

Niko-sk2x avatar Feb 23 '20 04:02 Niko-sk2x

In theory this should work identically to redirecting a GETFIELD or PUTFIELD, so hopefully yes, but that will be determined when I come to look at it.

Mumfrey avatar Feb 23 '20 13:02 Mumfrey