public String toStringBody() { StringBuilder buf = new StringBuilder(); buf.append(getName()).append(" = { \n"); CFG c = getCFG(); if (c != null) { buf.append("\nCFG:\n").append(c.toStringGraph()).append("\nInstructions:\n").append(c.toStringInstrs()); } else { buf.append(toStringInstrs()); } buf.append("\n}\n\n"); return buf.toString(); }
public String toStringBody() { StringBuilder buf = new StringBuilder(); buf.append(getName()).append(" = { \n"); CFG c = getCFG(); if (c != null) { buf.append("\nCFG:\n").append(c.toStringGraph()).append("\nInstructions:\n").append(c.toStringInstrs()); } else { buf.append(toStringInstrs()); } buf.append("\n}\n\n"); return buf.toString(); }
public IRClosure cloneForClonedInstr(InlinerInfo ii) { IRClosure clonedClosure = new IRClosure(this, ii.getNewLexicalParentForClosure()); clonedClosure.isForLoopBody = this.isForLoopBody; clonedClosure.nestingDepth = this.nestingDepth; clonedClosure.parameterList = this.parameterList; // Create a new inliner info object ii = ii.cloneForCloningClosure(clonedClosure); // clone the cfg, and all instructions clonedClosure.setCFG(getCFG().cloneForCloningClosure(clonedClosure, ii)); return clonedClosure; }
public IRClosure cloneForClonedInstr(InlinerInfo ii) { IRClosure clonedClosure = new IRClosure(this, ii.getNewLexicalParentForClosure()); clonedClosure.isForLoopBody = this.isForLoopBody; clonedClosure.nestingDepth = this.nestingDepth; clonedClosure.parameterList = this.parameterList; // Create a new inliner info object ii = ii.cloneForCloningClosure(clonedClosure); // clone the cfg, and all instructions clonedClosure.setCFG(getCFG().cloneForCloningClosure(clonedClosure, ii)); return clonedClosure; }
private void collectNonLocalDirtyVars(IRClosure cl, Set<LocalVariable> vars, int minDepth) { for (BasicBlock bb: cl.getCFG().getBasicBlocks()) { for (Instr i: bb.getInstrs()) { // Collect local vars belonging to an outer scope dirtied here if (i instanceof ResultInstr) { Variable res = ((ResultInstr)i).getResult(); if (res instanceof LocalVariable && ((LocalVariable)res).getScopeDepth() > minDepth) { vars.add((LocalVariable)res); } } // When encountering nested closures, increase minDepth by 1 // so that we continue to collect vars belong to outer scopes. if (i instanceof ClosureAcceptingInstr) { Operand clArg = ((ClosureAcceptingInstr)i).getClosureArg(); if (clArg instanceof WrappedIRClosure) { collectNonLocalDirtyVars(((WrappedIRClosure)clArg).getClosure(), vars, minDepth+1); } } } } }
private void collectNonLocalDirtyVars(IRClosure cl, Set<LocalVariable> vars, int minDepth) { for (BasicBlock bb: cl.getCFG().getBasicBlocks()) { for (Instr i: bb.getInstrs()) { // Collect local vars belonging to an outer scope dirtied here if (i instanceof ResultInstr) { Variable res = ((ResultInstr)i).getResult(); if (res instanceof LocalVariable && ((LocalVariable)res).getScopeDepth() > minDepth) { vars.add((LocalVariable)res); } } // When encountering nested closures, increase minDepth by 1 // so that we continue to collect vars belong to outer scopes. if (i instanceof ClosureAcceptingInstr) { Operand clArg = ((ClosureAcceptingInstr)i).getClosureArg(); if (clArg instanceof WrappedIRClosure) { collectNonLocalDirtyVars(((WrappedIRClosure)clArg).getClosure(), vars, minDepth+1); } } } } }
CFG closureCFG = cl.getCFG(); BasicBlock cEntry = closureCFG.getEntryBB(); BasicBlock cExit = closureCFG.getExitBB();
CFG closureCFG = cl.getCFG(); BasicBlock cEntry = closureCFG.getEntryBB(); BasicBlock cExit = closureCFG.getExitBB();
CFG closureCFG = cl.getCFG();
CFG closureCFG = cl.getCFG();