/** Symbolically executes the corresponding Java Virtual Machine instruction. */ public void visitINVOKESPECIAL(INVOKESPECIAL o) { if (o.getMethodName(cpg).equals(Constants.CONSTRUCTOR_NAME)) { UninitializedObjectType t = (UninitializedObjectType) stack().peek(o.getArgumentTypes(cpg).length); if (t == Frame._this) { Frame._this = null; } stack().initializeObject(t); locals().initializeObject(t); } stack().pop(); // objectref for (int i = 0; i < o.getArgumentTypes(cpg).length; i++) { stack().pop(); } // We are sure the invoked method will xRETURN eventually // We simulate xRETURNs functionality here because we // don't really "jump into" and simulate the invoked // method. if (o.getReturnType(cpg) != Type.VOID) { Type t = o.getReturnType(cpg); if (t.equals(Type.BOOLEAN) || t.equals(Type.CHAR) || t.equals(Type.BYTE) || t.equals(Type.SHORT)) { t = Type.INT; } stack().push(t); } }
public static String getCallMethodName(Instruction ins, ConstantPoolGen cp) { if (ins instanceof INVOKESTATIC) { INVOKESTATIC invst = (INVOKESTATIC) ins; return invst.getMethodName(cp); } else if (ins instanceof INVOKEVIRTUAL) { INVOKEVIRTUAL invst = (INVOKEVIRTUAL) ins; return invst.getMethodName(cp); } else if (ins instanceof INVOKEINTERFACE) { INVOKEINTERFACE invst = (INVOKEINTERFACE) ins; return invst.getMethodName(cp); } else if (ins instanceof INVOKESPECIAL) { INVOKESPECIAL invst = (INVOKESPECIAL) ins; return invst.getMethodName(cp); } else { return null; } }