Skip to content

Commit

Permalink
Use CompilerPass.run to process nested scopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
subbuss committed Oct 10, 2014
1 parent 45024c7 commit d3aabe2
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 8 deletions.
Expand Up @@ -153,7 +153,7 @@ public Object execute(IRScope scope, Object... data) {

// FIXME: Useless for now
// Run on all nested closures.
for (IRClosure c: scope.getClosures()) execute(c);
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
Expand Down
Expand Up @@ -67,7 +67,7 @@ public Object execute(IRScope s, Object... data) {
// Run on all nested closures.
//
// In the current implementation, nested scopes are processed independently (unlike Live Variable Analysis)
for (IRClosure c: s.getClosures()) execute(c);
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
Expand Down
Expand Up @@ -24,7 +24,7 @@ public Object execute(IRScope scope, Object... data) {
((LiveVariablesProblem) data[0]).markDeadInstructions();

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

return true;
Expand Down
Expand Up @@ -53,7 +53,7 @@ private void processCFG(CFG cfg) {

// recurse
for (IRScope childScope : cfg.getScope().getClosures()) {
processCFG(childScope.cfg());
run(childScope, false, true);
}
}
}
@@ -1,7 +1,6 @@
package org.jruby.ir.passes;

import org.jruby.ir.IRClosure;
import org.jruby.ir.IREvalScript;
import org.jruby.ir.IRFlags;
import org.jruby.ir.IRScope;
import org.jruby.ir.instructions.ClosureAcceptingInstr;
Expand All @@ -15,7 +14,6 @@
import org.jruby.ir.dataflow.analyses.LiveVariablesProblem;

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.List;
Expand Down
Expand Up @@ -30,7 +30,7 @@ public List<Class<? extends CompilerPass>> getDependencies() {
public Object execute(IRScope s, Object... data) {
// This let us compute execute scope flags for a method based on what all nested closures do
for (IRClosure c: s.getClosures()) {
run(c, true);
run(c, false, true);
}

for (BasicBlock b: ((CFG) data[0]).getBasicBlocks()) {
Expand Down
Expand Up @@ -18,7 +18,7 @@ public String getLabel() {
@Override
public Object execute(IRScope s, Object... data) {
for (IRClosure c: s.getClosures()) {
run(c, true);
run(c, false, true);
}

optimizeTmpVars(s);
Expand Down

0 comments on commit d3aabe2

Please sign in to comment.