本文整理汇总了Java中soot.jimple.LookupSwitchStmt.getDefaultTarget方法的典型用法代码示例。如果您正苦于以下问题:Java LookupSwitchStmt.getDefaultTarget方法的具体用法?Java LookupSwitchStmt.getDefaultTarget怎么用?Java LookupSwitchStmt.getDefaultTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类soot.jimple.LookupSwitchStmt
的用法示例。
在下文中一共展示了LookupSwitchStmt.getDefaultTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: caseLookupSwitchStmt
import soot.jimple.LookupSwitchStmt; //导入方法依赖的package包/类
@Override
public void caseLookupSwitchStmt(LookupSwitchStmt stmt) {
exprV.setOrigStmt(stmt);
constantV.setOrigStmt(stmt);
// create payload that references the switch's targets
List<IntConstant> keyValues = stmt.getLookupValues();
int[] keys = new int[keyValues.size()];
for (int i = 0; i < keys.length; i++) {
keys[i] = keyValues.get(i).value;
}
List<Unit> targets = stmt.getTargets();
SparseSwitchPayload payload = new SparseSwitchPayload(keys, targets);
switchPayloads.add(payload);
// create sparse-switch instruction that references the payload
Value key = stmt.getKey();
Stmt defaultTarget = (Stmt) stmt.getDefaultTarget();
if (defaultTarget == stmt)
throw new RuntimeException("Looping switch block detected");
addInsn(buildSwitchInsn(Opcode.SPARSE_SWITCH, key, defaultTarget,
payload, stmt), stmt);
}
示例2: caseLookupSwitchStmt
import soot.jimple.LookupSwitchStmt; //导入方法依赖的package包/类
public void caseLookupSwitchStmt(LookupSwitchStmt stmt) {
p.openBlock();
String keyVarName = printValueAssignment(stmt.getKey(), "key");
p.println("List<IntConstant> lookupValues = new LinkedList<IntConstant>();");
int i=0;
for(IntConstant c: (List<IntConstant>)stmt.getLookupValues()) {
vtp.suggestVariableName("lookupValue"+i);
c.apply(vtp);
i++;
p.println("lookupValues.add(lookupValue"+i+");");
}
p.println("List<Unit> targets = new LinkedList<Unit>();");
for(Unit u : stmt.getTargets()) {
String nameOfJumpTarget = nameOfJumpTarget(u);
p.println("targets.add("+nameOfJumpTarget+")");
}
Unit defaultTarget = stmt.getDefaultTarget();
p.println("Unit defaultTarget=" + defaultTarget.toString() + ";");
printStmt(stmt, keyVarName, "lookupValues", "targets", "defaultTarget");
p.closeBlock();
}
示例3: internalTransform
import soot.jimple.LookupSwitchStmt; //导入方法依赖的package包/类
protected void internalTransform(Body b, String phaseName, Map<String,String> options)
{
Iterator<Unit> it = b.getUnits().snapshotIterator();
while (it.hasNext()) {
Unit u = it.next();
if (u instanceof LookupSwitchStmt) {
LookupSwitchStmt sw = (LookupSwitchStmt) u;
if (sw.getTargetCount() == 0 && sw.getDefaultTarget() != null)
b.getUnits().swapWith(sw, Jimple.v().newGotoStmt(sw.getDefaultTarget()));
}
}
}