SimAnalyzer icon indicating copy to clipboard operation
SimAnalyzer copied to clipboard

Instruction tracking does not include void calls on objects

Open Col-E opened this issue 5 years ago • 0 comments

Given the following example:

NEW Type
DUP
INVOKESPECIAL Type.<init>()V
INVOKEVOID Type.enableThing()V
ASTORE t
ALOAD t
ARETURN

The tracked instructions will not include the constructor or void call.

  • Type.<init>()V
  • Type.enableThing()V

This is not a clear edge-case fix since ASM tosses values of invoke calls that return void. This is done in Frame#executeInvokeInsn(...)

  private void executeInvokeInsn(AbstractInsnNode insn, final String desc, final Interpreter<V> interpreter) {
// ... snip
    if (Type.getReturnType(methodDescriptor) == Type.VOID_TYPE) {
      interpreter.naryOperation(insn, valueList);
    } else {
      push(interpreter.naryOperation(insn, valueList));
    }
  }

There is a test case that asserts the current behavior: TestInstructionTracking

Col-E avatar Jul 30 '20 04:07 Col-E