Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix meteor benchmark not running.
This was caused by closure clones not sharing the same rename tables as the base/children
scope.  The code in IRScope.cloneInstrs I think must still be wrong since I do not
think closure scopes should be cloned if the base scope is not clones (else in method).
I will follow up with some hopefully simplification here in a follow up commit.
  • Loading branch information
enebo committed Feb 19, 2015
1 parent c003d7c commit bfd49a8
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions core/src/main/java/org/jruby/ir/IRScope.java
Expand Up @@ -458,17 +458,17 @@ public CFG buildCFG() {
// If the scope has already been interpreted once,
// the scope can be on the call stack right now.
// So, clone instructions before building the CFG.
if (this.state == ScopeState.INTERPED) {
this.cloneInstrs();
if (state == ScopeState.INTERPED) {
cloneInstrs();
}

CFG newCFG = new CFG(this);
newCFG.build(getInstrs());
// Clear out instruction list after CFG has been built.
this.instrList = null;
instrList = null;

setCFG(newCFG);
this.state = ScopeState.CFG_BUILT;
state = ScopeState.CFG_BUILT;

return newCFG;
}
Expand Down Expand Up @@ -644,18 +644,24 @@ public InterpreterContext prepareForInterpretation() {
}

protected void cloneInstrs() {
cloneInstrs(new SimpleCloneInfo(this, false));
}

protected void cloneInstrs(SimpleCloneInfo cloneInfo) {
if (getCFG() == null) {
// Clone instrs before modifying them
SimpleCloneInfo cloneInfo = new SimpleCloneInfo(this, false);
List<Instr> newInstrList = new ArrayList<Instr>(this.instrList.size());
for (Instr instr: this.instrList) {
newInstrList.add(instr.clone(cloneInfo));
}
this.instrList = newInstrList;
this.state = ScopeState.INSTRS_CLONED;
}
for (IRClosure cl: getClosures()) {
cl.cloneInstrs();
for (IRClosure cl : getClosures()) {
cl.cloneInstrs(cloneInfo.cloneForCloningClosure(cl));
}
} else {
for (IRClosure cl : getClosures()) {
cl.cloneInstrs();
}
}
}

Expand Down

0 comments on commit bfd49a8

Please sign in to comment.