public abstract class IRScope extends java.lang.Object implements ParseResult
Modifier and Type | Field and Description |
---|---|
protected int |
booleanVariableIndex |
protected int |
fixnumVariableIndex |
protected int |
floatVariableIndex |
protected FullInterpreterContext |
fullInterpreterContext
-X-C full interpretation OR JIT depends on this
|
protected InterpreterContext |
interpreterContext
Startup interpretation depends on this
|
static Logger |
LOG |
protected int |
temporaryVariableIndex |
protected int |
threadPollInstrsCount
# of thread poll instrs added to this scope
|
Modifier | Constructor and Description |
---|---|
|
IRScope(IRManager manager,
IRScope lexicalParent,
RubySymbol name,
int lineNumber,
StaticScope staticScope) |
protected |
IRScope(IRScope s,
IRScope lexicalParent) |
Modifier and Type | Method and Description |
---|---|
protected void |
addChildScope(IRScope scope) |
void |
addClosure(IRClosure closure) |
InterpreterContext |
allocateInterpreterContext(java.util.concurrent.Callable<java.util.List<Instr>> instructions)
Make version specific to scope which needs it (e.g.
|
InterpreterContext |
allocateInterpreterContext(java.util.List<Instr> instructions)
Make version specific to scope which needs it (e.g.
|
protected int |
allocateNextPrefixedName(java.lang.String prefix) |
boolean |
bindingHasEscaped() |
java.util.Map<BasicBlock,Label> |
buildJVMExceptionTable() |
boolean |
canReceiveNonlocalReturns() |
void |
computeScopeFlags()
Calculate scope flags used by various passes to know things like whether a binding has escaped.
|
void |
computeScopeFlagsEarly(java.util.List<Instr> instructions)
This is called when building an IRMethod before it has completed the build and made an IC
yet.
|
TemporaryLocalVariable |
createTemporaryVariable() |
java.lang.String |
debugOutput() |
boolean |
definesLocalVariable(Variable v) |
protected void |
depends(java.lang.Object obj) |
IGVDumper |
dumpToIGV() |
boolean |
equals(java.lang.Object other) |
protected LocalVariable |
findExistingLocalVariable(RubySymbol name,
int depth) |
java.util.List<IRClosure> |
getBeginBlocks() |
int |
getBooleanVariablesCount() |
CFG |
getCFG() |
java.util.Collection<IRClosure> |
getClosures() |
Variable |
getCurrentModuleVariable() |
Variable |
getCurrentScopeVariable() |
java.util.List<IRClosure> |
getEndBlocks() |
java.util.List<CompilerPass> |
getExecutedPasses() |
FullInterpreterContext |
getExecutionContext() |
java.lang.String |
getFileName() |
int |
getFixnumVariablesCount() |
java.util.EnumSet<IRFlags> |
getFlags() |
int |
getFloatVariablesCount() |
FullInterpreterContext |
getFullInterpreterContext() |
java.lang.String |
getFullyQualifiedName() |
java.lang.String |
getId() |
InterpreterContext |
getInterpreterContext() |
IRScope |
getLexicalParent()
Returns the lexical scope that contains this scope definition
|
java.util.List<IRScope> |
getLexicalScopes() |
int |
getLineNumber() |
LiveVariablesProblem |
getLiveVariablesProblem() |
LocalVariable |
getLocalVariable(RubySymbol name,
int scopeDepth)
Find or create a local variable.
|
java.util.Map<RubySymbol,LocalVariable> |
getLocalVariables()
Get the local variables for this scope.
|
int |
getLocalVariablesCount() |
IRManager |
getManager() |
RubySymbol |
getName() |
IRScope |
getNearestFlipVariableScope() |
IRMethod |
getNearestMethod() |
int |
getNearestModuleReferencingScopeDepth()
Returns the nearest scope which we can extract a live module from.
|
IRScope |
getNearestTopLocalVariableScope() |
LocalVariable |
getNewFlipStateVariable() |
Variable |
getNewInlineVariable(org.jruby.util.ByteList inlinePrefix,
Variable v) |
Label |
getNewLabel() |
Label |
getNewLabel(java.lang.String prefix) |
LocalVariable |
getNewLocalVariable(RubySymbol name,
int scopeDepth) |
TemporaryLocalVariable |
getNewTemporaryVariable(TemporaryVariableType type) |
TemporaryLocalVariable |
getNewTemporaryVariableFor(LocalVariable var) |
TemporaryLocalVariable |
getNewUnboxedVariable(java.lang.Class type) |
int |
getNextClosureId() |
protected int |
getPrefixCountSize(java.lang.String prefix) |
IRScope |
getRootLexicalScope()
Returns the top level scope
|
int |
getScopeId() |
abstract IRScopeType |
getScopeType() |
Variable |
getSelf() |
StaticScope |
getStaticScope() |
StoreLocalVarPlacementProblem |
getStoreLocalVarPlacementProblem() |
int |
getTemporaryVariablesCount() |
int |
getThreadPollInstrsCount() |
UnboxableOpsAnalysisProblem |
getUnboxableOpsAnalysisProblem() |
java.util.Set<LocalVariable> |
getUsedLocalVariables()
Get all variables referenced by this scope.
|
int |
getUsedVariablesCount() |
java.util.Map<java.lang.String,java.lang.Integer> |
getVarIndices() |
TemporaryVariable |
getYieldClosureVariable()
Get the variable for accessing the "yieldable" closure in this scope.
|
boolean |
hasBeenBuilt()
For lazy scopes which IRBuild on demand we can ask this method whether it has been built yet...
|
boolean |
hasExplicitCallProtocol() |
int |
hashCode() |
boolean |
hasLoops() |
void |
inlineMethod(IRScope method,
RubyModule implClass,
int classToken,
BasicBlock basicBlock,
CallBase call,
boolean cloneHost) |
boolean |
isBeginEndBlock() |
boolean |
isFlipScope() |
boolean |
isModuleBody()
Does this scope represent a module body?
|
boolean |
isNestedInClosure(IRClosure closure) |
boolean |
isNonSingletonClassBody()
Is this IRClassBody but not IRMetaClassBody?
|
boolean |
isScriptScope()
Is this an eval script or a regular file script?
|
boolean |
isTopLocalVariableScope() |
protected boolean |
isUnsafeScope() |
LocalVariable |
lookupExistingLVar(RubySymbol name) |
boolean |
maybeUsingRefinements() |
boolean |
needsBinding() |
boolean |
needsFrame() |
boolean |
needsOnlyBackref() |
boolean |
parentMaybeUsingRefinements() |
BasicBlock[] |
prepareForCompilation()
Run any necessary passes to get the IR ready for compilation (AOT and/or JIT)
|
FullInterpreterContext |
prepareFullBuild()
This initializes a more complete(full) InterpreterContext which if used in mixed mode will be
used by the JIT and if used in pure-interpreted mode it will be used by an interpreter engine.
|
void |
putLiveVariablesProblem(LiveVariablesProblem problem) |
void |
putStoreLocalVarPlacementProblem(StoreLocalVarPlacementProblem problem) |
void |
putUnboxableOpsAnalysisProblem(UnboxableOpsAnalysisProblem problem) |
boolean |
receivesKeywordArgs() |
void |
recordBeginBlock(IRClosure beginBlockClosure)
Record a begin block.
|
void |
removeClosure(IRClosure closure) |
void |
resetState() |
void |
resetTemporaryVariables() |
protected void |
resetVariableCounter(java.lang.String prefix) |
boolean |
reuseParentScope() |
void |
setExplicitCallProtocolFlag() |
void |
setFileName(java.lang.String filename) |
void |
setHasLoopsFlag() |
void |
setInterpreterContext(InterpreterContext interpreterContext) |
void |
setIsMaybeUsingRefinements() |
void |
setLabelIndices(java.util.Map<java.lang.String,java.lang.Integer> indices) |
void |
setLocalVariables(java.util.Map<RubySymbol,LocalVariable> variables)
Set the local variables for this scope.
|
void |
setName(RubySymbol name) |
void |
setTemporaryVariableCount(int count) |
void |
setUpUseDefLocalVarMaps() |
java.lang.String |
toString() |
java.lang.String |
toStringInstrs() |
boolean |
usesEval() |
boolean |
usesLocalVariable(Variable v) |
boolean |
usesZSuper() |
public static final Logger LOG
protected InterpreterContext interpreterContext
protected FullInterpreterContext fullInterpreterContext
protected int temporaryVariableIndex
protected int floatVariableIndex
protected int fixnumVariableIndex
protected int booleanVariableIndex
protected int threadPollInstrsCount
public IRScope(IRManager manager, IRScope lexicalParent, RubySymbol name, int lineNumber, StaticScope staticScope)
public int getScopeId()
public int hashCode()
hashCode
in class java.lang.Object
public void setInterpreterContext(InterpreterContext interpreterContext)
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
protected void addChildScope(IRScope scope)
public java.util.List<IRScope> getLexicalScopes()
public void addClosure(IRClosure closure)
public void removeClosure(IRClosure closure)
public LocalVariable getNewFlipStateVariable()
public Label getNewLabel(java.lang.String prefix)
public Label getNewLabel()
public java.util.Collection<IRClosure> getClosures()
public IRManager getManager()
public void setIsMaybeUsingRefinements()
public boolean parentMaybeUsingRefinements()
public boolean maybeUsingRefinements()
public IRScope getLexicalParent()
public StaticScope getStaticScope()
public IRMethod getNearestMethod()
public IRScope getNearestFlipVariableScope()
public IRScope getNearestTopLocalVariableScope()
public int getNearestModuleReferencingScopeDepth()
public java.lang.String getId()
public RubySymbol getName()
public void setName(RubySymbol name)
public void setFileName(java.lang.String filename)
public java.lang.String getFileName()
public int getLineNumber()
public IRScope getRootLexicalScope()
public boolean isNestedInClosure(IRClosure closure)
public void setHasLoopsFlag()
public boolean hasLoops()
public boolean hasExplicitCallProtocol()
public void setExplicitCallProtocolFlag()
public boolean receivesKeywordArgs()
public boolean bindingHasEscaped()
public boolean usesEval()
public boolean usesZSuper()
public boolean canReceiveNonlocalReturns()
public void putLiveVariablesProblem(LiveVariablesProblem problem)
public LiveVariablesProblem getLiveVariablesProblem()
public void putStoreLocalVarPlacementProblem(StoreLocalVarPlacementProblem problem)
public StoreLocalVarPlacementProblem getStoreLocalVarPlacementProblem()
public void putUnboxableOpsAnalysisProblem(UnboxableOpsAnalysisProblem problem)
public UnboxableOpsAnalysisProblem getUnboxableOpsAnalysisProblem()
public CFG getCFG()
protected boolean isUnsafeScope()
public java.util.List<CompilerPass> getExecutedPasses()
public InterpreterContext allocateInterpreterContext(java.util.List<Instr> instructions)
public InterpreterContext allocateInterpreterContext(java.util.concurrent.Callable<java.util.List<Instr>> instructions)
public FullInterpreterContext prepareFullBuild()
public java.lang.String getFullyQualifiedName()
public IGVDumper dumpToIGV()
public BasicBlock[] prepareForCompilation()
public java.util.Map<BasicBlock,Label> buildJVMExceptionTable()
public java.util.EnumSet<IRFlags> getFlags()
public void computeScopeFlagsEarly(java.util.List<Instr> instructions)
public void computeScopeFlags()
public abstract IRScopeType getScopeType()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String debugOutput()
public java.lang.String toStringInstrs()
public Variable getSelf()
public Variable getCurrentModuleVariable()
public Variable getCurrentScopeVariable()
public java.util.Map<RubySymbol,LocalVariable> getLocalVariables()
public java.util.Set<LocalVariable> getUsedLocalVariables()
public void setLocalVariables(java.util.Map<RubySymbol,LocalVariable> variables)
public void setLabelIndices(java.util.Map<java.lang.String,java.lang.Integer> indices)
public LocalVariable lookupExistingLVar(RubySymbol name)
protected LocalVariable findExistingLocalVariable(RubySymbol name, int depth)
public LocalVariable getLocalVariable(RubySymbol name, int scopeDepth)
public LocalVariable getNewLocalVariable(RubySymbol name, int scopeDepth)
public TemporaryLocalVariable createTemporaryVariable()
public TemporaryLocalVariable getNewTemporaryVariableFor(LocalVariable var)
public TemporaryLocalVariable getNewTemporaryVariable(TemporaryVariableType type)
public void setTemporaryVariableCount(int count)
public TemporaryVariable getYieldClosureVariable()
public TemporaryLocalVariable getNewUnboxedVariable(java.lang.Class type)
public void resetTemporaryVariables()
public int getTemporaryVariablesCount()
public int getFloatVariablesCount()
public int getFixnumVariablesCount()
public int getBooleanVariablesCount()
public Variable getNewInlineVariable(org.jruby.util.ByteList inlinePrefix, Variable v)
public int getThreadPollInstrsCount()
public int getLocalVariablesCount()
public int getUsedVariablesCount()
public void setUpUseDefLocalVarMaps()
public boolean usesLocalVariable(Variable v)
public boolean definesLocalVariable(Variable v)
public boolean hasBeenBuilt()
public FullInterpreterContext getExecutionContext()
public InterpreterContext getInterpreterContext()
public FullInterpreterContext getFullInterpreterContext()
protected void depends(java.lang.Object obj)
public void resetState()
public void inlineMethod(IRScope method, RubyModule implClass, int classToken, BasicBlock basicBlock, CallBase call, boolean cloneHost)
public void recordBeginBlock(IRClosure beginBlockClosure)
public java.util.List<IRClosure> getBeginBlocks()
public java.util.List<IRClosure> getEndBlocks()
protected int allocateNextPrefixedName(java.lang.String prefix)
protected void resetVariableCounter(java.lang.String prefix)
public java.util.Map<java.lang.String,java.lang.Integer> getVarIndices()
protected int getPrefixCountSize(java.lang.String prefix)
public int getNextClosureId()
public boolean isBeginEndBlock()
public boolean isModuleBody()
public boolean isNonSingletonClassBody()
public boolean isFlipScope()
public boolean isTopLocalVariableScope()
public boolean isScriptScope()
public boolean needsFrame()
public boolean needsOnlyBackref()
public boolean reuseParentScope()
public boolean needsBinding()
Copyright © 2001-2018 JRuby. All Rights Reserved.