/** * @apilevel internal */ private Type getSootType_compute() { return soot.CharType.v(); } /**
public void outACharBaseTypeNoName(ACharBaseTypeNoName node) { mProductions.addLast(CharType.v()); }
public void outACharBaseType(ACharBaseType node) { mProductions.addLast(CharType.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); }
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 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()); }
baseType = ByteType.v(); } else if (tmp.equals("C")) { baseType = CharType.v(); } else if (tmp.equals("D")) { baseType = DoubleType.v();
baseType = ByteType.v(); } else if (descriptor.equals("C")) { baseType = CharType.v(); } else if (descriptor.equals("D")) { baseType = DoubleType.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(); } } }
if (t.equals(BooleanType.v())) { type = Opcodes.T_BOOLEAN; } else if (t.equals(CharType.v())) { type = Opcodes.T_CHAR; } else if (t.equals(FloatType.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(); } }
break; case 'C': // char type = CharType.v(); break; case 'I': // int
totype = ShortType.v(); } else if (op == I2C) { totype = CharType.v(); } else { throw new AssertionError("Unknonw prim cast op: " + op);
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); }