public void executeInstruction(JVM vm) { Instruction insn = vm.getLastInstruction(); MethodInfo mi = insn.getMethodInfo(); ThreadInfo ti = vm.getLastThreadInfo(); if (mi != lastMi) { logStack(ti); lastMi = mi; } else if (insn instanceof InvokeInstruction) { MethodInfo callee; // that's the only little gist of it - if this is a VirtualInvocation, // we have to dig the callee out by ourselves (it's not known // before execution) if (insn instanceof VirtualInvocation) { VirtualInvocation callInsn = (VirtualInvocation) insn; int objref = callInsn.getCalleeThis(ti); callee = callInsn.getInvokedMethod(ti, objref); } else if (insn instanceof INVOKESPECIAL) { INVOKESPECIAL callInsn = (INVOKESPECIAL) insn; callee = callInsn.getInvokedMethod(ti); } else { InvokeInstruction callInsn = (InvokeInstruction) insn; callee = callInsn.getInvokedMethod(ti); } if (callee != null) { if (callee.isMJI()) { logStack(ti); } } else { out.println("ERROR: unknown callee of: " + insn); } } }