本文整理汇总了Java中soot.jimple.LongConstant类的典型用法代码示例。如果您正苦于以下问题:Java LongConstant类的具体用法?Java LongConstant怎么用?Java LongConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LongConstant类属于soot.jimple包,在下文中一共展示了LongConstant类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: prepareAlarmManagerSet
import soot.jimple.LongConstant; //导入依赖的package包/类
private void prepareAlarmManagerSet(Body body, InvokeStmt setStmt, SootMethodRef reportRef) {
Value oldVal = setStmt.getInvokeExpr().getArg(1);
Local longLocal = UtilInstrumenter.generateFreshLocal(body, LongType.v());
SootMethod currentTimeMillis = Scene.v().getMethod("<java.lang.System: long currentTimeMillis()>");
StaticInvokeExpr timeInvoke = Jimple.v().newStaticInvokeExpr(currentTimeMillis.makeRef());
AssignStmt timeInitalize = Jimple.v().newAssignStmt(longLocal, timeInvoke);
AddExpr addTime = Jimple.v().newAddExpr(longLocal, LongConstant.v(2000L));
AssignStmt timeAssign = Jimple.v().newAssignStmt(longLocal, addTime);
body.getUnits().insertBefore(timeInitalize, setStmt);
body.getUnits().insertBefore(timeAssign, setStmt);
InvokeExpr expr = setStmt.getInvokeExpr();
expr.setArg(0, IntConstant.v(0));
expr.setArg(1, longLocal);
// Report the change
InvokeStmt reportStmt = Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr(
reportRef, oldVal, longLocal));
reportStmt.addTag(new InstrumentedCodeTag());
body.getUnits().insertAfter(reportStmt, setStmt);
}
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:26,代码来源:TimingBombTransformer.java
示例2: getSimpleDefaultValue
import soot.jimple.LongConstant; //导入依赖的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
示例3: getPushInitializer
import soot.jimple.LongConstant; //导入依赖的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
示例4: outAIntegerConstant
import soot.jimple.LongConstant; //导入依赖的package包/类
public void outAIntegerConstant(AIntegerConstant node)
{
String s = (String) mProductions.removeLast();
StringBuffer buf = new StringBuffer();
if(node.getMinus() != null)
buf.append('-');
buf.append(s);
s = buf.toString();
if(s.endsWith("L")) {
mProductions.addLast(LongConstant.v(Long.parseLong(s.substring(0, s.length()-1))));
}
else if (s.equals("2147483648"))
mProductions.addLast(IntConstant.v(Integer.MIN_VALUE));
else
mProductions.addLast(IntConstant.v(Integer.parseInt(s)));
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:Walker.java
示例5: getNumCandidates
import soot.jimple.LongConstant; //导入依赖的package包/类
/**
* Collect all the locals which are assigned a IntConstant(0) or are used
* within a zero comparison.
*
* @param body
* the body to analyze
*/
private Set<Local> getNumCandidates(Body body) {
Set<Local> candidates = new HashSet<Local>();
for (Unit u : body.getUnits()) {
if (u instanceof AssignStmt) {
AssignStmt a = (AssignStmt) u;
if (!(a.getLeftOp() instanceof Local))
continue;
Local l = (Local) a.getLeftOp();
Value r = a.getRightOp();
if ((r instanceof IntConstant || r instanceof LongConstant)) {
candidates.add(l);
Debug.printDbg("[add null candidate: ", u);
}
}
}
return candidates;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:26,代码来源:DexNumTransformer.java
示例6: internalTransform
import soot.jimple.LongConstant; //导入依赖的package包/类
@Override
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
LocalCreation lc = new LocalCreation(b.getLocals(), "ex");
for (Iterator<Unit> unitIt = b.getUnits().snapshotIterator(); unitIt.hasNext(); ) {
Unit u = unitIt.next();
// Check for a null exception
if (u instanceof ThrowStmt) {
ThrowStmt throwStmt = (ThrowStmt) u;
if (throwStmt.getOp() == NullConstant.v()
|| throwStmt.getOp().equals(IntConstant.v(0))
|| throwStmt.getOp().equals(LongConstant.v(0))) {
createThrowStmt(b, throwStmt, lc);
}
}
}
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:19,代码来源:DexNullThrowTransformer.java
示例7: isAConstantValue
import soot.jimple.LongConstant; //导入依赖的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
示例8: createConstant
import soot.jimple.LongConstant; //导入依赖的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
示例9: toSootValue
import soot.jimple.LongConstant; //导入依赖的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
示例10: caseBinopDivExpr
import soot.jimple.LongConstant; //导入依赖的package包/类
private void caseBinopDivExpr(BinopExpr expr) {
// Factors out code common to caseDivExpr and caseRemExpr.
// The checks against constant divisors would perhaps be
// better performed in a later pass, post-constant-propagation.
Value divisor = expr.getOp2();
Type divisorType = divisor.getType();
if (divisorType instanceof UnknownType) {
result = result.add(mgr.ARITHMETIC_EXCEPTION);
} else if ((divisorType instanceof IntegerType) &&
((! (divisor instanceof IntConstant)) ||
(((IntConstant) divisor).equals(INT_CONSTANT_ZERO)))) {
result = result.add(mgr.ARITHMETIC_EXCEPTION);
} else if ((divisorType == LongType.v()) &&
((! (divisor instanceof LongConstant)) ||
(((LongConstant) divisor).equals(LONG_CONSTANT_ZERO)))) {
result = result.add(mgr.ARITHMETIC_EXCEPTION);
}
caseBinopExpr(expr);
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:20,代码来源:UnitThrowAnalysis.java
示例11: prepareHandlerPostDelayed
import soot.jimple.LongConstant; //导入依赖的package包/类
private void prepareHandlerPostDelayed(Body body, Stmt invokeStmt, SootMethodRef reportRef) {
InvokeExpr expr = invokeStmt.getInvokeExpr();
Value oldValue = expr.getArg(1);
Value newValue = LongConstant.v(2000L);
expr.setArg(1, newValue);
// Report the change
InvokeStmt reportStmt = Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr(
reportRef, oldValue, newValue));
reportStmt.addTag(new InstrumentedCodeTag());
body.getUnits().insertAfter(reportStmt, invokeStmt);
}
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:15,代码来源:TimingBombTransformer.java
示例12: outAConstantCaseLabel
import soot.jimple.LongConstant; //导入依赖的package包/类
public void outAConstantCaseLabel(AConstantCaseLabel node)
{
String s = (String) mProductions.removeLast();
int sign = 1;
if(node.getMinus() != null)
sign = -1;
if(s.endsWith("L")) {
mProductions.addLast(LongConstant.v(sign * Long.parseLong(s.substring(0, s.length()-1))));
}
else if (s.equals("2147483648"))
mProductions.addLast(IntConstant.v(sign * Integer.MIN_VALUE));
else
mProductions.addLast(IntConstant.v(sign * Integer.parseInt(s)));
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:16,代码来源:Walker.java
示例13: isZeroComparison
import soot.jimple.LongConstant; //导入依赖的package包/类
/**
* Examine expr if it is a comparison with 0.
*
* @param expr
* the ConditionExpr to examine
*/
protected boolean isZeroComparison(ConditionExpr expr) {
if (expr instanceof EqExpr || expr instanceof NeExpr) {
if (expr.getOp2() instanceof IntConstant
&& ((IntConstant) expr.getOp2()).value == 0)
return true;
if (expr.getOp2() instanceof LongConstant
&& ((LongConstant) expr.getOp2()).value == 0)
return true;
}
return false;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:18,代码来源:AbstractNullTransformer.java
示例14: getNullCandidates
import soot.jimple.LongConstant; //导入依赖的package包/类
/**
* Collect all the locals which are assigned a IntConstant(0) or are used
* within a zero comparison.
*
* @param body
* the body to analyze
*/
private Set<Local> getNullCandidates(Body body) {
Set<Local> candidates = null;
for (Unit u : body.getUnits()) {
if (u instanceof AssignStmt) {
AssignStmt a = (AssignStmt) u;
if (!(a.getLeftOp() instanceof Local))
continue;
Local l = (Local) a.getLeftOp();
Value r = a.getRightOp();
if ((r instanceof IntConstant && ((IntConstant) r).value == 0)
|| (r instanceof LongConstant && ((LongConstant) r).value == 0)) {
if (candidates == null)
candidates = new HashSet<Local>();
candidates.add(l);
Debug.printDbg("[add null candidate: ", u);
}
} else if (u instanceof IfStmt) {
ConditionExpr expr = (ConditionExpr) ((IfStmt) u)
.getCondition();
if (isZeroComparison(expr) && expr.getOp1() instanceof Local) {
if (candidates == null)
candidates = new HashSet<Local>();
candidates.add((Local) expr.getOp1());
Debug.printDbg("[add null candidate if: ", u);
}
}
}
return candidates == null ? Collections.<Local>emptySet() : candidates;
}
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:38,代码来源:DexNullTransformer.java
示例15: convertConstInsn
import soot.jimple.LongConstant; //导入依赖的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
示例16: createConstantTagFromValue
import soot.jimple.LongConstant; //导入依赖的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
示例17: checkConstantValue
import soot.jimple.LongConstant; //导入依赖的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
示例18: testJBinOpExp
import soot.jimple.LongConstant; //导入依赖的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
示例19: caseLongConstant
import soot.jimple.LongConstant; //导入依赖的package包/类
@Override
public void caseLongConstant(LongConstant arg0) {
long value = arg0.value;
if (value >= Integer.MAX_VALUE || value <= Integer.MIN_VALUE) {
Log.debug("Used abstract value for long constant that didn't fit in int");
this.expressionStack.push(GlobalsCache.v().lookupInternLong(arg0));
} else {
expressionStack.push(this.pf.mkIntLiteral(String.valueOf(value)));
}
}
开发者ID:SRI-CSL,项目名称:bixie,代码行数:11,代码来源:SootValueSwitch.java
示例20: lookupInternLong
import soot.jimple.LongConstant; //导入依赖的package包/类
public IdentifierExpression lookupInternLong(LongConstant s) {
if (!longInternMap.containsKey(s.toString())) {
String name = "$LongConst" + longInternMap.size();
longInternMap.put(s.toString(),
this.pf.mkIdentifierExpression(this.getBoogieType(s.getType()), name, true, true, true));
}
return longInternMap.get(s.toString());
}
开发者ID:SRI-CSL,项目名称:bixie,代码行数:9,代码来源:GlobalsCache.java
注:本文中的soot.jimple.LongConstant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论