org.jruby.compiler.ir
Class IRExecutionScope
java.lang.Object
org.jruby.compiler.ir.IRScopeImpl
org.jruby.compiler.ir.IRExecutionScope
- All Implemented Interfaces:
- IRScope
- Direct Known Subclasses:
- IRClosure, IRMethod
public abstract class IRExecutionScope
- extends IRScopeImpl
Methods inherited from class org.jruby.compiler.ir.IRScopeImpl |
getContainer, getContainerModule, getLexicalParent, getName, getNearestModule, getNewInlineVariable, getNewLabel, getNewLabel, getNewTemporaryClosureVariable, getNewTemporaryVariable, getNextClosureId, getPrefixCountSize, getRenamedVariableSize, getScopeName, getStaticScope, getTemporaryVariableSize, prepareForInterpretation, recordMethodAlias, runCompilerPass, setContainer, setName, toString, unaliasMethodName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
requiredArgs
protected int requiredArgs
optionalArgs
protected int optionalArgs
restArg
protected int restArg
IRExecutionScope
public IRExecutionScope(IRScope lexicalParent,
Operand container,
java.lang.String name,
StaticScope staticScope)
addClosure
public void addClosure(IRClosure c)
addInstr
public void addInstr(Instr i)
- Description copied from interface:
IRScope
- methods and closures
- Specified by:
addInstr
in interface IRScope
- Overrides:
addInstr
in class IRScopeImpl
startLoop
public void startLoop(IRLoop l)
endLoop
public void endLoop(IRLoop l)
getCurrentLoop
public IRLoop getCurrentLoop()
getClosures
public java.util.List<IRClosure> getClosures()
getInstrs
public java.util.List<Instr> getInstrs()
- Overrides:
getInstrs
in class IRScopeImpl
getClosestMethodAncestor
public IRMethod getClosestMethodAncestor()
setCodeModificationFlag
public void setCodeModificationFlag(boolean f)
modifiesCode
public boolean modifiesCode()
requiresBinding
public boolean requiresBinding()
canCaptureCallersBinding
public boolean canCaptureCallersBinding()
buildCFG
public CFG buildCFG()
getCFG
public CFG getCFG()
runCompilerPassOnNestedScopes
public void runCompilerPassOnNestedScopes(CompilerPass p)
- Overrides:
runCompilerPassOnNestedScopes
in class IRScopeImpl
computeExecutionScopeFlags
public void computeExecutionScopeFlags()
toStringInstrs
public java.lang.String toStringInstrs()
- Overrides:
toStringInstrs
in class IRScopeImpl
toStringVariables
public java.lang.String toStringVariables()
- Overrides:
toStringVariables
in class IRScopeImpl
getLiveLocalVariables
public java.util.Iterator<LocalVariable> getLiveLocalVariables()
allocateStaticScope
public StaticScope allocateStaticScope(StaticScope parent)
- Create and (re)assign a static scope. In general local variables should
never change even if we optimize more, but I was not positive so I am
pretending this can change over time. The obvious secondary benefit
to storing this on execution scope is we can grab it when we allocate
static scopes for all closures.
Note: We are missing a distinct life-cycle point to run methods like this
since this method can be modified at any point. Not being fully set up
is less of an issue since we are calling this when we construct a live
runtime version of the method/closure etc, but for profiled optimizations
this is less clear if/when we can run this. <-- Assumes this ever needs
changing.
- Parameters:
parent
- scope should be non-null for all closures and null for methods
calculateParameterCounts
public void calculateParameterCounts()
constructStaticScope
protected abstract StaticScope constructStaticScope(StaticScope parent)
- Closures and Methods have different static scopes. This returns the
correct instance.
- Parameters:
parent
- scope should be non-null for all closures and null for methods
- Returns:
- a newly allocated static scope
getSelf
public Variable getSelf()
getLocalVariable
public LocalVariable getLocalVariable(java.lang.String name)
- Description copied from interface:
IRScope
- Get Local Variable from this scope
getLocalVariablesCount
public int getLocalVariablesCount()
Copyright © 2002-2009 JRuby Team. All Rights Reserved.