Skip to content

Commit c85d0db

Browse files
lrytzSethTisue
authored andcommitted
[asm-cherry-pick] Call interpreter.copyInstruction consistently
Before this change, `Frame.execute` did not invoke the interpreter's `copyInstruction` method for all values that are pushed on the frame's when executing some copying instructions. For example, in the case of SWAP, copyInstruction is invoked: value2 = pop(); value1 = pop(); push(interpreter.copyOperation(insn, value2)); push(interpreter.copyOperation(insn, value1)); For DUP on the other hand, the original value is pushed onto the stack without notifying the interpreter: value1 = pop(); push(value1); push(interpreter.copyOperation(insn, value1)); This leads to a problem for the `SourceInterpreter`, which collects for every value a set of potential producer instructions. Given the bytecode sequence NEW java/lang/Object DUP INVOKESPECIAL java/lang/Object.<init> ()V In the frame of the INVOKESPECIAL instruction, the value on the stack lists as its producer the `NEW` operation instead of the `DUP`, which not expected.
1 parent 4f37686 commit c85d0db

File tree

1 file changed

+1
-1
lines changed
  • src/main/java/scala/tools/asm/tree/analysis

1 file changed

+1
-1
lines changed

src/main/java/scala/tools/asm/tree/analysis/Frame.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ public void execute(final AbstractInsnNode insn, final Interpreter<V> interprete
402402
break;
403403
}
404404
} else {
405-
push(value1);
405+
push(interpreter.copyOperation(insn, value1));
406406
push(interpreter.copyOperation(insn, value1));
407407
break;
408408
}

0 commit comments

Comments
 (0)