Skip to content

Commit

Permalink
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 0 additions & 4 deletions core/src/main/java/org/jruby/ir/IRScope.java
Original file line number Diff line number Diff line change
@@ -1153,10 +1153,6 @@ public void inlineMethod(IRScope method, RubyModule implClass, int classToken, B
}
}

public void resetCFG() {
cfg = null;
}

/* Record a begin block -- not all scope implementations can handle them */
public void recordBeginBlock(IRClosure beginBlockClosure) {
throw new RuntimeException("BEGIN blocks cannot be added to: " + this.getClass().getName());
11 changes: 10 additions & 1 deletion core/src/main/java/org/jruby/ir/passes/CFGBuilder.java
Original file line number Diff line number Diff line change
@@ -2,6 +2,15 @@

import org.jruby.ir.IRScope;

/**
* CFGBuilder is mainly a pass to be lazy. We do not want to build CFG for scopes which are never called.
*
* Once we have a CFG that is the base data structure where we interact with instructions. The original
* list of instructions from IRBuilder is no longer important. This is also why this pass is incapable
* of invalidating the CFG.
*/


public class CFGBuilder extends CompilerPass {
@Override
public String getLabel() {
@@ -20,6 +29,6 @@ public Object execute(IRScope scope, Object... data) {

@Override
public void invalidate(IRScope scope) {
scope.resetCFG();
// CFG is primal information to a scope and cannot be recreated once generated.
}
}

0 comments on commit 736881a

Please sign in to comment.