/** * @apilevel internal */ private Type getSootType_compute() { return soot.ByteType.v(); } /**
public void outAByteBaseType(AByteBaseType node) { mProductions.addLast(ByteType.v()); }
public void outAByteBaseTypeNoName(AByteBaseTypeNoName node) { mProductions.addLast(ByteType.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; } }
baseType = IntType.v(); } else if (tmp.equals("B")) { baseType = ByteType.v(); } else if (tmp.equals("C")) { baseType = CharType.v();
baseType = ByteType.v(); } else if (descriptor.equals("C")) { baseType = CharType.v();
public Type getType() { Value op1 = op1Box.getValue(); Value op2 = op2Box.getValue(); Type op1t = op1.getType(); Type op2t = op2.getType(); if ((op1t.equals(IntType.v()) || op1t.equals(ByteType.v()) || op1t.equals(ShortType.v()) || op1t.equals(CharType.v()) || op1t.equals(BooleanType.v())) && (op2t.equals(IntType.v()) || op2t.equals(ByteType.v()) || op2t.equals(ShortType.v()) || op2t.equals(CharType.v()) || op2t.equals(BooleanType.v()))) { return IntType.v(); } else if (op1t.equals(LongType.v()) || op2t.equals(LongType.v())) { return LongType.v(); } else if (op1t.equals(DoubleType.v()) || op2t.equals(DoubleType.v())) { return DoubleType.v(); } else if (op1t.equals(FloatType.v()) || op2t.equals(FloatType.v())) { return FloatType.v(); } else { return UnknownType.v(); } } }
} else if (t.equals(DoubleType.v())) { type = Opcodes.T_DOUBLE; } else if (t.equals(ByteType.v())) { type = Opcodes.T_BYTE; } else if (t.equals(ShortType.v())) {
private void emitIntToTypeCast() { if (toType.equals(ByteType.v())) { setResult("i2b"); } else if (toType.equals(CharType.v())) { setResult("i2c"); } else if (toType.equals(ShortType.v())) { setResult("i2s"); } else if (toType.equals(FloatType.v())) { setResult("i2f"); } else if (toType.equals(LongType.v())) { setResult("i2l"); } else if (toType.equals(DoubleType.v())) { setResult("i2d"); } else if (toType.equals(IntType.v())) { setResult(""); // this shouldn't happen? } else if (toType.equals(BooleanType.v())) { setResult(""); } else { throw new RuntimeException("invalid toType from int: " + toType); } }
public Wrapper() { PrimType[] tmp = { BooleanType.v(), ByteType.v(), CharType.v(), DoubleType.v(), FloatType.v(), IntType.v(), LongType.v(), ShortType.v() }; wrapperTypes = new HashMap<>(); valueOf = new HashMap<>(); primitiveValue = new HashMap<>(); for (PrimType primType : tmp) { RefType wrapperType = primType.boxedType(); String cn = wrapperType.getClassName(); wrapperTypes.put(wrapperType, primType); String valueOfMethodSignature = cn + " valueOf(" + primType.toString() + ")"; SootMethod valueOfMethod = wrapperType.getSootClass().getMethod(valueOfMethodSignature); valueOf.put(primType, valueOfMethod); String primitiveValueMethodSignature = primType.toString() + " " + primType.toString() + "Value()"; SootMethod primitiveValueMethod = wrapperType.getSootClass().getMethod(primitiveValueMethodSignature); primitiveValue.put(wrapperType, primitiveValueMethod); } wrapperTypes = Collections.unmodifiableMap(wrapperTypes); valueOf = Collections.unmodifiableMap(valueOf); primitiveValue = Collections.unmodifiableMap(primitiveValue); }
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(); } }
static Type getTypeForCast(TypeNode node) // This method is a local kludge, for avoiding NullPointerExceptions // when a R0_1, R0_127, or R0_32767 node is used in a type // cast. A more elegant solution would work with the TypeNode // type definition itself, but that would require a more thorough // knowledge of the typing system than the kludger posesses. { if (node.type() == null) { if (node == ClassHierarchy.v().R0_1) { return BooleanType.v(); } else if (node == ClassHierarchy.v().R0_127) { return ByteType.v(); } else if (node == ClassHierarchy.v().R0_32767) { return ShortType.v(); } // Perhaps we should throw an exception here, since I don't think // there should be any other cases where node.type() is null. // In case that supposition is incorrect, though, we'll just // go on to return the null, and let the callers worry about it. } return node.type(); }
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()); } } } }
private static Value getConstantType(Type t) { if (t instanceof BooleanType) { return IntConstant.v(Rand.getInt(1)); } if (t instanceof IntType) { return IntConstant.v(Rand.getInt()); } if (t instanceof CharType) { return Jimple.v().newCastExpr(IntConstant.v(Rand.getInt()), CharType.v()); } if (t instanceof ByteType) { return Jimple.v().newCastExpr(IntConstant.v(Rand.getInt()), ByteType.v()); } if (t instanceof LongType) { return LongConstant.v(Rand.getLong()); } if (t instanceof FloatType) { return FloatConstant.v(Rand.getFloat()); } if (t instanceof DoubleType) { return DoubleConstant.v(Rand.getDouble()); } return Jimple.v().newCastExpr(NullConstant.v(), t); }