org.jruby.compiler.ir.dataflow.analyses
Class LiveVariablesProblem
java.lang.Object
org.jruby.compiler.ir.dataflow.DataFlowProblem
org.jruby.compiler.ir.dataflow.analyses.LiveVariablesProblem
public class LiveVariablesProblem
- extends DataFlowProblem
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
LiveVariablesProblem
public LiveVariablesProblem()
getName
public java.lang.String getName()
- Specified by:
getName
in class DataFlowProblem
getDFVar
public DataFlowVar getDFVar(Variable v)
getVariable
public Variable getVariable(int id)
buildFlowGraphNode
public FlowGraphNode buildFlowGraphNode(BasicBlock bb)
- Specified by:
buildFlowGraphNode
in class DataFlowProblem
addDFVar
public void addDFVar(Variable v)
initVarsLiveOnExit
public void initVarsLiveOnExit(java.util.Collection<Variable> vars)
- Initialize the exit cfg with variables that are live on exit
This is the case for closures where vars defined in the closure (or accessed from the surrounding scope)
can be used outside the closure.
sum = 0; a.each { |i| sum += i }; return sum
In the code snippet above, 'sum' is live on exit from the closure.
getVarsLiveOnEntry
public java.util.List<Variable> getVarsLiveOnEntry()
- Get variables that are live on entry to the cfg.
This is the case for closures which access variables from the parent scope.
sum = 0; a.each { |i| sum += i }; return sum
In the code snippet above, 'sum' is live on entry to the closure
setup
public void setup(CFG c)
- Overrides:
setup
in class DataFlowProblem
getDataFlowVarsForOutput
public java.lang.String getDataFlowVarsForOutput()
- Overrides:
getDataFlowVarsForOutput
in class DataFlowProblem
markDeadInstructions
public void markDeadInstructions()
getVarsLiveOnExit
public java.util.Collection<Variable> getVarsLiveOnExit()
isDefinedOrUsed
public boolean isDefinedOrUsed(Variable v)
allDefinedOrUsedVariables
public java.util.Set<Variable> allDefinedOrUsedVariables()
getAllVars
public java.util.Set<Variable> getAllVars()
Copyright © 2002-2009 JRuby Team. All Rights Reserved.