Skip to content

Commit

Permalink
Remove invalidate from CFGBuilder and resetCFG from IRScope since the…
Browse files Browse the repository at this point in the history
…se actions are not possible
  • Loading branch information
enebo committed Oct 7, 2014
1 parent c47d195 commit 736881a
Show file tree
Hide file tree
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
Expand Up @@ -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());
Expand Down
11 changes: 10 additions & 1 deletion core/src/main/java/org/jruby/ir/passes/CFGBuilder.java
Expand Up @@ -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() {
Expand All @@ -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.