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 argumentsAndReturnSizes = Type.getArgumentsAndReturnSizes(desc)
val pushes = argumentsAndReturnSizes and 0x3 val pushes = argumentsAndReturnSizes and 0x3
var pops = argumentsAndReturnSizes shr 2 var pops = argumentsAndReturnSizes shr 2
if (opcode != Opcodes.INVOKESTATIC) { if (opcode == Opcodes.INVOKESTATIC) {
pops++ pops--
} }
StackMetadata(pops, pushes) StackMetadata(pops, pushes)
} }

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

Loading…
Cancel
Save