Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 41de7c65a62b
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4475d6049340
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Sep 18, 2014

  1. Copy the full SHA
    5ff9567 View commit details
  2. Copy the full SHA
    4475d60 View commit details
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ir/IRManager.java
Original file line number Diff line number Diff line change
@@ -18,8 +18,8 @@
*/
public class IRManager {
public static String SAFE_COMPILER_PASSES = "LinearizeCFG";
public static String DEFAULT_COMPILER_PASSES = "OptimizeTempVarsPass,LocalOptimizationPass,AddLocalVarLoadStoreInstructions,EnsureTempsAssigned,LinearizeCFG";
public static String DEFAULT_JIT_PASSES = "OptimizeTempVarsPass,LocalOptimizationPass,AddLocalVarLoadStoreInstructions,EnsureTempsAssigned,AddCallProtocolInstructions,LinearizeCFG";
public static String DEFAULT_COMPILER_PASSES = "OptimizeTempVarsPass,LocalOptimizationPass,LinearizeCFG";
public static String DEFAULT_JIT_PASSES = "AddLocalVarLoadStoreInstructions,AddCallProtocolInstructions,EnsureTempsAssigned,OptimizeTempVarsPass,LocalOptimizationPass,LinearizeCFG";
public static String DEFAULT_INLINING_COMPILER_PASSES = "LocalOptimizationPass";

private int dummyMetaClassCount = 0;
11 changes: 7 additions & 4 deletions core/src/main/java/org/jruby/ir/IRScope.java
Original file line number Diff line number Diff line change
@@ -617,11 +617,14 @@ public synchronized Instr[] prepareForInterpretation(boolean isLambda) {
/* SSS FIXME: Do we need to synchronize on this? Cache this info in a scope field? */
/** Run any necessary passes to get the IR ready for compilation */
public synchronized List<BasicBlock> prepareForCompilation() {
// Reset linearization, since we will add JIT-specific flow and instrs
resetLinearizationData();

// Build CFG and run compiler passes, if necessary
boolean runPasses = false;
// boolean runPasses = false;
if (getCFG() == null) {
buildCFG();
runPasses = true;
// runPasses = true;
}

// Add this always since we dont re-JIT a previously
@@ -635,7 +638,7 @@ public synchronized List<BasicBlock> prepareForCompilation() {
((IRClosure)this).addGEBForUncaughtBreaks();
}

if (runPasses) {
// if (runPasses) {
runCompilerPasses(getManager().getJITPasses(this));

if (RubyInstanceConfig.IR_COMPILER_PASSES == null) {
@@ -646,7 +649,7 @@ public synchronized List<BasicBlock> prepareForCompilation() {
// no DCE for now to stress-test JIT
//runDeadCodeAndVarLoadStorePasses();
}
}
// }

checkRelinearization();

7 changes: 5 additions & 2 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -367,8 +367,11 @@ public void AliasInstr(AliasInstr aliasInstr) {
m.loadContext();
m.loadSelf();
jvmLoadLocal(DYNAMIC_SCOPE);
m.adapter.ldc(((StringLiteral)aliasInstr.getNewName()).string);
m.adapter.ldc(((StringLiteral)aliasInstr.getOldName()).string);
// CON FIXME: Ideally this would not have to pass through RubyString and toString
visit(aliasInstr.getNewName());
jvmAdapter().invokevirtual(p(Object.class), "toString", sig(String.class));
visit(aliasInstr.getOldName());
jvmAdapter().invokevirtual(p(Object.class), "toString", sig(String.class));
m.invokeIRHelper("defineAlias", sig(void.class, ThreadContext.class, IRubyObject.class, DynamicScope.class, String.class, String.class));
}

6 changes: 1 addition & 5 deletions spec/compiler/general_spec.rb
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@ def compile_to_method(src, filename = nil)
node = JRuby.parse(src, filename || "testCompiler#{next_src_id}", false)
filename = node.position.file
oj = org.jruby
classname = oj.util.JavaNameMangler.mangleFilenameForClasspath(filename)

# This logic is a mix of logic from InterpretedIRMethod's JIT, o.j.Ruby's script compilation, and IRScriptBody's
# interpret. We need to figure out a cleaner path.
@@ -23,7 +22,7 @@ def compile_to_method(src, filename = nil)
scope.setModule(currModule)
end

compiled = oj.ir.targets.JVMVisitor.compile(method, oj.util.ClassCache::OneShotClassLoader.new(JRuby.runtime.getJRubyClassLoader()))
compiled = oj.ir.targets.JVMVisitor.compile(method, oj.util.OneShotClassLoader.new(JRuby.runtime.getJRubyClassLoader()))
scriptMethod = compiled.getMethod(
"__script__",
oj.runtime.ThreadContext.java_class,
@@ -75,9 +74,6 @@ def compile_and_run(src, filename = nil)
describe "JRuby's bytecode compiler" do
include CompilerTestUtils

StandardASMCompiler = org.jruby.compiler.impl.StandardASMCompiler
ASTCompiler = org.jruby.compiler.ASTCompiler
ASTInspector = org.jruby.compiler.ASTInspector
Block = org.jruby.runtime.Block
IRubyObject = org.jruby.runtime.builtin.IRubyObject