|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jruby.compiler.ir.IRScopeImpl
public abstract class IRScopeImpl
Right now, this class abstracts 5 different scopes: Script, Module, Class, Method, and Closure. Script, Module, and Class are containers and "non-execution" scopes. Method and Closure are the only two "execution" scopes. In the compiler-land, IR_* versions of these scopes encapsulate only as much information as is required to convert Ruby code into equivalent Java code. But, in the non-compiler land, there will be a corresponding java object for each of these scopes which encapsulates the runtime semantics and data needed for implementing them. In the case of Module, Class, and Method, they also happen to be instances of the corresponding Ruby classes -- so, in addition to providing code that help with this specific ruby implementation, they also have code that let them behave as ruby instances of their corresponding classes. Script and Closure have no such Ruby companions, as far as I can tell. Examples: - the runtime class object might have refs. to the runtime method objects. - the runtime method object might have a slot for a heap frame (for when it has closures that need access to the method's local variables), it might have version information, it might have references to other methods that were optimized with the current version number, etc. - the runtime closure object will have a slot for a heap frame (for when it has closures within) and might get reified as a method in the java land (but inaccessible in ruby land). So, passing closures in Java land might be equivalent to passing around the method handles. and so on ...
| Constructor Summary | |
|---|---|
IRScopeImpl(IRScope lexicalParent,
Operand container,
java.lang.String name,
StaticScope staticScope)
|
|
| Method Summary | |
|---|---|
void |
addInstr(Instr i)
methods and closures |
Operand |
getContainer()
Returns the containing parent scope |
RubyModule |
getContainerModule()
|
java.util.List<Instr> |
getInstrs()
|
IRScope |
getLexicalParent()
Returns the lexical scope that contains this scope definition |
java.lang.String |
getName()
|
IRModule |
getNearestModule()
Returns the nearest module/class from this scope which may be itself. |
Variable |
getNewInlineVariable()
|
Label |
getNewLabel()
Get a new label using a generic prefix |
Label |
getNewLabel(java.lang.String prefix)
Get a new label using the provided label prefix |
Variable |
getNewTemporaryClosureVariable(int closureId)
|
Variable |
getNewTemporaryVariable()
create a new temporary variable |
int |
getNextClosureId()
Get the next available unique closure id for closures in this scope |
protected int |
getPrefixCountSize(java.lang.String prefix)
|
int |
getRenamedVariableSize()
How many renamed variables are in this scope? |
abstract java.lang.String |
getScopeName()
|
StaticScope |
getStaticScope()
|
int |
getTemporaryVariableSize()
How many temporary variables are in this scope? |
void |
prepareForInterpretation()
|
void |
recordMethodAlias(java.lang.String newName,
java.lang.String oldName)
Record that newName is a new method name for method with oldName This is for the 'alias' keyword which resolves method names in the static compile/parse-time context |
void |
runCompilerPass(CompilerPass p)
Run the passed in compiler pass on this scope! |
void |
runCompilerPassOnNestedScopes(CompilerPass p)
|
void |
setContainer(Operand o)
|
void |
setName(java.lang.String name)
|
java.lang.String |
toString()
|
java.lang.String |
toStringInstrs()
|
java.lang.String |
toStringVariables()
|
java.lang.String |
unaliasMethodName(java.lang.String name)
Unalias 'name' and return new name |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jruby.compiler.ir.IRScope |
|---|
getLocalVariable |
| Constructor Detail |
|---|
public IRScopeImpl(IRScope lexicalParent,
Operand container,
java.lang.String name,
StaticScope staticScope)
| Method Detail |
|---|
public void setContainer(Operand o)
public Operand getContainer()
IRScope
getContainer in interface IRScopepublic RubyModule getContainerModule()
public IRScope getLexicalParent()
IRScope
getLexicalParent in interface IRScopepublic IRModule getNearestModule()
IRScope
getNearestModule in interface IRScopepublic int getNextClosureId()
IRScope
getNextClosureId in interface IRScopepublic Variable getNewTemporaryClosureVariable(int closureId)
public Variable getNewTemporaryVariable()
IRScope
getNewTemporaryVariable in interface IRScopepublic Variable getNewInlineVariable()
public int getTemporaryVariableSize()
IRScope
getTemporaryVariableSize in interface IRScopepublic int getRenamedVariableSize()
IRScope
getRenamedVariableSize in interface IRScopepublic java.lang.String getName()
getName in interface IRScopepublic void setName(java.lang.String name)
public abstract java.lang.String getScopeName()
public Label getNewLabel(java.lang.String prefix)
IRScope
getNewLabel in interface IRScopepublic Label getNewLabel()
IRScope
getNewLabel in interface IRScopeprotected int getPrefixCountSize(java.lang.String prefix)
public StaticScope getStaticScope()
getStaticScope in interface IRScopepublic void addInstr(Instr i)
IRScope
addInstr in interface IRScope
public void recordMethodAlias(java.lang.String newName,
java.lang.String oldName)
IRScope
recordMethodAlias in interface IRScopepublic java.lang.String unaliasMethodName(java.lang.String name)
IRScope
unaliasMethodName in interface IRScopepublic java.util.List<Instr> getInstrs()
public java.lang.String toString()
toString in class java.lang.Objectpublic void runCompilerPassOnNestedScopes(CompilerPass p)
public void runCompilerPass(CompilerPass p)
IRScope
runCompilerPass in interface IRScopepublic void prepareForInterpretation()
prepareForInterpretation in interface IRScopepublic java.lang.String toStringInstrs()
public java.lang.String toStringVariables()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||