Skip to content

Commit 974016f

Browse files
committed
Remove special fic check in getCFG. Partially brittle because I only guard in LOP pass for closures
1 parent 43f0463 commit 974016f

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

core/src/main/java/org/jruby/ir/IRScope.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -387,15 +387,7 @@ public boolean canReceiveNonlocalReturns() {
387387
return flags.contains(CAN_RECEIVE_NONLOCAL_RETURNS);
388388
}
389389

390-
// FIXME: Should always be built but if not it wil
391-
public CFG buildCFG() {
392-
return getCFG();
393-
}
394-
395390
public CFG getCFG() {
396-
// Closure/nested scopes may not have been built and some passes process all child scopes
397-
if (fullInterpreterContext == null) prepareFullBuild();
398-
399391
return fullInterpreterContext.getCFG();
400392
}
401393

@@ -459,7 +451,10 @@ private Instr[] cloneInstrs() {
459451
return newInstructions;
460452
}
461453

462-
protected void prepareFullBuildCommon() {
454+
public void prepareFullBuildCommon() {
455+
// We already made it.
456+
if (fullInterpreterContext != null) return;
457+
463458
// Clone instrs from startup interpreter so we do not swap out instrs out from under the
464459
// startup interpreter as we are building the full interpreter.
465460
Instr[] instrs = cloneInstrs();

core/src/main/java/org/jruby/ir/passes/LocalOptimizationPass.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public String getLabel() {
2323
public Object execute(IRScope s, Object... data) {
2424
// This let us compute execute scope flags for a method based on what all nested closures do
2525
for (IRClosure c: s.getClosures()) {
26+
if (c.getFullInterpreterContext() == null) c.prepareFullBuildCommon();
2627
run(c, false, true);
2728
}
2829

0 commit comments

Comments
 (0)