mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 03:22:17 +00:00
Fix outstanding stack calc issues, fixes #85
This commit is contained in:
1 parent
6b43ea7de6
commit
34402ab33c
2 files changed
+4
-7
No files matched your search
@@ -411,6 +411,7 @@ public class CallbackInjector extends Injector {
|
||||
}
|
||||
}
|
||||
|
||||
this.dupReturnValue(callback);
|
||||
if (this.cancellable) {
|
||||
this.createCallbackInfo(callback, true);
|
||||
}
|
||||
@@ -500,16 +501,12 @@ public class CallbackInjector extends Injector {
|
||||
* @param store store the callback info in a local variable
|
||||
*/
|
||||
private void createCallbackInfo(final Callback callback, boolean store) {
|
||||
this.dupReturnValue(callback);
|
||||
|
||||
callback.add(new TypeInsnNode(Opcodes.NEW, callback.target.callbackInfoClass), true, !store);
|
||||
callback.add(new InsnNode(Opcodes.DUP), true, true);
|
||||
|
||||
this.invokeCallbackInfoCtor(callback, store);
|
||||
if (store) {
|
||||
callback.add(new VarInsnNode(Opcodes.ASTORE, callback.marshallVar));
|
||||
} else if (callback.target.returnType != Type.VOID_TYPE) {
|
||||
callback.invoke++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +563,7 @@ public class CallbackInjector extends Injector {
|
||||
private void invokeCallback(final Callback callback, final MethodNode callbackMethod) {
|
||||
// Push "this" onto the stack if the callback is not static
|
||||
if (!this.isStatic) {
|
||||
callback.add(new VarInsnNode(Opcodes.ALOAD, 0));
|
||||
callback.add(new VarInsnNode(Opcodes.ALOAD, 0), false, true);
|
||||
}
|
||||
|
||||
// Push the target method's parameters onto the stack
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ModifyArgInjector extends InvokeInjector {
|
||||
int[] argMap = this.storeArgs(target, args, insns, argIndex);
|
||||
this.invokeHandlerWithArgs(args, insns, argMap, argIndex, argIndex + 1);
|
||||
this.pushArgs(args, insns, argMap, argIndex + 1, args.length);
|
||||
return (target.getCurrentMaxLocals() - argMap[argMap.length - 1]) + 1 + args[args.length - 1].getSize();
|
||||
return (argMap[argMap.length - 1] - target.getMaxLocals()) + args[args.length - 1].getSize();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,7 +126,7 @@ public class ModifyArgInjector extends InvokeInjector {
|
||||
this.pushArgs(args, insns, argMap, 0, argIndex);
|
||||
this.invokeHandlerWithArgs(args, insns, argMap, 0, args.length);
|
||||
this.pushArgs(args, insns, argMap, argIndex + 1, args.length);
|
||||
return (target.getCurrentMaxLocals() - argMap[argMap.length - 1]) + 1 + args[args.length - 1].getSize();
|
||||
return (argMap[argMap.length - 1] - target.getMaxLocals()) + args[args.length - 1].getSize();
|
||||
}
|
||||
|
||||
protected int findArgIndex(Target target, Type[] args) {
|
||||
|
||||
Reference in new issue
Block a user