public void caseThrowStmt(ThrowStmt s) { emitValue(s.getOp()); emit("athrow", -1); } });
public void caseLengthExpr(LengthExpr v) { emitValue(v.getOp()); emit("arraylength", 0); }
public void caseEnterMonitorStmt(EnterMonitorStmt s) { emitValue(s.getOp()); emit("monitorenter", -1); }
public void caseLookupSwitchStmt(LookupSwitchStmt s) { emitValue(s.getKey()); emit("lookupswitch", -1); List<IntConstant> lookupValues = s.getLookupValues(); List<Unit> targets = s.getTargets(); for (int i = 0; i < lookupValues.size(); i++) { emit(" " + lookupValues.get(i) + " : " + unitToLabel.get(targets.get(i))); } emit(" default : " + unitToLabel.get(s.getDefaultTarget())); }
public void caseTableSwitchStmt(TableSwitchStmt s) { emitValue(s.getKey()); emit("tableswitch " + s.getLowIndex() + " ; high = " + s.getHighIndex(), -1); List<Unit> targets = s.getTargets(); for (int i = 0; i < targets.size(); i++) { emit(" " + unitToLabel.get(targets.get(i))); } emit("default : " + unitToLabel.get(s.getDefaultTarget())); }
public void caseNewMultiArrayExpr(NewMultiArrayExpr v) { for (Value val : v.getSizes()) { emitValue(val); } int size = v.getSizeCount(); emit("multianewarray " + jasminDescriptorOf(v.getBaseType()) + " " + size, -size + 1); }
public void caseSpecialInvokeExpr(SpecialInvokeExpr v) { SootMethodRef m = v.getMethodRef(); emitValue(v.getBase()); for (int i = 0; i < m.parameterTypes().size(); i++) { emitValue(v.getArg(i)); } emit("invokespecial " + slashify(m.declaringClass().getName()) + "/" + m.name() + jasminDescriptorOf(m), -(argCountOf(m) + 1) + sizeOfType(m.returnType())); }
public void caseVirtualInvokeExpr(VirtualInvokeExpr v) { SootMethodRef m = v.getMethodRef(); emitValue(v.getBase()); for (int i = 0; i < m.parameterTypes().size(); i++) { emitValue(v.getArg(i)); } emit("invokevirtual " + slashify(m.declaringClass().getName()) + "/" + m.name() + jasminDescriptorOf(m), -(argCountOf(m) + 1) + sizeOfType(m.returnType())); }
public void caseInvokeStmt(InvokeStmt s) { emitValue(s.getInvokeExpr()); Type returnType = ((InvokeExpr) s.getInvokeExpr()).getMethodRef().returnType(); if (!returnType.equals(VoidType.v())) { // Need to do some cleanup because this value is not used. if (sizeOfType(returnType) == 1) { emit("pop", -1); } else { emit("pop2", -2); } } }
public void caseInterfaceInvokeExpr(InterfaceInvokeExpr v) { SootMethodRef m = v.getMethodRef(); emitValue(v.getBase()); for (int i = 0; i < m.parameterTypes().size(); i++) { emitValue(v.getArg(i)); } emit("invokeinterface " + slashify(m.declaringClass().getName()) + "/" + m.name() + jasminDescriptorOf(m) + " " + (argCountOf(m) + 1), -(argCountOf(m) + 1) + sizeOfType(m.returnType())); }
public void caseInstanceOfExpr(InstanceOfExpr v) { final Type checkType; emitValue(v.getOp()); checkType = v.getCheckType(); if (checkType instanceof RefType) { emit("instanceof " + slashify(checkType.toString()), 0); } else if (checkType instanceof ArrayType) { emit("instanceof " + jasminDescriptorOf(checkType), 0); } }
public void caseStaticInvokeExpr(StaticInvokeExpr v) { SootMethodRef m = v.getMethodRef(); for (int i = 0; i < m.parameterTypes().size(); i++) { emitValue(v.getArg(i)); } emit("invokestatic " + slashify(m.declaringClass().getName()) + "/" + m.name() + jasminDescriptorOf(m), -(argCountOf(m)) + sizeOfType(m.returnType())); }
public void caseStaticFieldRef(StaticFieldRef v) { SootFieldRef field = v.getFieldRef(); emitValue(rvalue); emit("putstatic " + slashify(field.declaringClass().getName()) + "/" + field.name() + " " + jasminDescriptorOf(field.type()), -sizeOfType(v.getFieldRef().type())); } });
public void caseNewInvokeExpr(NewInvokeExpr v) { emit("new " + slashify(v.getBaseType().toString()), 1); emit("dup", 1); SootMethodRef m = v.getMethodRef(); // emitValue(v.getBase()); // already on the stack for (int i = 0; i < m.parameterTypes().size(); i++) { emitValue(v.getArg(i)); } emit("invokespecial " + slashify(m.declaringClass().getName()) + "/" + m.name() + jasminDescriptorOf(m), -(argCountOf(m) + 1) + sizeOfType(m.returnType())); }
public void caseNewArrayExpr(NewArrayExpr v) { Value size = v.getSize(); emitValue(size); if (v.getBaseType() instanceof RefType) { emit("anewarray " + slashify(v.getBaseType().toString()), 0); } else if (v.getBaseType() instanceof ArrayType) { emit("anewarray " + jasminDescriptorOf(v.getBaseType()), 0); } else { emit("newarray " + v.getBaseType().toString(), 0); } }
public void caseInstanceFieldRef(InstanceFieldRef v) { emitValue(v.getBase()); emit("getfield " + slashify(v.getFieldRef().declaringClass().getName()) + "/" + v.getFieldRef().name() + " " + jasminDescriptorOf(v.getFieldRef().type()), -1 + sizeOfType(v.getFieldRef().type())); }