Skip to content

Commit

Permalink
All passes now run on demand - no eager runs on nested closures.
Browse files Browse the repository at this point in the history
* This should reduce memory usage + improve perf. marginally
  in some cases.
  • Loading branch information
subbuss committed Mar 6, 2015
1 parent d8e4959 commit df80df4
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 29 deletions.
Expand Up @@ -110,10 +110,6 @@ public Object execute(IRScope scope, Object... data) {
scope.setExplicitCallProtocolFlag();
}

// FIXME: Useless for now
// Run on all nested closures.
for (IRClosure c: scope.getClosures()) run(c, false, true);

// 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);
Expand Down
Expand Up @@ -59,11 +59,6 @@ public Object execute(IRScope s, Object... data) {
for (Instr i: b.getInstrs()) i.renameVars(varRenameMap);
}

// Run on all nested closures.
//
// In the current implementation, nested scopes are processed independently (unlike Live Variable Analysis)
for (IRClosure c: s.getClosures()) run(c, false, true);

// LVA information is no longer valid after this pass
// FIXME: Grrr ... this seems broken to have to create a new object to invalidate
(new LiveVariableAnalysis()).invalidate(s);
Expand Down
Expand Up @@ -23,10 +23,6 @@ public List<Class<? extends CompilerPass>> getDependencies() {
public Object execute(IRScope scope, Object... data) {
((LiveVariablesProblem) data[0]).markDeadInstructions();

for (IRClosure cl: scope.getClosures()) {
run(cl, false, true);
}

return true;
}
}
Expand Up @@ -48,10 +48,5 @@ private void processCFG(CFG cfg) {
bb.getInstrs().add(index++, new CopyInstr(name, first));
}
}

// recurse
for (IRScope childScope : cfg.getScope().getClosures()) {
run(childScope, false, true);
}
}
}
Expand Up @@ -59,11 +59,6 @@ private void collectNonLocalDirtyVars(IRClosure cl, Set<LocalVariable> vars, int

@Override
public Object execute(IRScope scope, Object... data) {
// Should never be invoked directly on IRClosures
// if (scope instanceof IRClosure && !(scope instanceof IREvalScript)) {
// System.out.println("Hmm .. should not run lvp directly on closure scope: " + scope);
// }

// Make sure flags are computed
scope.computeScopeFlags();

Expand Down
Expand Up @@ -18,12 +18,6 @@ public String getLabel() {

@Override
public Object execute(IRScope s, Object... data) {
/* FIXME: Ultimately we want to just delete this snippet but is left here so we can debug lifecycle issues with compiler passes
for (BasicBlock b: s.getCFG().getBasicBlocks()) {
runLocalOptsOnInstrList(s, b.getInstrs().listIterator(), false);
}
*/

// SSS FIXME: What is this about?
// Why 'Only after running local opts'? Figure out and document.
//
Expand Down
Expand Up @@ -18,9 +18,15 @@ public String getLabel() {

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

if (s.getFlags().contains(IRFlags.BINDING_HAS_ESCAPED)) return null;
if (!s.getFlags().contains(IRFlags.RECEIVES_CLOSURE_ARG)) return null;
Expand Down
Expand Up @@ -126,6 +126,9 @@ public Object execute(IRScope scope, Object... data) {
}

eliminateLocalVars(scope);

// SSS FIXME: Why null? Return a non-null value so that we don't
// run this repeatedly on the same scope.
return null;
}

Expand Down

0 comments on commit df80df4

Please sign in to comment.