public void caseThrowStmt(ThrowStmt s) { emitValue(s.getOp()); emit("athrow", -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 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 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 caseEqExpr(EqExpr expr) { emit("ifeq " + label, -1); }
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 caseGeExpr(GeExpr expr) { emit("ifge " + label, -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 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 caseIdentityStmt(IdentityStmt s) { if (s.getRightOp() instanceof CaughtExceptionRef && s.getLeftOp() instanceof Local) { int slot = localToSlot.get(s.getLeftOp()).intValue(); modifyStackHeight(1); // simulate the pushing of the exception onto the // stack by the jvm if (slot >= 0 && slot <= 3) { emit("astore_" + slot, -1); } else { emit("astore " + slot, -1); } } }
public void caseInstanceFieldRef(InstanceFieldRef v) { emitValue(v.getBase()); emitValue(rvalue); emit("putfield " + slashify(v.getFieldRef().declaringClass().getName()) + "/" + v.getFieldRef().name() + " " + jasminDescriptorOf(v.getFieldRef().type()), -1 + -sizeOfType(v.getFieldRef().type())); }
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 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())); }