Skip to content

Commit

Permalink
Merge pull request #4392 from jruby/compile_more
Browse files Browse the repository at this point in the history
compile back to hard scope when closure compile/build requested
  • Loading branch information
enebo committed Jan 11, 2017
2 parents bbd0440 + 31f0082 commit bcd2bab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/compiler/FullBuildTask.java
Expand Up @@ -16,6 +16,8 @@ class FullBuildTask implements Runnable {

public void run() {
try {
method.getIRScope().getTopLevelScope().prepareFullBuild();

method.completeBuild(method.getIRScope().prepareFullBuild());

if (jitCompiler.config.isJitLogging()) {
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/org/jruby/ir/IRScope.java
Expand Up @@ -562,6 +562,10 @@ public synchronized FullInterpreterContext prepareFullBuild() {
// or generated instructions.
if (fullInterpreterContext != null && fullInterpreterContext.buildComplete()) return fullInterpreterContext;

for (IRScope scope: getClosures()) {
scope.prepareFullBuild();
}

prepareFullBuildCommon();
runCompilerPasses(getManager().getCompilerPasses(this));
getManager().optimizeIfSimpleScope(this);
Expand All @@ -581,6 +585,10 @@ public synchronized BasicBlock[] prepareForCompilation() {
// or generated instructions.
if (fullInterpreterContext != null && fullInterpreterContext.buildComplete()) return fullInterpreterContext.getLinearizedBBList();

for (IRScope scope: getClosures()) {
scope.prepareForCompilation();
}

prepareFullBuildCommon();

runCompilerPasses(getManager().getJITPasses(this));
Expand Down
Expand Up @@ -166,7 +166,7 @@ protected void promoteToFullBuild(ThreadContext context) {
if (callCount >= 0) {
// ensure we've got code ready for JIT
ensureInstrsReady();
closure.prepareForCompilation();
closure.getNearestTopLocalVariableScope().prepareForCompilation();

// if we don't have an explicit protocol, disable JIT
if (!closure.hasExplicitCallProtocol()) {
Expand Down

0 comments on commit bcd2bab

Please sign in to comment.