From 86fa626b06a177fcb0e2d107729cf0044905512b Mon Sep 17 00:00:00 2001 From: LlamaLad7 Date: Mon, 4 Mar 2024 22:00:08 +0000 Subject: [PATCH] Fix: Properly extend the stack in `CallbackInjector`. The old logic misses the receiver and does not correctly handle double-size types. --- .../asm/mixin/injection/callback/CallbackInjector.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.java b/src/main/java/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.java index 75279ab14..6542992ef 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.java @@ -212,10 +212,7 @@ private class Callback extends InsnList { this.invoke = target.extendStack(); this.ctor = target.extendStack(); - this.invoke.add(target.arguments.length); - if (this.canCaptureLocals) { - this.invoke.add(this.localTypes.length - this.frameSize); - } + this.invoke.add().add(handlerArgs); //If the handler doesn't captureArgs, the CallbackInfo(Returnable) will be the first LVT slot, otherwise it will be at the target's frameSize int callbackInfoSlot = handlerArgs.length == 1 ? Bytecode.isStatic(handler) ? 0 : 1 : frameSize;