You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is quite a niche scenario, as it requires a few rare things to coincide:
The variable you are targeting has no LVT entry
The AbstractInsnNode after the variable store instruction is not a label node
The variable you're targeting is not stored again after the store which satisfies condition 2.
Normally, condition 2 isn't satisfied, because normally a variable store is the last instruction in a compiled Java statement.
This has been encountered in the wild in legacy Minecraft versions where there are no LVTs. Take for example the ScreenshotUtils class from Beta 1.7.3:
Mixin is unable to find the local variable and fails. Printing the local variables verifies that var5 is missing even despite being used after the setRGB call.
After digging fairly deep into this issue, I noticed a problem in the fallback fake LVT generation for when the local variable is not found in the real LVT. Sometimes, Mixin needs to add synthetic labels into the method node if the labels are not already there, and it seems to be adding them one instruction later than they are supposed to be. From the example above, textifying the bytecode around the inline assignment of var5 shows that there is a label, L19, which is one instruction later than expected (var5 is at index 5):
This causes the code inside Locals.getLocalsAt to not know what the type of the local variable being stored by ASTORE 5 is, because the local variable it needs to find is only alive after the L19 label. Therefore, Mixin removes this local variable from the frame (at the end of Locals.getLocalsAt).
I believe all this is caused by this line. I think it should be insertBefore, rather than insert. I would double check that of course though, as I didn't dig any deeper than this.
The text was updated successfully, but these errors were encountered:
This is quite a niche scenario, as it requires a few rare things to coincide:
AbstractInsnNode
after the variable store instruction is not a label nodeNormally, condition 2 isn't satisfied, because normally a variable store is the last instruction in a compiled Java statement.
This has been encountered in the wild in legacy Minecraft versions where there are no LVTs. Take for example the
ScreenshotUtils
class from Beta 1.7.3:and the mixin:
Mixin is unable to find the local variable and fails. Printing the local variables verifies that
var5
is missing even despite being used after thesetRGB
call.After digging fairly deep into this issue, I noticed a problem in the fallback fake LVT generation for when the local variable is not found in the real LVT. Sometimes, Mixin needs to add synthetic labels into the method node if the labels are not already there, and it seems to be adding them one instruction later than they are supposed to be. From the example above, textifying the bytecode around the inline assignment of
var5
shows that there is a label,L19
, which is one instruction later than expected (var5
is at index 5):This causes the code inside
Locals.getLocalsAt
to not know what the type of the local variable being stored byASTORE 5
is, because the local variable it needs to find is only alive after theL19
label. Therefore, Mixin removes this local variable from the frame (at the end ofLocals.getLocalsAt
).I believe all this is caused by this line. I think it should be
insertBefore
, rather thaninsert
. I would double check that of course though, as I didn't dig any deeper than this.The text was updated successfully, but these errors were encountered: