@Override public Object execute(IRScope scope, Object... data) { UnboxableOpsAnalysisProblem problem = new UnboxableOpsAnalysisProblem(); problem.setup(scope); problem.compute_MOP_Solution(); problem.unbox(); // LVA information is no longer valid after the pass // FIXME: Grrr ... this seems broken to have to create a new object to invalidate (new LiveVariableAnalysis()).invalidate(scope); return true; }
@Override public Object execute(IRScope scope, Object... data) { // Make sure flags are computed scope.computeScopeFlags(); LiveVariablesProblem lvp = new LiveVariablesProblem(scope); if (scope instanceof IRClosure) { // We have to conservatively assume that any dirtied variables // that belong to an outer scope are live on exit. Set<LocalVariable> nlVars = new HashSet<LocalVariable>(); EnumSet<IRFlags> flags = scope.getExecutionContext().getFlags(); collectNonLocalDirtyVars((IRClosure)scope, nlVars, flags.contains(IRFlags.DYNSCOPE_ELIMINATED) ? -1 : 0); // Init DF vars from this set for (Variable v: nlVars) { lvp.addDFVar(v); } lvp.setVarsLiveOnScopeExit(nlVars); } lvp.compute_MOP_Solution(); scope.putLiveVariablesProblem(lvp); return lvp; }
@Override public Object execute(IRScope scope, Object... data) { // Make sure flags are computed scope.computeScopeFlags(); LiveVariablesProblem lvp = new LiveVariablesProblem(scope); if (scope instanceof IRClosure) { // We have to conservatively assume that any dirtied variables // that belong to an outer scope are live on exit. Set<LocalVariable> nlVars = new HashSet<LocalVariable>(); EnumSet<IRFlags> flags = scope.getExecutionContext().getFlags(); collectNonLocalDirtyVars((IRClosure)scope, nlVars, flags.contains(IRFlags.DYNSCOPE_ELIMINATED) ? -1 : 0); // Init DF vars from this set for (Variable v: nlVars) { lvp.addDFVar(v); } lvp.setVarsLiveOnScopeExit(nlVars); } lvp.compute_MOP_Solution(); scope.putLiveVariablesProblem(lvp); return lvp; }
@Override public Object execute(IRScope scope, Object... data) { UnboxableOpsAnalysisProblem problem = new UnboxableOpsAnalysisProblem(); problem.setup(scope); problem.compute_MOP_Solution(); problem.unbox(); // LVA information is no longer valid after the pass // FIXME: Grrr ... this seems broken to have to create a new object to invalidate (new LiveVariableAnalysis()).invalidate(scope); return true; }
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); } } } } }
@Override public Object execute(IRScope s, Object... data) { for (BasicBlock b: s.getCFG().getBasicBlocks()) { runLocalOptsOnBasicBlock(s, b); } // SSS FIXME: What is this about? // Why 'Only after running local opts'? Figure out and document. // // Only after running local opts, compute various execution scope flags. s.computeScopeFlags(); // LVA information is no longer valid after this pass // Currently, we don't run this after LVA, but just in case ... // // FIXME: Grrr ... this seems broken to have to create a new object to invalidate (new LiveVariableAnalysis()).invalidate(s); return null; }
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); } } } } }
@Override public Object execute(IRScope s, Object... data) { for (BasicBlock b: s.getCFG().getBasicBlocks()) { runLocalOptsOnBasicBlock(s, b); } // SSS FIXME: What is this about? // Why 'Only after running local opts'? Figure out and document. // // Only after running local opts, compute various execution scope flags. s.computeScopeFlags(); // LVA information is no longer valid after this pass // Currently, we don't run this after LVA, but just in case ... // // FIXME: Grrr ... this seems broken to have to create a new object to invalidate (new LiveVariableAnalysis()).invalidate(s); return null; }
(new LiveVariableAnalysis()).invalidate(scope);
(new LiveVariableAnalysis()).invalidate(scope);