Fix handling of argumentsAndReturnSizes for static methods

bzip2
Graham 5 years ago
parent 713009470f
commit c0da020649
  1. 4
      asm/src/main/java/dev/openrs2/asm/StackMetadata.kt
  2. 2
      deob/src/main/java/dev/openrs2/deob/transform/DummyArgTransformer.kt

@ -205,8 +205,8 @@ fun AbstractInsnNode.stackMetadata(): StackMetadata = when (this) {
val argumentsAndReturnSizes = Type.getArgumentsAndReturnSizes(desc)
val pushes = argumentsAndReturnSizes and 0x3
var pops = argumentsAndReturnSizes shr 2
if (opcode != Opcodes.INVOKESTATIC) {
pops++
if (opcode == Opcodes.INVOKESTATIC) {
pops--
}
StackMetadata(pops, pushes)
}

@ -179,7 +179,7 @@ class DummyArgTransformer : Transformer() {
var callerSlots = Type.getArgumentsAndReturnSizes(method.desc) shr 2
if (method.access and Opcodes.ACC_STATIC != 0) {
callerSlots++
callerSlots--
}
if (load.`var` >= callerSlots) {
continue

Loading…
Cancel
Save