Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #917 from komax/komax_ir_pass_scheduling

Scheduler for controlling the Execution of IR Passes
  • Loading branch information...
commit e1359705dc62647d2d846a52fd2938a1a4bd3968 2 parents cc7423a + d861106
@enebo enebo authored
View
18 core/src/main/java/org/jruby/ir/IRManager.java
@@ -2,6 +2,7 @@
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.jruby.RubyInstanceConfig;
@@ -10,6 +11,7 @@
import org.jruby.ir.passes.BasicCompilerPassListener;
import org.jruby.ir.passes.CompilerPass;
import org.jruby.ir.passes.CompilerPassListener;
+import org.jruby.ir.passes.CompilerPassScheduler;
/**
*/
@@ -62,6 +64,22 @@ public IRModuleBody getObject() {
return object;
}
+ public CompilerPassScheduler schedulePasses() {
+ CompilerPassScheduler scheduler = new CompilerPassScheduler() {
+ private Iterator<CompilerPass> iterator;
+ {
+ this.iterator = compilerPasses.iterator();
+ }
+
+ @Override
+ public Iterator<CompilerPass> iterator() {
+ return this.iterator;
+ }
+
+ };
+ return scheduler;
+ }
+
public List<CompilerPass> getCompilerPasses(IRScope scope) {
return compilerPasses;
}
View
5 core/src/main/java/org/jruby/ir/IRScope.java
@@ -36,6 +36,7 @@
import org.jruby.ir.operands.Variable;
import org.jruby.ir.operands.WrappedIRClosure;
import org.jruby.ir.passes.CompilerPass;
+import org.jruby.ir.passes.CompilerPassScheduler;
import org.jruby.ir.representations.BasicBlock;
import org.jruby.ir.representations.CFG;
import org.jruby.ir.representations.CFGLinearizer;
@@ -653,7 +654,6 @@ private void runCompilerPasses() {
// SSS FIXME: Why is this again? Document this weirdness!
// Forcibly clear out the shared eval-scope variable allocator each time this method executes
initEvalScopeVariableAllocator(true);
-
// SSS FIXME: We should configure different optimization levels
// and run different kinds of analysis depending on time budget. Accordingly, we need to set
// IR levels/states (basic, optimized, etc.) and the
@@ -661,7 +661,8 @@ private void runCompilerPasses() {
// while another thread is using it. This may need to happen on a clone()
// and we may need to update the method to return the new method. Also,
// if this scope is held in multiple locations how do we update all references?
- for (CompilerPass pass: getManager().getCompilerPasses(this)) {
+ CompilerPassScheduler scheduler = getManager().schedulePasses();
+ for (CompilerPass pass: scheduler) {
pass.run(this);
}
}
View
4 core/src/main/java/org/jruby/ir/passes/CompilerPassScheduler.java
@@ -0,0 +1,4 @@
+package org.jruby.ir.passes;
+
+public interface CompilerPassScheduler extends Iterable<CompilerPass> {
+}
Please sign in to comment.
Something went wrong with that request. Please try again.