use of org.objectweb.asm.tree.analysis.AnalyzerException in project evosuite by EvoSuite.
the class BooleanTestabilityTransformation method generateCDG.
private void generateCDG(MethodNode mn) {
if (BytecodeInstructionPool.getInstance(classLoader).hasMethod(className, mn.name + mn.desc))
return;
BytecodeInstructionPool.getInstance(classLoader).registerMethodNode(mn, className, mn.name + // TODO: Adapt for multiple classLoaders
mn.desc);
BytecodeAnalyzer bytecodeAnalyzer = new BytecodeAnalyzer();
logger.info("Generating initial CFG for method " + mn.name);
try {
bytecodeAnalyzer.analyze(classLoader, className, mn.name + mn.desc, // TODO
mn);
} catch (AnalyzerException e) {
logger.error("Analyzer exception while analyzing " + className + "." + mn.name + ": " + e);
e.printStackTrace();
}
// compute Raw and ActualCFG and put both into GraphPool
bytecodeAnalyzer.retrieveCFGGenerator().registerCFGs();
}
use of org.objectweb.asm.tree.analysis.AnalyzerException in project drill by axbaretto.
the class ScalarReplacementNode method visitEnd.
@Override
public void visitEnd() {
/*
* Note this is a MethodNode, not a MethodVisitor. As a result, calls to the various visitX()
* methods will be building up a method. Then, once we analyze it, we use accept() to visit that
* method and transform it with the InstructionModifier at the bottom.
*/
super.visitEnd();
final LinkedList<ReplacingBasicValue> valueList = new LinkedList<>();
final MethodAnalyzer<BasicValue> analyzer = new MethodAnalyzer<BasicValue>(new ReplacingInterpreter(className, valueList));
Frame<BasicValue>[] frames;
try {
frames = analyzer.analyze(className, this);
} catch (final AnalyzerException e) {
throw new IllegalStateException(e);
}
if (logger.isTraceEnabled()) {
final StringBuilder sb = new StringBuilder();
sb.append("ReplacingBasicValues for " + className + "\n");
for (final ReplacingBasicValue value : valueList) {
value.dump(sb, 2);
sb.append('\n');
}
logger.debug(sb.toString());
}
// wrap the instruction handler so that we can do additional things
final TrackingInstructionList list = new TrackingInstructionList(frames, this.instructions);
this.instructions = list;
MethodVisitor methodVisitor = inner;
if (verifyBytecode) {
methodVisitor = new CheckMethodVisitorFsm(CompilationConfig.ASM_API_VERSION, methodVisitor);
}
final InstructionModifier holderV = new InstructionModifier(this.access, this.name, this.desc, this.signature, this.exceptionsArr, list, methodVisitor);
accept(holderV);
}
use of org.objectweb.asm.tree.analysis.AnalyzerException in project phosphor by gmu-swe.
the class InstMethodSinkInterpreter method _unaryOperation.
private BasicValue _unaryOperation(AbstractInsnNode insn, BasicValue value) throws AnalyzerException {
switch(insn.getOpcode()) {
case INEG:
case IINC:
case L2I:
case F2I:
case D2I:
case I2B:
case I2C:
case I2S:
SinkableArrayValue ret = new SinkableArrayValue(Type.INT_TYPE);
ret.addDep((SinkableArrayValue) value);
return ret;
case FNEG:
case I2F:
case L2F:
case D2F:
ret = new SinkableArrayValue(Type.FLOAT_TYPE);
ret.addDep((SinkableArrayValue) value);
return ret;
case LNEG:
case I2L:
case F2L:
case D2L:
ret = new SinkableArrayValue(Type.LONG_TYPE);
ret.addDep((SinkableArrayValue) value);
return ret;
case DNEG:
case I2D:
case L2D:
case F2D:
ret = new SinkableArrayValue(Type.DOUBLE_TYPE);
ret.addDep((SinkableArrayValue) value);
return ret;
case IFEQ:
case IFNE:
case IFLT:
case IFGE:
case IFGT:
case IFLE:
case TABLESWITCH:
case LOOKUPSWITCH:
return null;
case IRETURN:
case LRETURN:
case FRETURN:
case DRETURN:
case ARETURN:
case PUTSTATIC:
return null;
case GETFIELD:
return newValue(Type.getType(((FieldInsnNode) insn).desc));
case NEWARRAY:
ret = null;
switch(((IntInsnNode) insn).operand) {
case T_BOOLEAN:
ret = (SinkableArrayValue) newValue(Type.getType("[Z"));
break;
case T_CHAR:
ret = (SinkableArrayValue) newValue(Type.getType("[C"));
break;
case T_BYTE:
ret = (SinkableArrayValue) newValue(Type.getType("[B"));
break;
case T_SHORT:
ret = (SinkableArrayValue) newValue(Type.getType("[S"));
break;
case T_INT:
ret = (SinkableArrayValue) newValue(Type.getType("[I"));
break;
case T_FLOAT:
ret = (SinkableArrayValue) newValue(Type.getType("[F"));
break;
case T_DOUBLE:
ret = (SinkableArrayValue) newValue(Type.getType("[D"));
break;
case T_LONG:
ret = (SinkableArrayValue) newValue(Type.getType("[J"));
break;
default:
throw new AnalyzerException(insn, "Invalid array type");
}
if (Configuration.ARRAY_LENGTH_TRACKING)
ret.addDep((SinkableArrayValue) value);
ret.isNewArray = true;
return ret;
case ANEWARRAY:
String desc = ((TypeInsnNode) insn).desc;
return newValue(Type.getType("[" + Type.getObjectType(desc)));
case ARRAYLENGTH:
ret = (SinkableArrayValue) newValue(Type.INT_TYPE);
if (value instanceof SinkableArrayValue && value.getType() != null && TaintUtils.isPrimitiveArrayType(value.getType()))
ret.addDep((SinkableArrayValue) value);
return ret;
case ATHROW:
return null;
case CHECKCAST:
desc = ((TypeInsnNode) insn).desc;
BasicValue _ret = newValue(Type.getObjectType(desc));
if (value instanceof SinkableArrayValue) {
if ((_ret instanceof SinkableArrayValue))
((SinkableArrayValue) _ret).addDep((SinkableArrayValue) value);
}
return _ret;
case INSTANCEOF:
return newValue(Type.INT_TYPE);
case MONITORENTER:
case MONITOREXIT:
case IFNULL:
case IFNONNULL:
return null;
default:
throw new Error("Internal error.");
}
}
use of org.objectweb.asm.tree.analysis.AnalyzerException in project phosphor by gmu-swe.
the class PFrame method execute.
@Override
public void execute(AbstractInsnNode insn, Interpreter interpreter) throws AnalyzerException {
if (insn.getOpcode() > 200)
return;
switch(insn.getOpcode()) {
case Opcodes.DUP:
Value value1 = pop();
if (value1.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of DUP");
}
if (value1 instanceof SinkableArrayValue) {
Value v = interpreter.copyOperation(insn, value1);
push(v);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else {
push(value1);
Value v = interpreter.copyOperation(insn, value1);
push(v);
}
break;
case Opcodes.DUP2:
value1 = pop();
if (value1.getSize() == 1) {
Value value2 = pop();
if (value1 instanceof SinkableArrayValue || value2 instanceof SinkableArrayValue) {
if (value1 instanceof SinkableArrayValue && value2 instanceof SinkableArrayValue) {
Value v = interpreter.copyOperation(insn, value2);
push(v);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value2, (SinkableArrayValue) v));
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else if (value1 instanceof SinkableArrayValue) {
push(interpreter.copyOperation(insn, value2));
Value v = ((InstMethodSinkInterpreter) interpreter).copyOperationIgnoreOld(insn, (BasicValue) value1);
push(v);
push(value2);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
// System.out.println(value1 + " -> " + value2);
// throw new UnsupportedOperationException();
} else {
throw new UnsupportedOperationException();
}
} else {
push(value1);
push(value2);
super.execute(insn, interpreter);
}
} else {
if (value1 instanceof SinkableArrayValue) {
Value v = interpreter.copyOperation(insn, value1);
push(v);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else {
push(value1);
Value v = interpreter.copyOperation(insn, value1);
push(v);
}
break;
}
break;
case Opcodes.DUP_X1:
value1 = pop();
if (value1.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of DUP");
}
Value value2 = pop();
if (value2.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of DUP");
}
if (value1 instanceof SinkableArrayValue) {
Value v = interpreter.copyOperation(insn, value1);
push(v);
push(value2);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else {
push(value1);
push(value2);
Value v = interpreter.copyOperation(insn, value1);
push(v);
}
break;
case Opcodes.DUP_X2:
value1 = pop();
if (value1.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of DUP");
}
value2 = pop();
Value value3 = null;
if (value2.getSize() == 1)
value3 = pop();
if (value1 instanceof SinkableArrayValue) {
Value v = interpreter.copyOperation(insn, value1);
push(v);
if (value3 != null)
push(value3);
push(value2);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else {
push(value1);
if (value3 != null)
push(value3);
push(value2);
Value v = interpreter.copyOperation(insn, value1);
push(v);
}
break;
case Opcodes.DUP2_X1:
value1 = pop();
value2 = null;
if (value1.getSize() == 1) {
if (value1 instanceof SinkableArrayValue) {
value2 = pop();
if (value2 instanceof SinkableArrayValue) {
throw new IllegalStateException();
} else {
Value v = interpreter.copyOperation(insn, value1);
value3 = pop();
push(value2);
push(v);
push(value3);
push(value2);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
}
} else {
value2 = pop();
if (value2 instanceof SinkableArrayValue)
throw new UnsupportedOperationException();
push(value1);
push(value2);
super.execute(insn, interpreter);
}
} else {
// value2 is null
value3 = pop();
if (value1 instanceof SinkableArrayValue) {
// if(value2 != null)
Value v = interpreter.copyOperation(insn, value1);
push(v);
push(value3);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else {
if (value3 != null && value3 instanceof SinkableArrayValue)
throw new UnsupportedOperationException();
push(value1);
push(value3);
Value v = interpreter.copyOperation(insn, value1);
push(v);
}
}
break;
case Opcodes.DUP2_X2:
value1 = pop();
value2 = null;
if (value1.getSize() == 1) {
if (value1 instanceof SinkableArrayValue)
throw new UnsupportedOperationException();
value2 = pop();
if (value2 instanceof SinkableArrayValue)
throw new UnsupportedOperationException();
push(value1);
push(value2);
super.execute(insn, interpreter);
} else {
value3 = pop();
if (value3.getSize() == 1) {
Value value4 = pop();
if (value1 instanceof SinkableArrayValue) {
Value v = interpreter.copyOperation(insn, value1);
push(v);
push(value4);
push(value3);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else
throw new UnsupportedOperationException();
} else {
// Two words over 2 words
if (value1 instanceof SinkableArrayValue) {
// if(value2 != null)
Value v = interpreter.copyOperation(insn, value1);
push(v);
push(value3);
push(((InstMethodSinkInterpreter) interpreter).copyOperation(insn, (SinkableArrayValue) value1, (SinkableArrayValue) v));
} else {
if (value3 != null && value3 instanceof SinkableArrayValue)
throw new UnsupportedOperationException();
push(value1);
push(value3);
Value v = interpreter.copyOperation(insn, value1);
push(v);
}
}
}
break;
case Opcodes.ACONST_NULL:
case Opcodes.ICONST_M1:
case Opcodes.ICONST_0:
case Opcodes.ICONST_1:
case Opcodes.ICONST_2:
case Opcodes.ICONST_3:
case Opcodes.ICONST_4:
case Opcodes.ICONST_5:
case Opcodes.LCONST_0:
case Opcodes.LCONST_1:
case Opcodes.FCONST_0:
case Opcodes.FCONST_1:
case Opcodes.FCONST_2:
case Opcodes.DCONST_0:
case Opcodes.DCONST_1:
case Opcodes.BIPUSH:
case Opcodes.SIPUSH:
case Opcodes.LDC:
Value v = interpreter.newOperation(insn);
if (v instanceof SinkableArrayValue)
((SinkableArrayValue) v).isConstant = true;
push(v);
break;
default:
super.execute(insn, interpreter);
}
}
use of org.objectweb.asm.tree.analysis.AnalyzerException in project phosphor by gmu-swe.
the class Frame method execute.
public void execute(final AbstractInsnNode insn, final Interpreter interpreter) throws AnalyzerException {
V value1, value2, value3, value4;
List<V> values;
int var;
switch(insn.getOpcode()) {
case Opcodes.NOP:
break;
case Opcodes.ACONST_NULL:
case Opcodes.ICONST_M1:
case Opcodes.ICONST_0:
case Opcodes.ICONST_1:
case Opcodes.ICONST_2:
case Opcodes.ICONST_3:
case Opcodes.ICONST_4:
case Opcodes.ICONST_5:
case Opcodes.LCONST_0:
case Opcodes.LCONST_1:
case Opcodes.FCONST_0:
case Opcodes.FCONST_1:
case Opcodes.FCONST_2:
case Opcodes.DCONST_0:
case Opcodes.DCONST_1:
case Opcodes.BIPUSH:
case Opcodes.SIPUSH:
case Opcodes.LDC:
push((V) interpreter.newOperation(insn));
break;
case Opcodes.ILOAD:
case Opcodes.LLOAD:
case Opcodes.FLOAD:
case Opcodes.DLOAD:
case Opcodes.ALOAD:
push((V) interpreter.copyOperation(insn, getLocal(((VarInsnNode) insn).var)));
break;
case Opcodes.IALOAD:
case Opcodes.LALOAD:
case Opcodes.FALOAD:
case Opcodes.DALOAD:
case Opcodes.AALOAD:
case Opcodes.BALOAD:
case Opcodes.CALOAD:
case Opcodes.SALOAD:
value2 = pop();
value1 = pop();
push((V) interpreter.binaryOperation(insn, value1, value2));
break;
case Opcodes.ISTORE:
case Opcodes.LSTORE:
case Opcodes.FSTORE:
case Opcodes.DSTORE:
case Opcodes.ASTORE:
value1 = (V) interpreter.copyOperation(insn, pop());
var = ((VarInsnNode) insn).var;
setLocal(var, value1);
if (value1.getSize() == 2) {
setLocal(var + 1, (V) interpreter.newValue(null));
}
if (var > 0) {
Value local = getLocal(var - 1);
if (local != null && local.getSize() == 2) {
setLocal(var - 1, (V) interpreter.newValue(null));
}
}
break;
case Opcodes.IASTORE:
case Opcodes.LASTORE:
case Opcodes.FASTORE:
case Opcodes.DASTORE:
case Opcodes.AASTORE:
case Opcodes.BASTORE:
case Opcodes.CASTORE:
case Opcodes.SASTORE:
value3 = pop();
value2 = pop();
value1 = pop();
interpreter.ternaryOperation(insn, value1, value2, value3);
break;
case Opcodes.POP:
if (pop().getSize() == 2) {
throw new AnalyzerException(insn, "Illegal use of POP");
}
break;
case Opcodes.POP2:
if (pop().getSize() == 1 && pop().getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of POP2");
}
break;
case Opcodes.DUP:
value1 = pop();
if (value1.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of DUP");
}
push(value1);
push((V) interpreter.copyOperation(insn, value1));
break;
case Opcodes.DUP_X1:
value1 = pop();
value2 = pop();
if (value1.getSize() != 1 || value2.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of DUP_X1");
}
push((V) interpreter.copyOperation(insn, value1));
push(value2);
push(value1);
break;
case Opcodes.DUP_X2:
value1 = pop();
if (value1.getSize() == 1) {
value2 = pop();
if (value2.getSize() == 1) {
value3 = pop();
if (value3.getSize() == 1) {
push((V) interpreter.copyOperation(insn, value1));
push(value3);
push(value2);
push(value1);
break;
}
} else {
push((V) interpreter.copyOperation(insn, value1));
push(value2);
push(value1);
break;
}
}
throw new AnalyzerException(insn, "Illegal use of DUP_X2");
case Opcodes.DUP2:
value1 = pop();
if (value1.getSize() == 1) {
value2 = pop();
if (value2.getSize() == 1) {
push(value2);
push(value1);
push((V) interpreter.copyOperation(insn, value2));
push((V) interpreter.copyOperation(insn, value1));
break;
}
} else {
push(value1);
push((V) interpreter.copyOperation(insn, value1));
break;
}
throw new AnalyzerException(insn, "Illegal use of DUP2");
case Opcodes.DUP2_X1:
value1 = pop();
if (value1.getSize() == 1) {
value2 = pop();
if (value2.getSize() == 1) {
value3 = pop();
if (value3.getSize() == 1) {
push((V) interpreter.copyOperation(insn, value2));
push((V) interpreter.copyOperation(insn, value1));
push(value3);
push(value2);
push(value1);
break;
}
}
} else {
value2 = pop();
if (value2.getSize() == 1) {
push((V) interpreter.copyOperation(insn, value1));
push(value2);
push(value1);
break;
}
}
throw new AnalyzerException(insn, "Illegal use of DUP2_X1");
case Opcodes.DUP2_X2:
value1 = pop();
if (value1.getSize() == 1) {
value2 = pop();
if (value2.getSize() == 1) {
value3 = pop();
if (value3.getSize() == 1) {
value4 = pop();
if (value4.getSize() == 1) {
push((V) interpreter.copyOperation(insn, value2));
push((V) interpreter.copyOperation(insn, value1));
push(value4);
push(value3);
push(value2);
push(value1);
break;
}
} else {
push((V) interpreter.copyOperation(insn, value2));
push((V) interpreter.copyOperation(insn, value1));
push(value3);
push(value2);
push(value1);
break;
}
}
} else {
value2 = pop();
if (value2.getSize() == 1) {
value3 = pop();
if (value3.getSize() == 1) {
push((V) interpreter.copyOperation(insn, value1));
push(value3);
push(value2);
push(value1);
break;
}
} else {
push((V) interpreter.copyOperation(insn, value1));
push(value2);
push(value1);
break;
}
}
throw new AnalyzerException(insn, "Illegal use of DUP2_X2");
case Opcodes.SWAP:
value2 = pop();
value1 = pop();
if (value1.getSize() != 1 || value2.getSize() != 1) {
throw new AnalyzerException(insn, "Illegal use of SWAP");
}
push((V) interpreter.copyOperation(insn, value2));
push((V) interpreter.copyOperation(insn, value1));
break;
case Opcodes.IADD:
case Opcodes.LADD:
case Opcodes.FADD:
case Opcodes.DADD:
case Opcodes.ISUB:
case Opcodes.LSUB:
case Opcodes.FSUB:
case Opcodes.DSUB:
case Opcodes.IMUL:
case Opcodes.LMUL:
case Opcodes.FMUL:
case Opcodes.DMUL:
case Opcodes.IDIV:
case Opcodes.LDIV:
case Opcodes.FDIV:
case Opcodes.DDIV:
case Opcodes.IREM:
case Opcodes.LREM:
case Opcodes.FREM:
case Opcodes.DREM:
value2 = pop();
value1 = pop();
push((V) interpreter.binaryOperation(insn, value1, value2));
break;
case Opcodes.INEG:
case Opcodes.LNEG:
case Opcodes.FNEG:
case Opcodes.DNEG:
push((V) interpreter.unaryOperation(insn, pop()));
break;
case Opcodes.ISHL:
case Opcodes.LSHL:
case Opcodes.ISHR:
case Opcodes.LSHR:
case Opcodes.IUSHR:
case Opcodes.LUSHR:
case Opcodes.IAND:
case Opcodes.LAND:
case Opcodes.IOR:
case Opcodes.LOR:
case Opcodes.IXOR:
case Opcodes.LXOR:
value2 = pop();
value1 = pop();
push((V) interpreter.binaryOperation(insn, value1, value2));
break;
case Opcodes.IINC:
var = ((IincInsnNode) insn).var;
setLocal(var, (V) interpreter.unaryOperation(insn, getLocal(var)));
break;
case Opcodes.I2L:
case Opcodes.I2F:
case Opcodes.I2D:
case Opcodes.L2I:
case Opcodes.L2F:
case Opcodes.L2D:
case Opcodes.F2I:
case Opcodes.F2L:
case Opcodes.F2D:
case Opcodes.D2I:
case Opcodes.D2L:
case Opcodes.D2F:
case Opcodes.I2B:
case Opcodes.I2C:
case Opcodes.I2S:
push((V) interpreter.unaryOperation(insn, pop()));
break;
case Opcodes.LCMP:
case Opcodes.FCMPL:
case Opcodes.FCMPG:
case Opcodes.DCMPL:
case Opcodes.DCMPG:
value2 = pop();
value1 = pop();
push((V) interpreter.binaryOperation(insn, value1, value2));
break;
case Opcodes.IFEQ:
case Opcodes.IFNE:
case Opcodes.IFLT:
case Opcodes.IFGE:
case Opcodes.IFGT:
case Opcodes.IFLE:
interpreter.unaryOperation(insn, pop());
break;
case Opcodes.IF_ICMPEQ:
case Opcodes.IF_ICMPNE:
case Opcodes.IF_ICMPLT:
case Opcodes.IF_ICMPGE:
case Opcodes.IF_ICMPGT:
case Opcodes.IF_ICMPLE:
case Opcodes.IF_ACMPEQ:
case Opcodes.IF_ACMPNE:
value2 = pop();
value1 = pop();
interpreter.binaryOperation(insn, value1, value2);
break;
case Opcodes.GOTO:
break;
case Opcodes.JSR:
push((V) interpreter.newOperation(insn));
break;
case Opcodes.RET:
break;
case Opcodes.TABLESWITCH:
case Opcodes.LOOKUPSWITCH:
interpreter.unaryOperation(insn, pop());
break;
case Opcodes.IRETURN:
case Opcodes.LRETURN:
case Opcodes.FRETURN:
case Opcodes.DRETURN:
case Opcodes.ARETURN:
value1 = pop();
interpreter.unaryOperation(insn, value1);
interpreter.returnOperation(insn, value1, returnValue);
break;
case Opcodes.RETURN:
if (returnValue != null) {
throw new AnalyzerException(insn, "Incompatible return type");
}
break;
case Opcodes.GETSTATIC:
push((V) interpreter.newOperation(insn));
break;
case Opcodes.PUTSTATIC:
interpreter.unaryOperation(insn, pop());
break;
case Opcodes.GETFIELD:
push((V) interpreter.unaryOperation(insn, pop()));
break;
case Opcodes.PUTFIELD:
value2 = pop();
value1 = pop();
interpreter.binaryOperation(insn, value1, value2);
break;
case Opcodes.INVOKEVIRTUAL:
case Opcodes.INVOKESPECIAL:
case Opcodes.INVOKESTATIC:
case Opcodes.INVOKEINTERFACE:
{
values = new ArrayList<V>();
String desc = ((MethodInsnNode) insn).desc;
for (int i = Type.getArgumentTypes(desc).length; i > 0; --i) {
values.add(0, pop());
}
if (insn.getOpcode() != Opcodes.INVOKESTATIC) {
values.add(0, pop());
}
if (Type.getReturnType(desc) == Type.VOID_TYPE) {
interpreter.naryOperation(insn, values);
} else {
push((V) interpreter.naryOperation(insn, values));
}
break;
}
case Opcodes.INVOKEDYNAMIC:
{
values = new ArrayList<V>();
String desc = ((InvokeDynamicInsnNode) insn).desc;
for (int i = Type.getArgumentTypes(desc).length; i > 0; --i) {
values.add(0, pop());
}
if (Type.getReturnType(desc) == Type.VOID_TYPE) {
interpreter.naryOperation(insn, values);
} else {
push((V) interpreter.naryOperation(insn, values));
}
break;
}
case Opcodes.NEW:
push((V) interpreter.newOperation(insn));
break;
case Opcodes.NEWARRAY:
case Opcodes.ANEWARRAY:
case Opcodes.ARRAYLENGTH:
push((V) interpreter.unaryOperation(insn, pop()));
break;
case Opcodes.ATHROW:
interpreter.unaryOperation(insn, pop());
break;
case Opcodes.CHECKCAST:
case Opcodes.INSTANCEOF:
push((V) interpreter.unaryOperation(insn, pop()));
break;
case Opcodes.MONITORENTER:
case Opcodes.MONITOREXIT:
interpreter.unaryOperation(insn, pop());
break;
case Opcodes.MULTIANEWARRAY:
values = new ArrayList<V>();
for (int i = ((MultiANewArrayInsnNode) insn).dims; i > 0; --i) {
values.add(0, pop());
}
push((V) interpreter.naryOperation(insn, values));
break;
case Opcodes.IFNULL:
case Opcodes.IFNONNULL:
interpreter.unaryOperation(insn, pop());
break;
}
}
Aggregations