org.jruby.compiler.ir.dataflow.analyses
Class LiveVariablesProblem

java.lang.Object
  extended by org.jruby.compiler.ir.dataflow.DataFlowProblem
      extended by org.jruby.compiler.ir.dataflow.analyses.LiveVariablesProblem

public class LiveVariablesProblem
extends DataFlowProblem


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jruby.compiler.ir.dataflow.DataFlowProblem
DataFlowProblem.DF_Direction
 
Field Summary
 
Fields inherited from class org.jruby.compiler.ir.dataflow.DataFlowProblem
_cfg, _direction, _fgNodes
 
Constructor Summary
LiveVariablesProblem()
           
 
Method Summary
 void addDFVar(Variable v)
           
 java.util.Set<Variable> allDefinedOrUsedVariables()
           
 FlowGraphNode buildFlowGraphNode(BasicBlock bb)
           
 java.util.Set<Variable> getAllVars()
           
 java.lang.String getDataFlowVarsForOutput()
           
 DataFlowVar getDFVar(Variable v)
           
 java.lang.String getName()
           
 Variable getVariable(int id)
           
 java.util.List<Variable> getVarsLiveOnEntry()
          Get variables that are live on entry to the cfg.
 java.util.Collection<Variable> getVarsLiveOnExit()
           
 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.
 boolean isDefinedOrUsed(Variable v)
           
 void markDeadInstructions()
           
 void setup(CFG c)
           
 
Methods inherited from class org.jruby.compiler.ir.dataflow.DataFlowProblem
compute_MOP_Solution, getCFG, getDFVarsCount, getFlowDirection, getFlowGraphNode, incomingEdgesOf, isEmpty, outgoingEdgesOf, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LiveVariablesProblem

public LiveVariablesProblem()
Method Detail

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.