Skip to content

Commit df80df4

Browse files
committed
All passes now run on demand - no eager runs on nested closures.
* This should reduce memory usage + improve perf. marginally in some cases.
1 parent d8e4959 commit df80df4

8 files changed

+9
-29
lines changed

core/src/main/java/org/jruby/ir/passes/AddCallProtocolInstructions.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ public Object execute(IRScope scope, Object... data) {
110110
scope.setExplicitCallProtocolFlag();
111111
}
112112

113-
// FIXME: Useless for now
114-
// Run on all nested closures.
115-
for (IRClosure c: scope.getClosures()) run(c, false, true);
116-
117113
// LVA information is no longer valid after the pass
118114
// FIXME: Grrr ... this seems broken to have to create a new object to invalidate
119115
(new LiveVariableAnalysis()).invalidate(scope);

core/src/main/java/org/jruby/ir/passes/AddLocalVarLoadStoreInstructions.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ public Object execute(IRScope s, Object... data) {
5959
for (Instr i: b.getInstrs()) i.renameVars(varRenameMap);
6060
}
6161

62-
// Run on all nested closures.
63-
//
64-
// In the current implementation, nested scopes are processed independently (unlike Live Variable Analysis)
65-
for (IRClosure c: s.getClosures()) run(c, false, true);
66-
6762
// LVA information is no longer valid after this pass
6863
// FIXME: Grrr ... this seems broken to have to create a new object to invalidate
6964
(new LiveVariableAnalysis()).invalidate(s);

core/src/main/java/org/jruby/ir/passes/DeadCodeElimination.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ public List<Class<? extends CompilerPass>> getDependencies() {
2323
public Object execute(IRScope scope, Object... data) {
2424
((LiveVariablesProblem) data[0]).markDeadInstructions();
2525

26-
for (IRClosure cl: scope.getClosures()) {
27-
run(cl, false, true);
28-
}
29-
3026
return true;
3127
}
3228
}

core/src/main/java/org/jruby/ir/passes/EnsureTempsAssigned.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,5 @@ private void processCFG(CFG cfg) {
4848
bb.getInstrs().add(index++, new CopyInstr(name, first));
4949
}
5050
}
51-
52-
// recurse
53-
for (IRScope childScope : cfg.getScope().getClosures()) {
54-
run(childScope, false, true);
55-
}
5651
}
5752
}

core/src/main/java/org/jruby/ir/passes/LiveVariableAnalysis.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ private void collectNonLocalDirtyVars(IRClosure cl, Set<LocalVariable> vars, int
5959

6060
@Override
6161
public Object execute(IRScope scope, Object... data) {
62-
// Should never be invoked directly on IRClosures
63-
// if (scope instanceof IRClosure && !(scope instanceof IREvalScript)) {
64-
// System.out.println("Hmm .. should not run lvp directly on closure scope: " + scope);
65-
// }
66-
6762
// Make sure flags are computed
6863
scope.computeScopeFlags();
6964

core/src/main/java/org/jruby/ir/passes/LocalOptimizationPass.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ public String getLabel() {
1818

1919
@Override
2020
public Object execute(IRScope s, Object... data) {
21-
/* FIXME: Ultimately we want to just delete this snippet but is left here so we can debug lifecycle issues with compiler passes
22-
for (BasicBlock b: s.getCFG().getBasicBlocks()) {
23-
runLocalOptsOnInstrList(s, b.getInstrs().listIterator(), false);
24-
}
25-
*/
26-
2721
// SSS FIXME: What is this about?
2822
// Why 'Only after running local opts'? Figure out and document.
2923
//

core/src/main/java/org/jruby/ir/passes/OptimizeDelegationPass.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ public String getLabel() {
1818

1919
@Override
2020
public Object execute(IRScope s, Object... data) {
21+
/**
22+
* SSS FIXME: too late at night to think straight if this
23+
* is required to run on all nested scopes or not. Doesn't
24+
* look like it, but leaving behind in case it is.
25+
*
2126
for (IRClosure c: s.getClosures()) {
2227
run(c, false, true);
2328
}
29+
**/
2430

2531
if (s.getFlags().contains(IRFlags.BINDING_HAS_ESCAPED)) return null;
2632
if (!s.getFlags().contains(IRFlags.RECEIVES_CLOSURE_ARG)) return null;

core/src/main/java/org/jruby/ir/passes/OptimizeDynScopesPass.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public Object execute(IRScope scope, Object... data) {
126126
}
127127

128128
eliminateLocalVars(scope);
129+
130+
// SSS FIXME: Why null? Return a non-null value so that we don't
131+
// run this repeatedly on the same scope.
129132
return null;
130133
}
131134

0 commit comments

Comments
 (0)