soot.Body.getThisLocal()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中soot.Body.getThisLocal()方法的一些代码示例,展示了Body.getThisLocal()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Body.getThisLocal()方法的具体详情如下:
包路径:soot.Body
类名称:Body
方法名:getThisLocal

Body.getThisLocal介绍

[英]Return LHS of the first identity stmt assigning from @this.
[中]返回从@this分配的第一个标识stmt的LHS。

代码示例

代码示例来源:origin: Sable/soot

/**
 * Checks whether the given method can be made static, i.e., does not reference the "this" object
 *
 * @param target
 *          The method to check
 * @return True if the given method can be made static, otherwise false
 */
private boolean canBeMadeStatic(SootMethod target) {
 if (target.hasActiveBody()) {
  Body body = target.getActiveBody();
  Value thisLocal = body.getThisLocal();
  for (Unit u : body.getUnits()) {
   for (ValueBox vb : u.getUseBoxes()) {
    if (vb.getValue() == thisLocal) {
     return false;
    }
   }
  }
  return true;
 }
 return false;
}

代码示例来源:origin: Sable/soot

} else if (fr instanceof InstanceFieldRef) {
 InstanceFieldRef ifr = (InstanceFieldRef) fr;
 if (!method.isStatic() && ifr.getBase().equivTo(b.getThisLocal())) {
} else if (ie instanceof InstanceInvokeExpr) {
 InstanceInvokeExpr iie = (InstanceInvokeExpr) ie;
 if (!method.isStatic() && iie.getBase().equivTo(b.getThisLocal())) {

代码示例来源:origin: Sable/soot

if (sm.getActiveBody().getThisLocal() == l) {
 paramRegNum = 0;
 found = true;

代码示例来源:origin: Sable/soot

protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
  if (!b.getMethod().isSynchronized() || b.getMethod().isStatic()) {
   return;
  }

  Iterator<Unit> it = b.getUnits().snapshotIterator();
  while (it.hasNext()) {
   Unit u = it.next();
   if (u instanceof IdentityStmt) {
    continue;
   }

   // This the first real statement. If it is not a MonitorEnter
   // instruction, we generate one
   if (!(u instanceof EnterMonitorStmt)) {
    b.getUnits().insertBeforeNoRedirect(Jimple.v().newEnterMonitorStmt(b.getThisLocal()), u);

    // We also need to leave the monitor when the method terminates
    UnitGraph graph = new ExceptionalUnitGraph(b);
    for (Unit tail : graph.getTails()) {
     b.getUnits().insertBefore(Jimple.v().newExitMonitorStmt(b.getThisLocal()), tail);
    }
   }
   break;
  }
 }
}

代码示例来源:origin: Sable/soot

/** A constructor that doesn't run the analysis */
protected SimpleMethodInfoFlowAnalysis(UnitGraph g, InfoFlowAnalysis dfa, boolean ignoreNonRefTypeFlow,
  boolean dummyDontRunAnalysisYet) {
 super(g);
 this.sm = g.getBody().getMethod();
 if (sm.isStatic()) {
  this.thisLocal = null;
 } else {
  this.thisLocal = g.getBody().getThisLocal();
 }
 this.dfa = dfa;
 this.refOnly = ignoreNonRefTypeFlow;
 this.infoFlowGraph = new MemoryEfficientGraph<EquivalentValue>();
 this.returnRef = new ParameterRef(g.getBody().getMethod().getReturnType(), -1); // it's a dummy parameter ref
 this.entrySet = new ArraySparseSet<Pair<EquivalentValue, EquivalentValue>>();
 this.emptySet = new ArraySparseSet<Pair<EquivalentValue, EquivalentValue>>();
 printMessages = false;
}

代码示例来源:origin: Sable/soot

soot.Local specialThisLocal = body.getThisLocal();

代码示例来源:origin: Sable/soot

thisLocal = b.getThisLocal();

代码示例来源:origin: Sable/soot

this.thisLocal = null;
} else {
 this.thisLocal = g.getBody().getThisLocal();
  EquivalentValue fieldRefEqVal;
  if (!sm.isStatic()) {
   fieldRefEqVal = InfoFlowAnalysis.getNodeForFieldRef(sm, sf, sm.retrieveActiveBody().getThisLocal());
  } else {
   fieldRefEqVal = InfoFlowAnalysis.getNodeForFieldRef(sm, sf);
   EquivalentValue fieldRefEqVal;
   if (!sm.isStatic()) {
    fieldRefEqVal = InfoFlowAnalysis.getNodeForFieldRef(sm, scField, sm.retrieveActiveBody().getThisLocal());
   } else {
    fieldRefEqVal = InfoFlowAnalysis.getNodeForFieldRef(sm, scField);

代码示例来源:origin: Sable/soot

Value base = ifr.getBase();
if (base instanceof Local) {
 if (dfa.includesInnerFields() || ((!sm.isStatic()) && base.equivTo(b.getThisLocal()))) {
  fieldsStaticsParamsAccessed.add(InfoFlowAnalysis.getNodeForFieldRef(sm, ifr.getField()));

代码示例来源:origin: Sable/soot

if (m.isConcrete() && !m.isStatic() && m.retrieveActiveBody().getThisLocal().equivTo(ifr.getBase())
  && tlo.isObjectThreadLocal(ifr, m)) {
 return null;

代码示例来源:origin: Sable/soot

thisLocal = b.getThisLocal();
} catch (RuntimeException re) {

代码示例来源:origin: Sable/soot

SootMethod im = initMethodsToRewrite.remove(i);
Body b = im.getActiveBody();
Local thisLocal = b.getThisLocal();
Iterator<Unit> uIt = b.getUnits().snapshotIterator();
while (uIt.hasNext()) {

代码示例来源:origin: Sable/soot

public static EquivalentValue getNodeForFieldRef(SootMethod sm, SootField sf, Local realLocal) {
 if (sf.isStatic()) {
  return new CachedEquivalentValue(Jimple.v().newStaticFieldRef(sf.makeRef()));
 } else {
  // Jimple.v().newThisRef(sf.getDeclaringClass().getType())
  if (sm.isConcrete() && !sm.isStatic() && sm.getDeclaringClass() == sf.getDeclaringClass() && realLocal == null) {
   JimpleLocal fakethis
     = new FakeJimpleLocal("fakethis", sf.getDeclaringClass().getType(), sm.retrieveActiveBody().getThisLocal());
   return new CachedEquivalentValue(Jimple.v().newInstanceFieldRef(fakethis, sf.makeRef())); // fake thisLocal
  } else {
   // Pretends to be a this.<somefield> ref for a method without a body,
   // for a static method, or for an inner field
   JimpleLocal fakethis = new FakeJimpleLocal("fakethis", sf.getDeclaringClass().getType(), realLocal);
   return new CachedEquivalentValue(Jimple.v().newInstanceFieldRef(fakethis, sf.makeRef())); // fake thisLocal
  }
 }
}

代码示例来源:origin: Sable/soot

if (!containingMethod.isStatic() && iie.getBase().equivTo(b.getThisLocal())) {

代码示例来源:origin: Sable/soot

.newAssignStmt(Jimple.v().newInstanceFieldRef(body.getThisLocal(), sf.makeRef()), constant);

代码示例来源:origin: Sable/soot

if (m.isConcrete() && !m.isStatic() && m.retrieveActiveBody().getThisLocal().equivTo(ifr.getBase())
  && tlo.isObjectThreadLocal(ifr, m)) {
 return null;

代码示例来源:origin: secure-software-engineering/FlowDroid

@Override
  public Local[] load(SootMethod method) throws Exception {
    if (!method.isConcrete() || !method.hasActiveBody())
      return new Local[0];
    List<Local> lcs = new ArrayList<Local>(method.getParameterCount() + (method.isStatic() ? 0 : 1));
    for (Unit u : method.getActiveBody().getUnits())
      useBox: for (ValueBox vb : u.getUseBoxes()) {
        // Check for parameters
        for (int i = 0; i < method.getParameterCount(); i++) {
          if (method.getActiveBody().getParameterLocal(i) == vb.getValue()) {
            lcs.add((Local) vb.getValue());
            continue useBox;
          }
        }
      }
    // Add the "this" local
    if (!method.isStatic())
      lcs.add(method.getActiveBody().getThisLocal());
    return lcs.toArray(new Local[lcs.size()]);
  }
});

代码示例来源:origin: ibinti/bugvm

/** A constructor that doesn't run the analysis */
protected SimpleMethodInfoFlowAnalysis(UnitGraph g, InfoFlowAnalysis dfa, boolean ignoreNonRefTypeFlow, boolean dummyDontRunAnalysisYet)
{
  super(g);
  this.sm = g.getBody().getMethod();
  if(sm.isStatic())
    this.thisLocal = null;
  else
    this.thisLocal = g.getBody().getThisLocal();
  this.dfa = dfa;
  this.refOnly = ignoreNonRefTypeFlow;
  
  this.infoFlowGraph = new MemoryEfficientGraph();
  this.returnRef = new ParameterRef(g.getBody().getMethod().getReturnType(), -1); // it's a dummy parameter ref
  
  this.entrySet = new ArraySparseSet();
  this.emptySet = new ArraySparseSet();
  
  printMessages = false;
}

代码示例来源:origin: com.bugvm/bugvm-soot

/** A constructor that doesn't run the analysis */
protected SimpleMethodInfoFlowAnalysis(UnitGraph g, InfoFlowAnalysis dfa, boolean ignoreNonRefTypeFlow, boolean dummyDontRunAnalysisYet)
{
  super(g);
  this.sm = g.getBody().getMethod();
  if(sm.isStatic())
    this.thisLocal = null;
  else
    this.thisLocal = g.getBody().getThisLocal();
  this.dfa = dfa;
  this.refOnly = ignoreNonRefTypeFlow;
  
  this.infoFlowGraph = new MemoryEfficientGraph();
  this.returnRef = new ParameterRef(g.getBody().getMethod().getReturnType(), -1); // it's a dummy parameter ref
  
  this.entrySet = new ArraySparseSet();
  this.emptySet = new ArraySparseSet();
  
  printMessages = false;
}

代码示例来源:origin: ibinti/bugvm

public static EquivalentValue getNodeForFieldRef(SootMethod sm, SootField sf, Local realLocal)
{
  if(sf.isStatic())
  {
    return new CachedEquivalentValue( Jimple.v().newStaticFieldRef(sf.makeRef()) );
  }
  else
  {
    // Jimple.v().newThisRef(sf.getDeclaringClass().getType())
    if(sm.isConcrete() && !sm.isStatic() && sm.getDeclaringClass() == sf.getDeclaringClass() && realLocal == null)
    {
      JimpleLocal fakethis = new FakeJimpleLocal("fakethis", sf.getDeclaringClass().getType(), sm.retrieveActiveBody().getThisLocal());
      
      return new CachedEquivalentValue( Jimple.v().newInstanceFieldRef(fakethis, sf.makeRef()) ); // fake thisLocal
    }
    else
    {
      // Pretends to be a this.<somefield> ref for a method without a body,
      // for a static method, or for an inner field
      JimpleLocal fakethis = new FakeJimpleLocal("fakethis", sf.getDeclaringClass().getType(), realLocal);
      
      return new CachedEquivalentValue( Jimple.v().newInstanceFieldRef(fakethis, sf.makeRef()) ); // fake thisLocal
    }
  }
}

相关文章