• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FloatConstant类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中soot.jimple.FloatConstant的典型用法代码示例。如果您正苦于以下问题:Java FloatConstant类的具体用法?Java FloatConstant怎么用?Java FloatConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FloatConstant类属于soot.jimple包,在下文中一共展示了FloatConstant类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSimpleDefaultValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
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();
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:24,代码来源:BaseEntryPointCreator.java


示例2: getPushInitializer

import soot.jimple.FloatConstant; //导入依赖的package包/类
public static PushInst getPushInitializer(Local l, Type t) {
  if (t instanceof IntegerType) {
    return Baf.v().newPushInst(IntConstant.v(soot.jbco.util.Rand.getInt()));
  } else if (t instanceof RefLikeType || t instanceof StmtAddressType) {
    return Baf.v().newPushInst(NullConstant.v());
  } else if (t instanceof LongType) {
    return Baf.v().newPushInst(LongConstant.v(soot.jbco.util.Rand.getLong()));
  } else if (t instanceof FloatType) {
    return Baf.v().newPushInst(
        FloatConstant.v(soot.jbco.util.Rand.getFloat()));
  } else if (t instanceof DoubleType) {
    return Baf.v().newPushInst(
        DoubleConstant.v(soot.jbco.util.Rand.getDouble()));
  }
  
  return null;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:18,代码来源:FixUndefinedLocals.java


示例3: isAConstantValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
public static Object isAConstantValue(Value toCheck){
	Object value=null;
	
	if(toCheck instanceof LongConstant){
		value = new Long(((LongConstant)toCheck).value);
	}
	else if(toCheck instanceof DoubleConstant){
		value = new Double(((DoubleConstant)toCheck).value);
	}
	else if(toCheck instanceof FloatConstant){
		value = new Float(((FloatConstant)toCheck).value);
	}
	else if(toCheck instanceof IntConstant){
		int val = ((IntConstant)toCheck).value;
		value = new Integer(val);			
	}
	return value;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:CPHelper.java


示例4: createConstant

import soot.jimple.FloatConstant; //导入依赖的package包/类
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;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:24,代码来源:CPHelper.java


示例5: toSootValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
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;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:21,代码来源:AsmMethodSource.java


示例6: floatToString

import soot.jimple.FloatConstant; //导入依赖的package包/类
protected String floatToString(FloatConstant v) {
	String s = v.toString();
	
	if(s.equals("#InfinityF"))
	    s="+FloatInfinity";
	else if(s.equals("#-InfinityF"))
	    s="-FloatInfinity";
	else if(s.equals("#NaNF"))
	    s="+FloatNaN";
	return s;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:12,代码来源:AbstractJasminClass.java


示例7: convertConstInsn

import soot.jimple.FloatConstant; //导入依赖的package包/类
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);
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:32,代码来源:AsmMethodSource.java


示例8: createConstantTagFromValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
private ConstantValueTag createConstantTagFromValue(Constant rightOp) {
	if (rightOp instanceof DoubleConstant)
		return new DoubleConstantValueTag(((DoubleConstant) rightOp).value);
	else if (rightOp instanceof FloatConstant)
		return new FloatConstantValueTag(((FloatConstant) rightOp).value);
	else if (rightOp instanceof IntConstant)
		return new IntegerConstantValueTag(((IntConstant) rightOp).value);
	else if (rightOp instanceof LongConstant)
		return new LongConstantValueTag(((LongConstant) rightOp).value);
	else if (rightOp instanceof StringConstant)
		return new StringConstantValueTag(((StringConstant) rightOp).value);
	else
		return null;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:15,代码来源:ConstantInitializerToTagTransformer.java


示例9: checkConstantValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
private boolean checkConstantValue(ConstantValueTag t, Constant rightOp) {
	if (t == null || rightOp == null)
		return true;
	
	if (t instanceof DoubleConstantValueTag) {
		if (!(rightOp instanceof DoubleConstant))
			return false;
		return ((DoubleConstantValueTag) t).getDoubleValue() == ((DoubleConstant) rightOp).value;
	}
	else if (t instanceof FloatConstantValueTag) {
		if (!(rightOp instanceof FloatConstant))
			return false;
		return ((FloatConstantValueTag) t).getFloatValue() == ((FloatConstant) rightOp).value;
	}
	else if (t instanceof IntegerConstantValueTag) {
		if (!(rightOp instanceof IntConstant))
			return false;
		return ((IntegerConstantValueTag) t).getIntValue() == ((IntConstant) rightOp).value;
	}
	else if (t instanceof LongConstantValueTag) {
		if (!(rightOp instanceof LongConstant))
			return false;
		return ((LongConstantValueTag) t).getLongValue() == ((LongConstant) rightOp).value;
	}
	else if (t instanceof StringConstantValueTag) {
		if (!(rightOp instanceof StringConstant))
			return false;
		return ((StringConstantValueTag) t).getStringValue().equals(((StringConstant) rightOp).value);
	}
	else
		// We don't know the type, so we assume it's alright
		return true;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:34,代码来源:ConstantInitializerToTagTransformer.java


示例10: testJBinOpExp

import soot.jimple.FloatConstant; //导入依赖的package包/类
@Test
public void testJBinOpExp() {
    Value v = Jimple.v().newAddExpr(IntConstant.v(456), 
            Jimple.v().newLocal("local", IntType.v()));
    assertTrue(ExceptionTestUtility.sameMembers(utility.VM_ERRORS, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(v)));
    assertEquals(utility.VM_ERRORS_PLUS_SUPERTYPES,
            utility.catchableSubset(unitAnalysis.mightThrow(v)));

    v = Jimple.v().newOrExpr(Jimple.v().newLocal("local", LongType.v()),
            LongConstant.v(33));
    assertTrue(ExceptionTestUtility.sameMembers(utility.VM_ERRORS, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(v)));
    assertEquals(utility.VM_ERRORS_PLUS_SUPERTYPES,
            utility.catchableSubset(unitAnalysis.mightThrow(v)));

    v = Jimple.v().newLeExpr(Jimple.v().newLocal("local", FloatType.v()),
            FloatConstant.v(33.42f));
    assertTrue(ExceptionTestUtility.sameMembers(utility.VM_ERRORS, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(v)));
    assertEquals(utility.VM_ERRORS_PLUS_SUPERTYPES,
            utility.catchableSubset(unitAnalysis.mightThrow(v)));

    v = Jimple.v().newEqExpr(DoubleConstant.v(-33.45e-3),
            Jimple.v().newLocal("local", DoubleType.v()));
    assertTrue(ExceptionTestUtility.sameMembers(utility.VM_ERRORS, Collections.EMPTY_SET,
                unitAnalysis.mightThrow(v)));
    assertEquals(utility.VM_ERRORS_PLUS_SUPERTYPES,
            utility.catchableSubset(unitAnalysis.mightThrow(v)));
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:31,代码来源:UnitThrowAnalysisTest.java


示例11: lookupInternFloat

import soot.jimple.FloatConstant; //导入依赖的package包/类
public IdentifierExpression lookupInternFloat(FloatConstant s) {
	if (!floatInternMap.containsKey(s.toString())) {
		String name = "$FloatConst" + floatInternMap.size();
		floatInternMap.put(s.toString(),
				this.pf.mkIdentifierExpression(this.getBoogieType(s.getType()), name, true, true, true));
	}
	return floatInternMap.get(s.toString());
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:9,代码来源:GlobalsCache.java


示例12: getPrimValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
/**
 * Return a constant value corresponding to the primary type.
 * 
 * @param type
 * @return
 */
public static Value getPrimValue(PrimType type) {
	if (type instanceof IntegerType) {
		return IntConstant.v(1);
	} else if (type instanceof LongType) {
		return LongConstant.v(1);
	} else if (type instanceof FloatType) {
		return FloatConstant.v(1);
	} else {
		return DoubleConstant.v(1);
	}
}
 
开发者ID:karimhamdanali,项目名称:averroes,代码行数:18,代码来源:AverroesJimpleBody.java


示例13: toDefaultSootTypeValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
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();
}
 
开发者ID:serval-snt-uni-lu,项目名称:DroidRA,代码行数:40,代码来源:InstrumentationUtils.java


示例14: lookupInternFloat

import soot.jimple.FloatConstant; //导入依赖的package包/类
public IdentifierExpression lookupInternFloat(FloatConstant s) {
	if (!floatInternMap.containsKey(s.toString())) {
		String name = "$FloatConst"+floatInternMap.size();
		floatInternMap.put(s.toString(), this.pf.mkIdentifierExpression(this.getBoogieType(s.getType()), name, true, true, true));
	}
	return floatInternMap.get(s.toString());
}
 
开发者ID:martinschaef,项目名称:jar2bpl,代码行数:8,代码来源:GlobalsCache.java


示例15: ConstantValue

import soot.jimple.FloatConstant; //导入依赖的package包/类
/**
 * Builds a representation of a constant from its value expressed as
 * a Soot constant and its Soot type. It is transformed in an equivalent
 * pair of strings.
 * @param v the value of the constant
 * @param t its type.
 */
public ConstantValue(Constant v, Type t) { 
	if (v instanceof IntConstant) {
		int n = ((IntConstant) v).value;
		if (t instanceof CharType) {
			rep_t = CHAR_TYPE;
			rep_v = Character.toString((char) n);
		} else if (t instanceof BooleanType) {
			rep_t = BOOLEAN_TYPE;
			rep_v = Boolean.toString((n != 0));
		} else {
			rep_t = INT_TYPE;
			rep_v = Integer.toString(n);
		}
	} else if (v instanceof LongConstant) {
		rep_t = LONG_TYPE;
		rep_v = Long.toString(((LongConstant) v).value);
	} else if (v instanceof FloatConstant) {
		rep_t = FLOAT_TYPE;
		rep_v = Float.toString(((FloatConstant) v).value);
	} else if (v instanceof NullConstant) {
		rep_t = NULL;
		rep_v = NULL;
	} else {
		rep_t = t.toString();
		rep_v = "";
	}
}
 
开发者ID:Orange-OpenSource,项目名称:matos-tool,代码行数:35,代码来源:ConstantValue.java


示例16: caseFloatConstant

import soot.jimple.FloatConstant; //导入依赖的package包/类
public void caseFloatConstant(FloatConstant v) {
	printConstant(v,Float.toString(v.value));
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:4,代码来源:ValueTemplatePrinter.java


示例17: outAFloatConstant

import soot.jimple.FloatConstant; //导入依赖的package包/类
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);
   }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:53,代码来源:Walker.java


示例18: caseIfStmt

import soot.jimple.FloatConstant; //导入依赖的package包/类
public void caseIfStmt(IfStmt stmt) {
	if (uses) {
		ConditionExpr cond = (ConditionExpr) stmt.getCondition();

		BinopExpr expr = cond;
		Value lv = expr.getOp1();
		Value rv = expr.getOp2();

		TypeVariable lop;
		TypeVariable rop;

		// ******** LEFT ********
		if (lv instanceof Local) {
			lop = resolver.typeVariable((Local) lv);
		} else if (lv instanceof DoubleConstant) {
			lop = resolver.typeVariable(DoubleType.v());
		} else if (lv instanceof FloatConstant) {
			lop = resolver.typeVariable(FloatType.v());
		} else if (lv instanceof IntConstant) {
			lop = resolver.typeVariable(IntType.v());
		} else if (lv instanceof LongConstant) {
			lop = resolver.typeVariable(LongType.v());
		} else if (lv instanceof NullConstant) {
			lop = resolver.typeVariable(NullType.v());
		} else if (lv instanceof StringConstant) {
			lop = resolver.typeVariable(RefType.v("java.lang.String"));
		} else if (lv instanceof ClassConstant) {
			lop = resolver.typeVariable(RefType.v("java.lang.Class"));
		} else {
			throw new RuntimeException("Unhandled binary expression left operand type: " + lv.getClass());
		}

		// ******** RIGHT ********
		if (rv instanceof Local) {
			rop = resolver.typeVariable((Local) rv);
		} else if (rv instanceof DoubleConstant) {
			rop = resolver.typeVariable(DoubleType.v());
		} else if (rv instanceof FloatConstant) {
			rop = resolver.typeVariable(FloatType.v());
		} else if (rv instanceof IntConstant) {
			rop = resolver.typeVariable(IntType.v());
		} else if (rv instanceof LongConstant) {
			rop = resolver.typeVariable(LongType.v());
		} else if (rv instanceof NullConstant) {
			rop = resolver.typeVariable(NullType.v());
		} else if (rv instanceof StringConstant) {
			rop = resolver.typeVariable(RefType.v("java.lang.String"));
		} else if (rv instanceof ClassConstant) {
			rop = resolver.typeVariable(RefType.v("java.lang.Class"));
		} else {
			throw new RuntimeException("Unhandled binary expression right operand type: " + rv.getClass());
		}

		TypeVariable common = resolver.typeVariable();
		rop.addParent(common);
		lop.addParent(common);
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:59,代码来源:ConstraintCollector.java


示例19: asConstant

import soot.jimple.FloatConstant; //导入依赖的package包/类
private Register asConstant(Value v, ConstantVisitor constantV) {
	Constant c = (Constant) v;
	
	Register constantRegister = null;
	
	List<Register> rArray = null;
	AtomicInteger iI = null;
	if (c instanceof ClassConstant) {
	    rArray = classConstantReg;
	    iI = classI;
	} else if (c instanceof NullConstant) {
           rArray = nullConstantReg;
           iI = nullI;
       } else if (c instanceof FloatConstant) {
           rArray = floatConstantReg;
           iI = floatI;
       } else if (c instanceof IntConstant) {
           rArray = intConstantReg;
           iI = intI;
       } else if (c instanceof LongConstant) {
           rArray = longConstantReg;
           iI = longI;
       } else if (c instanceof DoubleConstant) {
           rArray = doubleConstantReg;
           iI = doubleI;
       } else if (c instanceof StringConstant) {
           rArray = stringConstantReg;
           iI = stringI;
       } else {
           throw new RuntimeException("Error. Unknown constant type: '"+ c.getType() +"'");
       }
	
	if (rArray.size() == 0 || iI.intValue() >= rArray.size()) {
	    rArray.add(new Register(c.getType(), nextRegNum));
	    nextRegNum += SootToDexUtils.getDexWords(c.getType());
	}
	
	constantRegister = rArray.get(iI.intValue()).clone();
	iI.set(iI.intValue() + 1);

	// "load" constant into the register...
	constantV.setDestination(constantRegister);
	c.apply(constantV);
	// ...but return an independent register object
	return constantRegister.clone();
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:47,代码来源:RegisterAllocator.java


示例20: caseFloatConstant

import soot.jimple.FloatConstant; //导入依赖的package包/类
public void caseFloatConstant(FloatConstant f) {
	int intBits = Float.floatToIntBits(f.value);
       stmtV.addInsn(buildConstInsn(intBits), origStmt);
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:5,代码来源:ConstantVisitor.java



注:本文中的soot.jimple.FloatConstant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AuthenticationFilter类代码示例发布时间:2022-05-22
下一篇:
Java DmnDecisionTableResult类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap