@Override
 public void visit(InvokeDynamicInstruction insn) {
   if (insn.getInstance() != null) {
     escaping[insn.getInstance().getIndex()] = true;
   }
   for (Variable arg : insn.getArguments()) {
     escaping[arg.getIndex()] = true;
   }
 }
示例#2
0
 private void renameVariables(final Program program, final int[] varMap) {
   InstructionVariableMapper mapper =
       new InstructionVariableMapper(var -> program.variableAt(varMap[var.getIndex()]));
   for (int i = 0; i < program.basicBlockCount(); ++i) {
     BasicBlock block = program.basicBlockAt(i);
     mapper.apply(block);
   }
   String[][] originalNames = new String[program.variableCount()][];
   for (int i = 0; i < program.variableCount(); ++i) {
     Variable var = program.variableAt(i);
     originalNames[i] = var.getDebugNames().toArray(new String[0]);
     var.getDebugNames().clear();
   }
   for (int i = 0; i < program.variableCount(); ++i) {
     program.variableAt(varMap[i]).getDebugNames().addAll(Arrays.asList(originalNames[i]));
   }
 }
示例#3
0
 private DisjointSet buildPhiCongruenceClasses(Program program) {
   DisjointSet classes = new DisjointSet();
   for (int i = 0; i < program.variableCount(); ++i) {
     classes.create();
   }
   for (int i = 0; i < program.basicBlockCount(); ++i) {
     BasicBlock block = program.basicBlockAt(i);
     for (Phi phi : block.getPhis()) {
       for (Incoming incoming : phi.getIncomings()) {
         classes.union(phi.getReceiver().getIndex(), incoming.getValue().getIndex());
       }
     }
     for (TryCatchJoint joint : block.getTryCatchJoints()) {
       for (Variable sourceVar : joint.getSourceVariables()) {
         classes.union(sourceVar.getIndex(), joint.getReceiver().getIndex());
       }
     }
   }
   return classes;
 }
示例#4
0
 private Expr compare(BinaryOperation op, Variable value) {
   Expr expr = Expr.binary(op, Expr.var(value.getIndex()), Expr.constant(0));
   expr.setLocation(currentLocation);
   return expr;
 }
示例#5
0
 private void assign(Expr source, Variable target) {
   AssignmentStatement stmt = Statement.assign(Expr.var(target.getIndex()), source);
   stmt.setLocation(currentLocation);
   stmt.getDebugNames().addAll(target.getDebugNames());
   statements.add(stmt);
 }