Java Code Examples for soot.jimple.DoubleConstant#v()
The following examples show how to use
soot.jimple.DoubleConstant#v() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseEntryPointCreator.java From JAADAS with GNU General Public License v3.0 | 6 votes |
protected Value getSimpleDefaultValue(String t) { if (t.equals("java.lang.String")) return StringConstant.v(""); if (t.equals("char")) return DIntConstant.v(0, CharType.v()); if (t.equals("byte")) return DIntConstant.v(0, ByteType.v()); if (t.equals("short")) return DIntConstant.v(0, ShortType.v()); if (t.equals("int")) return IntConstant.v(0); if (t.equals("float")) return FloatConstant.v(0); if (t.equals("long")) return LongConstant.v(0); if (t.equals("double")) return DoubleConstant.v(0); if (t.equals("boolean")) return DIntConstant.v(0, BooleanType.v()); //also for arrays etc. return G.v().soot_jimple_NullConstant(); }
Example 2
Source File: CPHelper.java From JAADAS with GNU General Public License v3.0 | 6 votes |
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; }
Example 3
Source File: AsmMethodSource.java From JAADAS with GNU General Public License v3.0 | 6 votes |
private Value toSootValue(Object val) throws AssertionError { Value v; if (val instanceof Integer) v = IntConstant.v((Integer) val); else if (val instanceof Float) v = FloatConstant.v((Float) val); else if (val instanceof Long) v = LongConstant.v((Long) val); else if (val instanceof Double) v = DoubleConstant.v((Double) val); else if (val instanceof String) v = StringConstant.v(val.toString()); else if (val instanceof org.objectweb.asm.Type) v = ClassConstant.v(((org.objectweb.asm.Type) val).getInternalName()); else if (val instanceof Handle) v = MethodHandle.v(toSootMethodRef((Handle) val), ((Handle)val).getTag()); else throw new AssertionError("Unknown constant type: " + val.getClass()); return v; }
Example 4
Source File: AsmMethodSource.java From JAADAS with GNU General Public License v3.0 | 5 votes |
private void convertConstInsn(InsnNode insn) { int op = insn.getOpcode(); StackFrame frame = getFrame(insn); Operand[] out = frame.out(); Operand opr; if (out == null) { Value v; if (op == ACONST_NULL) v = NullConstant.v(); else if (op >= ICONST_M1 && op <= ICONST_5) v = IntConstant.v(op - ICONST_0); else if (op == LCONST_0 || op == LCONST_1) v = LongConstant.v(op - LCONST_0); else if (op >= FCONST_0 && op <= FCONST_2) v = FloatConstant.v(op - FCONST_0); else if (op == DCONST_0 || op == DCONST_1) v = DoubleConstant.v(op - DCONST_0); else throw new AssertionError("Unknown constant opcode: " + op); opr = new Operand(insn, v); frame.out(opr); } else { opr = out[0]; } if (op == LCONST_0 || op == LCONST_1 || op == DCONST_0 || op == DCONST_1) { pushDual(opr); } else { push(opr); } }
Example 5
Source File: InstrumentationUtils.java From DroidRA with GNU Lesser General Public License v2.1 | 5 votes |
public static Value toDefaultSootTypeValue(Type sootType) { String type = sootType.toString(); if ("boolean".equals(type)) { IntConstant.v(0); } else if ("byte".equals(type)) { return IntConstant.v(0); } else if ("char".equals(type)) { return IntConstant.v(0); } else if ("short".equals(type)) { return IntConstant.v(0); } else if ("int".equals(type)) { return IntConstant.v(0); } else if ("long".equals(type)) { return LongConstant.v(0); } else if ("float".equals(type)) { return FloatConstant.v(0); } else if ("double".equals(type)) { return DoubleConstant.v(0); } return NullConstant.v(); }
Example 6
Source File: Walker.java From JAADAS with GNU General Public License v3.0 | 4 votes |
public void outAFloatConstant(AFloatConstant node) { String s = (String) mProductions.removeLast(); boolean isDouble = true; float value = 0; double dvalue = 0; if(s.endsWith("f") || s.endsWith("F")) isDouble = false; if(s.charAt(0) == '#') { if(s.charAt(1) == '-') { if(isDouble) dvalue = Double.NEGATIVE_INFINITY; else value = Float.NEGATIVE_INFINITY; } else if(s.charAt(1) == 'I') { if(isDouble) dvalue = Double.POSITIVE_INFINITY; else value = Float.POSITIVE_INFINITY; } else { if(isDouble) dvalue = Double.NaN; else value = Float.NaN; } } else { StringBuffer buf = new StringBuffer(); if(node.getMinus() != null) buf.append('-'); buf.append(s); s = buf.toString(); if(isDouble) dvalue = Double.parseDouble(s); else value =Float.parseFloat(s); } Object res; if(isDouble) res = DoubleConstant.v(dvalue); else res = FloatConstant.v(value); mProductions.addLast(res); }
Example 7
Source File: UntypedLongOrDoubleConstant.java From JAADAS with GNU General Public License v3.0 | 4 votes |
public DoubleConstant toDoubleConstant() { return DoubleConstant.v(Double.longBitsToDouble(value)); }
Example 8
Source File: CONSTANT_Double_info.java From JAADAS with GNU General Public License v3.0 | 4 votes |
public Value createJimpleConstantValue(cp_info[] constant_pool) { return DoubleConstant.v(convert()); }