/** * @apilevel internal */ private Type getSootType_compute() { return soot.BooleanType.v(); } /**
public Type getType() { return BooleanType.v(); }
public void outABooleanBaseType(ABooleanBaseType node) { mProductions.addLast(BooleanType.v()); }
public void outABooleanBaseTypeNoName(ABooleanBaseTypeNoName node) { mProductions.addLast(BooleanType.v()); }
public ClassHierarchy(Singletons.Global g) { typeNodeMap.put(BooleanType.v(), BOOLEAN); typeNodeMap.put(ByteType.v(), BYTE); typeNodeMap.put(ShortType.v(), SHORT); typeNodeMap.put(CharType.v(), CHAR); typeNodeMap.put(IntType.v(), INT); }
public static boolean isIntLikeType(Type t) { return t.equals(IntType.v()) || t.equals(ByteType.v()) || t.equals(ShortType.v()) || t.equals(CharType.v()) || t.equals(BooleanType.v()); }
private Type byteCodeTypeOf(Type type) { if (type.equals(ShortType.v()) || type.equals(CharType.v()) || type.equals(ByteType.v()) || type.equals(BooleanType.v())) { return IntType.v(); } else { return type; } }
/** Converts the int-like types (short, byte, boolean and char) to IntType. */ public static Type toMachineType(Type t) { if (t.equals(ShortType.v()) || t.equals(ByteType.v()) || t.equals(BooleanType.v()) || t.equals(CharType.v())) { return IntType.v(); } else { return t; } }
public void caseIfStmt(IfStmt stmt) { this.handleBinopExpr((BinopExpr) stmt.getCondition(), stmt, BooleanType.v()); }
public static Value createConstant(Object toConvert) { if (toConvert instanceof Long) { return LongConstant.v(((Long) toConvert).longValue()); } else if (toConvert instanceof Double) { return DoubleConstant.v(((Double) toConvert).doubleValue()); } else if (toConvert instanceof Boolean) { boolean val = ((Boolean) toConvert).booleanValue(); if (val) { return DIntConstant.v(1, BooleanType.v()); } else { return DIntConstant.v(0, BooleanType.v()); } } else if (toConvert instanceof Float) { return FloatConstant.v(((Float) toConvert).floatValue()); } else if (toConvert instanceof Integer) { return IntConstant.v(((Integer) toConvert).intValue()); } else { return null; } }
private void addCaching() { SootClass method = Scene.v().getSootClass("java.lang.reflect.Method"); method.addField(Scene.v().makeSootField(ALREADY_CHECKED_FIELDNAME, BooleanType.v())); SootClass constructor = Scene.v().getSootClass("java.lang.reflect.Constructor"); constructor.addField(Scene.v().makeSootField(ALREADY_CHECKED_FIELDNAME, BooleanType.v())); SootClass clazz = Scene.v().getSootClass("java.lang.Class"); clazz.addField(Scene.v().makeSootField(ALREADY_CHECKED_FIELDNAME, BooleanType.v())); for (Kind k : Kind.values()) { addCaching(k); } }
public Type getType() { Value op = opBox.getValue(); if (op.getType().equals(IntType.v()) || op.getType().equals(ByteType.v()) || op.getType().equals(ShortType.v()) || op.getType().equals(BooleanType.v()) || op.getType().equals(CharType.v())) { return IntType.v(); } else if (op.getType().equals(LongType.v())) { return LongType.v(); } else if (op.getType().equals(DoubleType.v())) { return DoubleType.v(); } else if (op.getType().equals(FloatType.v())) { return FloatType.v(); } else { return UnknownType.v(); } }
public Type getType() { Value op = getOpBox().getValue(); if (op.getType().equals(IntType.v()) || op.getType().equals(ByteType.v()) || op.getType().equals(ShortType.v()) || op.getType().equals(BooleanType.v()) || op.getType().equals(CharType.v())) { return IntType.v(); } else if (op.getType().equals(LongType.v())) { return LongType.v(); } else if (op.getType().equals(DoubleType.v())) { return DoubleType.v(); } else if (op.getType().equals(FloatType.v())) { return FloatType.v(); } else { return UnknownType.v(); } }
Type jimpleTypeOfAtype(int atype) { switch (atype) { case 4: return BooleanType.v(); case 5: return CharType.v(); case 6: return FloatType.v(); case 7: return DoubleType.v(); case 8: return ByteType.v(); case 9: return ShortType.v(); case 10: return IntType.v(); case 11: return LongType.v(); default: throw new RuntimeException("Undefined 'atype' in NEWARRAY byte instruction"); } }
private static Type getPrimType(int idx) { switch (idx) { case 0: return IntType.v(); case 1: return CharType.v(); case 2: return ByteType.v(); case 3: return LongType.v(); case 4: return BooleanType.v(); case 5: return DoubleType.v(); case 6: return FloatType.v(); default: return IntType.v(); } }
private void assign_types_2() throws TypeException { for (Iterator<Local> localIt = stmtBody.getLocals().iterator(); localIt.hasNext();) { final Local local = localIt.next(); if (local.getType() instanceof IntegerType) { TypeVariable var = typeVariable(local); if (var.inv_approx() != null && var.inv_approx().type() != null) { local.setType(var.inv_approx().type()); } else if (var.approx().type() != null) { local.setType(var.approx().type()); } else if (var.approx() == ClassHierarchy.v().R0_1) { local.setType(BooleanType.v()); } else if (var.approx() == ClassHierarchy.v().R0_127) { local.setType(ByteType.v()); } else { local.setType(ShortType.v()); } } } }
/** * @ast method * @aspect BooleanExpressions * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/BooleanExpressions.jrag:105 */ protected soot.Value emitBooleanCondition(Body b) { b.setLine(this); emitEvalBranch(b); soot.jimple.Stmt end_label = newLabel(); b.addLabel(false_label()); Local result = b.newTemp(soot.BooleanType.v()); b.add(b.newAssignStmt(result, BooleanType.emitConstant(false), this)); b.add(b.newGotoStmt(end_label, this)); b.addLabel(true_label()); b.add(b.newAssignStmt(result, BooleanType.emitConstant(true), this)); b.addLabel(end_label); return result; } /**
/** * InstanceOf Expression Creation */ private soot.Local getInstanceOfLocal(polyglot.ast.Instanceof instExpr) { soot.Type sootType = Util.getSootType(instExpr.compareType().type()); soot.Value local = base().createAggressiveExpr(instExpr.expr(), false, false); soot.jimple.InstanceOfExpr instOfExpr = soot.jimple.Jimple.v().newInstanceOfExpr(local, sootType); soot.Local lhs = lg.generateLocal(soot.BooleanType.v()); soot.jimple.AssignStmt instAssign = soot.jimple.Jimple.v().newAssignStmt(lhs, instOfExpr); body.getUnits().add(instAssign); Util.addLnPosTags(instAssign, instExpr.position()); Util.addLnPosTags(instAssign.getRightOpBox(), instExpr.position()); Util.addLnPosTags(instOfExpr.getOpBox(), instExpr.expr().position()); return lhs; }
private soot.Local handleCondBinExpr(soot.jimple.ConditionExpr condExpr) { soot.Local boolLocal = lg.generateLocal(soot.BooleanType.v()); soot.jimple.Stmt noop1 = soot.jimple.Jimple.v().newNopStmt(); soot.Value newVal; newVal = reverseCondition(condExpr); newVal = handleDFLCond((soot.jimple.ConditionExpr) newVal); soot.jimple.Stmt ifStmt = soot.jimple.Jimple.v().newIfStmt(newVal, noop1); body.getUnits().add(ifStmt); body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(boolLocal, soot.jimple.IntConstant.v(1))); soot.jimple.Stmt noop2 = soot.jimple.Jimple.v().newNopStmt(); soot.jimple.Stmt goto1 = soot.jimple.Jimple.v().newGotoStmt(noop2); body.getUnits().add(goto1); body.getUnits().add(noop1); body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(boolLocal, soot.jimple.IntConstant.v(0))); body.getUnits().add(noop2); return boolLocal; }
private soot.Local handleCondBinExpr(soot.jimple.ConditionExpr condExpr, boolean reverse) { soot.Local boolLocal = lg.generateLocal(soot.BooleanType.v()); soot.jimple.Stmt noop1 = soot.jimple.Jimple.v().newNopStmt(); soot.Value newVal = condExpr; if (reverse) { newVal = reverseCondition(condExpr); } newVal = handleDFLCond((soot.jimple.ConditionExpr) newVal); soot.jimple.Stmt ifStmt = soot.jimple.Jimple.v().newIfStmt(newVal, noop1); body.getUnits().add(ifStmt); body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(boolLocal, soot.jimple.IntConstant.v(1))); soot.jimple.Stmt noop2 = soot.jimple.Jimple.v().newNopStmt(); soot.jimple.Stmt goto1 = soot.jimple.Jimple.v().newGotoStmt(noop2); body.getUnits().add(goto1); body.getUnits().add(noop1); body.getUnits().add(soot.jimple.Jimple.v().newAssignStmt(boolLocal, soot.jimple.IntConstant.v(0))); body.getUnits().add(noop2); return boolLocal; }