org.jruby.compiler.impl
Class StandardASMCompiler.AbstractMethodCompiler

java.lang.Object
  extended by org.jruby.compiler.impl.StandardASMCompiler.AbstractMethodCompiler
All Implemented Interfaces:
MethodCompiler
Direct Known Subclasses:
StandardASMCompiler.ASMClosureCompiler, StandardASMCompiler.ASMMethodCompiler
Enclosing class:
StandardASMCompiler

public abstract class StandardASMCompiler.AbstractMethodCompiler
extends java.lang.Object
implements MethodCompiler


Field Summary
protected  org.objectweb.asm.Label[] currentLoopLabels
           
protected  InvocationCompiler invocationCompiler
           
protected  SkinnyMethodAdapter method
           
protected  org.objectweb.asm.Label redoJump
           
protected  org.objectweb.asm.Label scopeEnd
           
protected  org.objectweb.asm.Label scopeStart
           
protected  VariableCompiler variableCompiler
           
protected  boolean withinProtection
           
 
Constructor Summary
StandardASMCompiler.AbstractMethodCompiler()
           
 
Method Summary
 void aliasGlobal(java.lang.String newName, java.lang.String oldName)
           
 void appendToArray()
           
 void appendToObjectArray()
           
 void aryToAry()
           
 void assignClassVariable(java.lang.String name)
           
 void assignConstantInCurrent(java.lang.String name)
           
 void assignConstantInModule(java.lang.String name)
           
 void assignConstantInObject(java.lang.String name)
           
 void assignGlobalVariable(java.lang.String name)
          Assign the top of the stack to the global variable with the specified name.
 void assignInstanceVariable(java.lang.String name)
          Assign the value on top of the stack to the instance variable with the specified name on the current "self".
 void asString()
           
 void attached()
           
 void backref()
          Push the current back reference
 void backrefMethod(java.lang.String methodName)
          Call a static helper method on RubyRegexp with the current backref
abstract  void beginMethod(CompilerCallback args, StaticScope scope)
           
 void branchIfModule(CompilerCallback receiverCallback, BranchCallback moduleCallback, BranchCallback notModuleCallback)
           
 void callZSuper(CompilerCallback closure)
           
 MethodCompiler chainToMethod(java.lang.String methodName, ASTInspector inspector)
           
 void checkIsExceptionHandled()
           
 void checkWhenWithSplat()
           
 void concatArrays()
           
 void concatObjectArrays()
           
 void consumeCurrentValue()
          As code executes, values are assumed to be "generated", often by being pushed on to some execution stack.
 void convertToJavaArray()
           
 void createEmptyArray()
          Create an empty Ruby array
 void createEmptyHash()
          Create an empty Ruby Hash object and put a reference on top of the stack.
 void createNewArray(boolean lightweight)
          Given an aggregated set of objects (likely created through a call to createObjectArray) create a Ruby array object.
 void createNewBignum(java.math.BigInteger value)
          Generate a new "Bignum" value.
 void createNewClosure(int line, StaticScope scope, int arity, CompilerCallback body, CompilerCallback args, boolean hasMultipleArgsHead, NodeType argsNodeId, ASTInspector inspector)
          Create a new closure (block) using the given lexical scope information, call arity, and body generated by the body callback.
 void createNewEndBlock(CompilerCallback body)
           
 void createNewFixnum(long value)
          Generate a new "Fixnum" value.
 void createNewFloat(double value)
          Generate a new "Float" value.
 void createNewForLoop(int arity, CompilerCallback body, CompilerCallback args, boolean hasMultipleArgsHead, NodeType argsNodeId)
          Create a new closure (block) for a for loop with the given call arity and body generated by the body callback.
 void createNewHash(java.lang.Object elements, ArrayCallback callback, int keyCount)
          Create a new hash by calling back to the specified ArrayCallback.
 void createNewRange(boolean isExclusive)
          Create a new range.
 void createNewRegexp(org.jruby.util.ByteList value, int options)
           
 void createNewRegexp(CompilerCallback createStringCallback, int options)
           
 void createNewString(ArrayCallback callback, int count)
          Generate a new dynamic "String" value.
 void createNewString(org.jruby.util.ByteList value)
          Generate a new "String" value.
 void createNewSymbol(ArrayCallback callback, int count)
           
 void createNewSymbol(java.lang.String name)
          Generate a new "Symbol" value (or fetch the existing one).
 void createObjectArray(int elementCount)
          Combine the top
 void createObjectArray(java.lang.Object[] sourceArray, ArrayCallback callback)
           
 void declareClassVariable(java.lang.String name)
           
 void defineAlias(java.lang.String newName, java.lang.String oldName)
          Define an alias for a new name to an existing oldName'd method.
 void defineClass(java.lang.String name, StaticScope staticScope, CompilerCallback superCallback, CompilerCallback pathCallback, CompilerCallback bodyCallback, CompilerCallback receiverCallback)
           
 void defineModule(java.lang.String name, StaticScope staticScope, CompilerCallback pathCallback, CompilerCallback bodyCallback)
           
 void defineNewMethod(java.lang.String name, int methodArity, StaticScope scope, CompilerCallback body, CompilerCallback args, CompilerCallback receiver, ASTInspector inspector, boolean root)
          Define a new method with the given name, arity, local variable count, and body callback.
 void duplicateCurrentValue()
          Push a copy the topmost value on the stack.
abstract  void endMethod()
          End compilation for the method associated with the specified token.
 void ensureMultipleAssignableRubyArray(boolean masgnHasHead)
          Ensures that the present value is an IRubyObject[] by wrapping it with one or coercing it if it is not.
 void ensureRubyArray()
          Ensures that the present value is an IRubyObject[] by wrapping it with one if it is not.
 void forEachInValueArray(int start, int count, java.lang.Object source, ArrayCallback callback, ArrayCallback nilCallback, CompilerCallback argsCallback)
          Given an IRubyObject[] on the stack (or otherwise available as the present object) call back to the provided ArrayCallback 'callback' for 'count' elements, starting with 'start'.
 void getCompiledClass()
           
 void getFrameKlazz()
           
 void getFrameName()
           
 void getInstanceVariable(java.lang.String name)
           
 InvocationCompiler getInvocationCompiler()
           
 java.lang.Object getNewEnding()
           
protected  java.lang.String getNewEnsureName()
           
protected  java.lang.String getNewRescueName()
           
 StandardASMCompiler getScriptCompiler()
           
 VariableCompiler getVariableCompiler()
           
 void getVisibilityFor(java.lang.String name)
           
 void go(java.lang.Object gotoToken)
           
 void hasBlock(BranchCallback trueBranch, BranchCallback falseBranch)
           
 void ifNotNull(java.lang.Object gotoToken)
           
 void ifNotSuperMethodBound(java.lang.Object token)
           
 void ifNull(java.lang.Object gotoToken)
           
 void ifSingleton(java.lang.Object gotoToken)
           
 void inDefined()
           
 void invokeIRuby(java.lang.String methodName, java.lang.String signature)
           
 void invokeIRubyObject(java.lang.String methodName, java.lang.String signature)
           
 void invokeThreadContext(java.lang.String methodName, java.lang.String signature)
           
 void invokeUtilityMethod(java.lang.String methodName, java.lang.String signature)
          This is for utility methods used by the compiler, to reduce the amount of code generation necessary.
 void isCaptured(int number, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isClassVarDefined(java.lang.String name, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isConstantBranch(BranchCallback setup, BranchCallback isConstant, BranchCallback isMethod, BranchCallback none, java.lang.String name)
           
 void isConstantDefined(java.lang.String name, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isGlobalDefined(java.lang.String name, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isInstanceOf(java.lang.Class clazz, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isInstanceVariableDefined(java.lang.String name, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isMethodBound(java.lang.String name, BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isNil(BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isNotProtected(java.lang.Object gotoToken, int toConsume)
           
 void isNull(BranchCallback trueBranch, BranchCallback falseBranch)
           
 void isPrivate(java.lang.Object gotoToken, int toConsume)
           
 void issueLoopBreak()
           
 void issueLoopNext()
           
 void issueLoopRedo()
           
 void issueRetryEvent()
           
 void lineNumber(ISourcePosition position)
          This method provides a way to specify a line number for the current piece of code being compiled.
 void loadBlock()
           
 void loadClass(java.lang.String name)
           
 void loadCurrentModule()
           
 void loadException()
           
 void loadFalse()
          Load a Ruby "false" value on top of the stack.
 void loadNil()
          Load a Ruby "nil" value on top of the stack.
 void loadNull()
           
 void loadObject()
          Load the Object class
 void loadRuntime()
           
 void loadSelf()
           
 void loadSymbol(java.lang.String symbol)
          Load the given string as a symbol on to the top of the stack.
 void loadThreadContext()
           
 void loadTrue()
          Load a Ruby "true" value on top of the stack.
 void match()
           
 void match2()
           
 void match3()
           
 void metaclass()
           
 void negateCurrentValue()
          Perform a logical Ruby "not" operation on the value on top of the stack, leaving the negated result.
 void notIsModuleAndClassVarDefined(java.lang.String name, java.lang.Object gotoToken)
           
 void nthRef(int match)
           
 void nullToNil()
           
 void outDefined()
           
 void performBackref(char type)
           
 void performBooleanBranch(BranchCallback trueBranch, BranchCallback falseBranch)
          Perform a boolean branch operation based on the Ruby "true" value of the top value on the stack.
 void performBooleanLoop(BranchCallback condition, BranchCallback body, boolean checkFirst)
          Perform a boolean loop using the given condition-calculating branch and body branch.
 void performLogicalAnd(BranchCallback longBranch)
          Perform a logical short-circuited Ruby "and" operation, using Ruby notions of true and false.
 void performLogicalOr(BranchCallback longBranch)
          Perform a logical short-circuited Ruby "or" operation, using Ruby notions of true and false.
 void pollThreadEvents()
           
 void println()
           
 void protect(BranchCallback regularCode, BranchCallback protectedCode, java.lang.Class ret)
          Makes sure that the code in protectedCode will always run after regularCode.
 void pushNull()
           
 void pushString(java.lang.String str)
           
 void rescue(BranchCallback regularCode, java.lang.Class exception, BranchCallback catchCode, java.lang.Class ret)
           
 void rethrowException()
           
 void rethrowIfSystemExit()
           
 void retrieveClassVariable(java.lang.String name)
           
 void retrieveConstant(java.lang.String name)
          Retrieve the constant with the specified name available at the current point in the program's execution.
 void retrieveConstantFromModule(java.lang.String name)
          Retreive a named constant from the RubyModule/RubyClass that's just been pushed.
 void retrieveGlobalVariable(java.lang.String name)
          Retrieve the global variable with the specified name to the top of the stack.
 void retrieveInstanceVariable(java.lang.String name)
          Retrieve the instance variable with the given name, based on the current "self".
 void retrieveSelf()
          Retrieve the current "self" and put a reference on top of the stack.
 void retrieveSelfClass()
          Retrieve the current "self" object's metaclass and put a reference on top of the stack
 void runBeginBlock(StaticScope scope, CompilerCallback body)
           
 void selfIsKindOf(java.lang.Object gotoToken)
           
 void setEnding(java.lang.Object endingToken)
           
 void setFilePosition(ISourcePosition position)
           
 void setLinePosition(ISourcePosition position)
           
 void singlifySplattedValue()
          Given a splatted value, extract a single value.
 void splatCurrentValue()
          Convert the current value into a "splatted value" suitable for passing as method arguments or disassembling into multiple variables.
 void stringOrNil()
           
 void superClass()
           
 void swapValues()
          Swap the top and second values on the stack.
 void toJavaString()
           
 void undefMethod(java.lang.String name)
           
 void unwrapPassedBlock()
           
 void unwrapRaiseException()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jruby.compiler.MethodCompiler
issueBreakEvent, issueNextEvent, issueRedoEvent, performReturn
 

Field Detail

method

protected SkinnyMethodAdapter method

variableCompiler

protected VariableCompiler variableCompiler

invocationCompiler

protected InvocationCompiler invocationCompiler

currentLoopLabels

protected org.objectweb.asm.Label[] currentLoopLabels

scopeStart

protected org.objectweb.asm.Label scopeStart

scopeEnd

protected org.objectweb.asm.Label scopeEnd

redoJump

protected org.objectweb.asm.Label redoJump

withinProtection

protected boolean withinProtection
Constructor Detail

StandardASMCompiler.AbstractMethodCompiler

public StandardASMCompiler.AbstractMethodCompiler()
Method Detail

beginMethod

public abstract void beginMethod(CompilerCallback args,
                                 StaticScope scope)

endMethod

public abstract void endMethod()
Description copied from interface: MethodCompiler
End compilation for the method associated with the specified token. This should close out all structures created for compilation of the method.

Specified by:
endMethod in interface MethodCompiler

chainToMethod

public MethodCompiler chainToMethod(java.lang.String methodName,
                                    ASTInspector inspector)
Specified by:
chainToMethod in interface MethodCompiler

getScriptCompiler

public StandardASMCompiler getScriptCompiler()

lineNumber

public void lineNumber(ISourcePosition position)
Description copied from interface: MethodCompiler
This method provides a way to specify a line number for the current piece of code being compiled. The compiler may use this information to create debugging information in a bytecode-format-dependent way.

Specified by:
lineNumber in interface MethodCompiler
Parameters:
position - The ISourcePosition information to use.

loadThreadContext

public void loadThreadContext()

loadSelf

public void loadSelf()
Specified by:
loadSelf in interface MethodCompiler

loadRuntime

public void loadRuntime()

loadBlock

public void loadBlock()

loadNil

public void loadNil()
Description copied from interface: MethodCompiler
Load a Ruby "nil" value on top of the stack.

Specified by:
loadNil in interface MethodCompiler

loadNull

public void loadNull()
Specified by:
loadNull in interface MethodCompiler

loadSymbol

public void loadSymbol(java.lang.String symbol)
Description copied from interface: MethodCompiler
Load the given string as a symbol on to the top of the stack.

Specified by:
loadSymbol in interface MethodCompiler
Parameters:
symbol - The symbol to load.

loadObject

public void loadObject()
Description copied from interface: MethodCompiler
Load the Object class

Specified by:
loadObject in interface MethodCompiler

invokeUtilityMethod

public void invokeUtilityMethod(java.lang.String methodName,
                                java.lang.String signature)
This is for utility methods used by the compiler, to reduce the amount of code generation necessary. All of these live in CompilerHelpers.


invokeThreadContext

public void invokeThreadContext(java.lang.String methodName,
                                java.lang.String signature)

invokeIRuby

public void invokeIRuby(java.lang.String methodName,
                        java.lang.String signature)

invokeIRubyObject

public void invokeIRubyObject(java.lang.String methodName,
                              java.lang.String signature)

consumeCurrentValue

public void consumeCurrentValue()
Description copied from interface: MethodCompiler
As code executes, values are assumed to be "generated", often by being pushed on to some execution stack. Generally, these values are consumed by other methods on the context, but occasionally a value must be "thrown out". This method provides a way to discard the previous value generated by some other call(s).

Specified by:
consumeCurrentValue in interface MethodCompiler

duplicateCurrentValue

public void duplicateCurrentValue()
Description copied from interface: MethodCompiler
Push a copy the topmost value on the stack.

Specified by:
duplicateCurrentValue in interface MethodCompiler

swapValues

public void swapValues()
Description copied from interface: MethodCompiler
Swap the top and second values on the stack.

Specified by:
swapValues in interface MethodCompiler

retrieveSelf

public void retrieveSelf()
Description copied from interface: MethodCompiler
Retrieve the current "self" and put a reference on top of the stack.

Specified by:
retrieveSelf in interface MethodCompiler

retrieveSelfClass

public void retrieveSelfClass()
Description copied from interface: MethodCompiler
Retrieve the current "self" object's metaclass and put a reference on top of the stack

Specified by:
retrieveSelfClass in interface MethodCompiler

getVariableCompiler

public VariableCompiler getVariableCompiler()
Specified by:
getVariableCompiler in interface MethodCompiler

getInvocationCompiler

public InvocationCompiler getInvocationCompiler()
Specified by:
getInvocationCompiler in interface MethodCompiler

assignConstantInCurrent

public void assignConstantInCurrent(java.lang.String name)
Specified by:
assignConstantInCurrent in interface MethodCompiler

assignConstantInModule

public void assignConstantInModule(java.lang.String name)
Specified by:
assignConstantInModule in interface MethodCompiler

assignConstantInObject

public void assignConstantInObject(java.lang.String name)
Specified by:
assignConstantInObject in interface MethodCompiler

retrieveConstant

public void retrieveConstant(java.lang.String name)
Description copied from interface: MethodCompiler
Retrieve the constant with the specified name available at the current point in the program's execution.

Specified by:
retrieveConstant in interface MethodCompiler
Parameters:
name - The name of the constant

retrieveConstantFromModule

public void retrieveConstantFromModule(java.lang.String name)
Description copied from interface: MethodCompiler
Retreive a named constant from the RubyModule/RubyClass that's just been pushed.

Specified by:
retrieveConstantFromModule in interface MethodCompiler
Parameters:
name - The name of the constant

retrieveClassVariable

public void retrieveClassVariable(java.lang.String name)
Specified by:
retrieveClassVariable in interface MethodCompiler

assignClassVariable

public void assignClassVariable(java.lang.String name)
Specified by:
assignClassVariable in interface MethodCompiler

declareClassVariable

public void declareClassVariable(java.lang.String name)
Specified by:
declareClassVariable in interface MethodCompiler

createNewFloat

public void createNewFloat(double value)
Description copied from interface: MethodCompiler
Generate a new "Float" value.

Specified by:
createNewFloat in interface MethodCompiler

createNewFixnum

public void createNewFixnum(long value)
Description copied from interface: MethodCompiler
Generate a new "Fixnum" value.

Specified by:
createNewFixnum in interface MethodCompiler

createNewBignum

public void createNewBignum(java.math.BigInteger value)
Description copied from interface: MethodCompiler
Generate a new "Bignum" value.

Specified by:
createNewBignum in interface MethodCompiler

createNewString

public void createNewString(ArrayCallback callback,
                            int count)
Description copied from interface: MethodCompiler
Generate a new dynamic "String" value.

Specified by:
createNewString in interface MethodCompiler

createNewSymbol

public void createNewSymbol(ArrayCallback callback,
                            int count)
Specified by:
createNewSymbol in interface MethodCompiler

createNewString

public void createNewString(org.jruby.util.ByteList value)
Description copied from interface: MethodCompiler
Generate a new "String" value.

Specified by:
createNewString in interface MethodCompiler

createNewSymbol

public void createNewSymbol(java.lang.String name)
Description copied from interface: MethodCompiler
Generate a new "Symbol" value (or fetch the existing one).

Specified by:
createNewSymbol in interface MethodCompiler

createNewArray

public void createNewArray(boolean lightweight)
Description copied from interface: MethodCompiler
Given an aggregated set of objects (likely created through a call to createObjectArray) create a Ruby array object.

Specified by:
createNewArray in interface MethodCompiler

createEmptyArray

public void createEmptyArray()
Description copied from interface: MethodCompiler
Create an empty Ruby array

Specified by:
createEmptyArray in interface MethodCompiler

createObjectArray

public void createObjectArray(java.lang.Object[] sourceArray,
                              ArrayCallback callback)
Specified by:
createObjectArray in interface MethodCompiler

createObjectArray

public void createObjectArray(int elementCount)
Description copied from interface: MethodCompiler
Combine the top
elementCount
elements into a single element, generally an array or similar construct. The specified number of elements are consumed and an aggregate element remains.

Specified by:
createObjectArray in interface MethodCompiler
Parameters:
elementCount - The number of elements to consume

createEmptyHash

public void createEmptyHash()
Description copied from interface: MethodCompiler
Create an empty Ruby Hash object and put a reference on top of the stack.

Specified by:
createEmptyHash in interface MethodCompiler

createNewHash

public void createNewHash(java.lang.Object elements,
                          ArrayCallback callback,
                          int keyCount)
Description copied from interface: MethodCompiler
Create a new hash by calling back to the specified ArrayCallback. It is expected that the keyCount will be the actual count of key/value pairs, and the caller will handle passing an appropriate elements collection in and dealing with the sequential indices passed to the callback.

Specified by:
createNewHash in interface MethodCompiler
Parameters:
elements - An object holding the elements from which to create the Hash.
callback - An ArrayCallback implementation to which the elements array and iteration counts are passed in sequence.
keyCount - the total count of key-value pairs to be constructed from the elements collection.

createNewRange

public void createNewRange(boolean isExclusive)
Description copied from interface: MethodCompiler
Create a new range. It is expected that the stack will contain the end and begin values for the range as its topmost and second topmost elements.

Specified by:
createNewRange in interface MethodCompiler
Parameters:
isExclusive - Whether the range is exclusive or not (inclusive)

performBooleanBranch

public void performBooleanBranch(BranchCallback trueBranch,
                                 BranchCallback falseBranch)
Description copied from interface: MethodCompiler
Perform a boolean branch operation based on the Ruby "true" value of the top value on the stack. If Ruby "true", invoke the true branch callback. Otherwise, invoke the false branch callback.

Specified by:
performBooleanBranch in interface MethodCompiler
Parameters:
trueBranch - The callback for generating code for the "true" condition
falseBranch - The callback for generating code for the "false" condition

performLogicalAnd

public void performLogicalAnd(BranchCallback longBranch)
Description copied from interface: MethodCompiler
Perform a logical short-circuited Ruby "and" operation, using Ruby notions of true and false. If the value on top of the stack is false, it remains and the branch is not executed. If it is true, the top of the stack is replaced with the result of the branch.

Specified by:
performLogicalAnd in interface MethodCompiler
Parameters:
longBranch - The branch to execute if the "and" operation does not short-circuit.

performLogicalOr

public void performLogicalOr(BranchCallback longBranch)
Description copied from interface: MethodCompiler
Perform a logical short-circuited Ruby "or" operation, using Ruby notions of true and false. If the value on top of the stack is true, it remains and the branch is not executed. If it is false, the top of the stack is replaced with the result of the branch.

Specified by:
performLogicalOr in interface MethodCompiler
Parameters:
longBranch - The branch to execute if the "or" operation does not short-circuit.

performBooleanLoop

public void performBooleanLoop(BranchCallback condition,
                               BranchCallback body,
                               boolean checkFirst)
Description copied from interface: MethodCompiler
Perform a boolean loop using the given condition-calculating branch and body branch. For while loops, pass true for checkFirst. For statement-modifier while loops, pass false. For unless loops, reverse the result of the condition after calculating it.

Specified by:
performBooleanLoop in interface MethodCompiler
Parameters:
condition - The code to execute for calculating the loop condition. A Ruby true result will cause the body to be executed again.
body - The body to executed for the loop.
checkFirst - whether to check the condition the first time through or not.

createNewClosure

public void createNewClosure(int line,
                             StaticScope scope,
                             int arity,
                             CompilerCallback body,
                             CompilerCallback args,
                             boolean hasMultipleArgsHead,
                             NodeType argsNodeId,
                             ASTInspector inspector)
Description copied from interface: MethodCompiler
Create a new closure (block) using the given lexical scope information, call arity, and body generated by the body callback. The closure will capture containing scopes and related information.

Specified by:
createNewClosure in interface MethodCompiler
scope - The static scoping information
arity - The arity of the block's argument list
body - The callback which will generate the closure's body

runBeginBlock

public void runBeginBlock(StaticScope scope,
                          CompilerCallback body)
Specified by:
runBeginBlock in interface MethodCompiler

createNewForLoop

public void createNewForLoop(int arity,
                             CompilerCallback body,
                             CompilerCallback args,
                             boolean hasMultipleArgsHead,
                             NodeType argsNodeId)
Description copied from interface: MethodCompiler
Create a new closure (block) for a for loop with the given call arity and body generated by the body callback.

Specified by:
createNewForLoop in interface MethodCompiler
Parameters:
arity - The arity of the block's argument list
body - The callback which will generate the closure's body

createNewEndBlock

public void createNewEndBlock(CompilerCallback body)
Specified by:
createNewEndBlock in interface MethodCompiler

getCompiledClass

public void getCompiledClass()

println

public void println()

defineAlias

public void defineAlias(java.lang.String newName,
                        java.lang.String oldName)
Description copied from interface: MethodCompiler
Define an alias for a new name to an existing oldName'd method.

Specified by:
defineAlias in interface MethodCompiler
Parameters:
newName - The new alias to create
oldName - The name of the existing method or alias

loadFalse

public void loadFalse()
Description copied from interface: MethodCompiler
Load a Ruby "false" value on top of the stack.

Specified by:
loadFalse in interface MethodCompiler

loadTrue

public void loadTrue()
Description copied from interface: MethodCompiler
Load a Ruby "true" value on top of the stack.

Specified by:
loadTrue in interface MethodCompiler

loadCurrentModule

public void loadCurrentModule()
Specified by:
loadCurrentModule in interface MethodCompiler

retrieveInstanceVariable

public void retrieveInstanceVariable(java.lang.String name)
Description copied from interface: MethodCompiler
Retrieve the instance variable with the given name, based on the current "self".

Specified by:
retrieveInstanceVariable in interface MethodCompiler
Parameters:
name - The name of the instance variable to retrieve.

assignInstanceVariable

public void assignInstanceVariable(java.lang.String name)
Description copied from interface: MethodCompiler
Assign the value on top of the stack to the instance variable with the specified name on the current "self". The value is consumed.

Specified by:
assignInstanceVariable in interface MethodCompiler
Parameters:
name - The name of the value to assign.

retrieveGlobalVariable

public void retrieveGlobalVariable(java.lang.String name)
Description copied from interface: MethodCompiler
Retrieve the global variable with the specified name to the top of the stack.

Specified by:
retrieveGlobalVariable in interface MethodCompiler
Parameters:
name - The name of the global variable.

assignGlobalVariable

public void assignGlobalVariable(java.lang.String name)
Description copied from interface: MethodCompiler
Assign the top of the stack to the global variable with the specified name.

Specified by:
assignGlobalVariable in interface MethodCompiler
Parameters:
name - The name of the global variable.

negateCurrentValue

public void negateCurrentValue()
Description copied from interface: MethodCompiler
Perform a logical Ruby "not" operation on the value on top of the stack, leaving the negated result.

Specified by:
negateCurrentValue in interface MethodCompiler

splatCurrentValue

public void splatCurrentValue()
Description copied from interface: MethodCompiler
Convert the current value into a "splatted value" suitable for passing as method arguments or disassembling into multiple variables.

Specified by:
splatCurrentValue in interface MethodCompiler

singlifySplattedValue

public void singlifySplattedValue()
Description copied from interface: MethodCompiler
Given a splatted value, extract a single value. If no splat or length is zero, use nil

Specified by:
singlifySplattedValue in interface MethodCompiler

aryToAry

public void aryToAry()
Specified by:
aryToAry in interface MethodCompiler

ensureRubyArray

public void ensureRubyArray()
Description copied from interface: MethodCompiler
Ensures that the present value is an IRubyObject[] by wrapping it with one if it is not.

Specified by:
ensureRubyArray in interface MethodCompiler

ensureMultipleAssignableRubyArray

public void ensureMultipleAssignableRubyArray(boolean masgnHasHead)
Description copied from interface: MethodCompiler
Ensures that the present value is an IRubyObject[] by wrapping it with one or coercing it if it is not.

Specified by:
ensureMultipleAssignableRubyArray in interface MethodCompiler

forEachInValueArray

public void forEachInValueArray(int start,
                                int count,
                                java.lang.Object source,
                                ArrayCallback callback,
                                ArrayCallback nilCallback,
                                CompilerCallback argsCallback)
Description copied from interface: MethodCompiler
Given an IRubyObject[] on the stack (or otherwise available as the present object) call back to the provided ArrayCallback 'callback' for 'count' elements, starting with 'start'. Each call to callback will have a value from the input array on the stack; once the items are exhausted, the code in nilCallback will be invoked *with no value on the stack*.

Specified by:
forEachInValueArray in interface MethodCompiler

asString

public void asString()
Specified by:
asString in interface MethodCompiler

toJavaString

public void toJavaString()
Specified by:
toJavaString in interface MethodCompiler

nthRef

public void nthRef(int match)
Specified by:
nthRef in interface MethodCompiler

match

public void match()
Specified by:
match in interface MethodCompiler

match2

public void match2()
Specified by:
match2 in interface MethodCompiler

match3

public void match3()
Specified by:
match3 in interface MethodCompiler

createNewRegexp

public void createNewRegexp(org.jruby.util.ByteList value,
                            int options)
Specified by:
createNewRegexp in interface MethodCompiler

createNewRegexp

public void createNewRegexp(CompilerCallback createStringCallback,
                            int options)
Specified by:
createNewRegexp in interface MethodCompiler

pollThreadEvents

public void pollThreadEvents()
Specified by:
pollThreadEvents in interface MethodCompiler

nullToNil

public void nullToNil()
Specified by:
nullToNil in interface MethodCompiler

isInstanceOf

public void isInstanceOf(java.lang.Class clazz,
                         BranchCallback trueBranch,
                         BranchCallback falseBranch)
Specified by:
isInstanceOf in interface MethodCompiler

isCaptured

public void isCaptured(int number,
                       BranchCallback trueBranch,
                       BranchCallback falseBranch)
Specified by:
isCaptured in interface MethodCompiler

branchIfModule

public void branchIfModule(CompilerCallback receiverCallback,
                           BranchCallback moduleCallback,
                           BranchCallback notModuleCallback)
Specified by:
branchIfModule in interface MethodCompiler

backref

public void backref()
Description copied from interface: MethodCompiler
Push the current back reference

Specified by:
backref in interface MethodCompiler

backrefMethod

public void backrefMethod(java.lang.String methodName)
Description copied from interface: MethodCompiler
Call a static helper method on RubyRegexp with the current backref

Specified by:
backrefMethod in interface MethodCompiler

issueLoopBreak

public void issueLoopBreak()

issueLoopNext

public void issueLoopNext()

issueLoopRedo

public void issueLoopRedo()

getNewEnsureName

protected java.lang.String getNewEnsureName()

protect

public void protect(BranchCallback regularCode,
                    BranchCallback protectedCode,
                    java.lang.Class ret)
Description copied from interface: MethodCompiler
Makes sure that the code in protectedCode will always run after regularCode.

Specified by:
protect in interface MethodCompiler

getNewRescueName

protected java.lang.String getNewRescueName()

rescue

public void rescue(BranchCallback regularCode,
                   java.lang.Class exception,
                   BranchCallback catchCode,
                   java.lang.Class ret)
Specified by:
rescue in interface MethodCompiler

inDefined

public void inDefined()
Specified by:
inDefined in interface MethodCompiler

outDefined

public void outDefined()
Specified by:
outDefined in interface MethodCompiler

stringOrNil

public void stringOrNil()
Specified by:
stringOrNil in interface MethodCompiler

pushNull

public void pushNull()
Specified by:
pushNull in interface MethodCompiler

pushString

public void pushString(java.lang.String str)
Specified by:
pushString in interface MethodCompiler

isMethodBound

public void isMethodBound(java.lang.String name,
                          BranchCallback trueBranch,
                          BranchCallback falseBranch)
Specified by:
isMethodBound in interface MethodCompiler

hasBlock

public void hasBlock(BranchCallback trueBranch,
                     BranchCallback falseBranch)
Specified by:
hasBlock in interface MethodCompiler

isGlobalDefined

public void isGlobalDefined(java.lang.String name,
                            BranchCallback trueBranch,
                            BranchCallback falseBranch)
Specified by:
isGlobalDefined in interface MethodCompiler

isConstantDefined

public void isConstantDefined(java.lang.String name,
                              BranchCallback trueBranch,
                              BranchCallback falseBranch)
Specified by:
isConstantDefined in interface MethodCompiler

isInstanceVariableDefined

public void isInstanceVariableDefined(java.lang.String name,
                                      BranchCallback trueBranch,
                                      BranchCallback falseBranch)
Specified by:
isInstanceVariableDefined in interface MethodCompiler

isClassVarDefined

public void isClassVarDefined(java.lang.String name,
                              BranchCallback trueBranch,
                              BranchCallback falseBranch)
Specified by:
isClassVarDefined in interface MethodCompiler

getNewEnding

public java.lang.Object getNewEnding()
Specified by:
getNewEnding in interface MethodCompiler

isNil

public void isNil(BranchCallback trueBranch,
                  BranchCallback falseBranch)
Specified by:
isNil in interface MethodCompiler

isNull

public void isNull(BranchCallback trueBranch,
                   BranchCallback falseBranch)
Specified by:
isNull in interface MethodCompiler

ifNull

public void ifNull(java.lang.Object gotoToken)
Specified by:
ifNull in interface MethodCompiler

ifNotNull

public void ifNotNull(java.lang.Object gotoToken)
Specified by:
ifNotNull in interface MethodCompiler

setEnding

public void setEnding(java.lang.Object endingToken)
Specified by:
setEnding in interface MethodCompiler

go

public void go(java.lang.Object gotoToken)
Specified by:
go in interface MethodCompiler

isConstantBranch

public void isConstantBranch(BranchCallback setup,
                             BranchCallback isConstant,
                             BranchCallback isMethod,
                             BranchCallback none,
                             java.lang.String name)
Specified by:
isConstantBranch in interface MethodCompiler

metaclass

public void metaclass()
Specified by:
metaclass in interface MethodCompiler

getVisibilityFor

public void getVisibilityFor(java.lang.String name)
Specified by:
getVisibilityFor in interface MethodCompiler

isPrivate

public void isPrivate(java.lang.Object gotoToken,
                      int toConsume)
Specified by:
isPrivate in interface MethodCompiler

isNotProtected

public void isNotProtected(java.lang.Object gotoToken,
                           int toConsume)
Specified by:
isNotProtected in interface MethodCompiler

selfIsKindOf

public void selfIsKindOf(java.lang.Object gotoToken)
Specified by:
selfIsKindOf in interface MethodCompiler

notIsModuleAndClassVarDefined

public void notIsModuleAndClassVarDefined(java.lang.String name,
                                          java.lang.Object gotoToken)
Specified by:
notIsModuleAndClassVarDefined in interface MethodCompiler

ifSingleton

public void ifSingleton(java.lang.Object gotoToken)
Specified by:
ifSingleton in interface MethodCompiler

getInstanceVariable

public void getInstanceVariable(java.lang.String name)
Specified by:
getInstanceVariable in interface MethodCompiler

getFrameName

public void getFrameName()
Specified by:
getFrameName in interface MethodCompiler

getFrameKlazz

public void getFrameKlazz()
Specified by:
getFrameKlazz in interface MethodCompiler

superClass

public void superClass()
Specified by:
superClass in interface MethodCompiler

attached

public void attached()
Specified by:
attached in interface MethodCompiler

ifNotSuperMethodBound

public void ifNotSuperMethodBound(java.lang.Object token)
Specified by:
ifNotSuperMethodBound in interface MethodCompiler

concatArrays

public void concatArrays()
Specified by:
concatArrays in interface MethodCompiler

concatObjectArrays

public void concatObjectArrays()

appendToArray

public void appendToArray()
Specified by:
appendToArray in interface MethodCompiler

appendToObjectArray

public void appendToObjectArray()
Specified by:
appendToObjectArray in interface MethodCompiler

convertToJavaArray

public void convertToJavaArray()
Specified by:
convertToJavaArray in interface MethodCompiler

aliasGlobal

public void aliasGlobal(java.lang.String newName,
                        java.lang.String oldName)
Specified by:
aliasGlobal in interface MethodCompiler

undefMethod

public void undefMethod(java.lang.String name)
Specified by:
undefMethod in interface MethodCompiler

defineClass

public void defineClass(java.lang.String name,
                        StaticScope staticScope,
                        CompilerCallback superCallback,
                        CompilerCallback pathCallback,
                        CompilerCallback bodyCallback,
                        CompilerCallback receiverCallback)
Specified by:
defineClass in interface MethodCompiler

defineModule

public void defineModule(java.lang.String name,
                         StaticScope staticScope,
                         CompilerCallback pathCallback,
                         CompilerCallback bodyCallback)
Specified by:
defineModule in interface MethodCompiler

unwrapPassedBlock

public void unwrapPassedBlock()
Specified by:
unwrapPassedBlock in interface MethodCompiler

performBackref

public void performBackref(char type)
Specified by:
performBackref in interface MethodCompiler

callZSuper

public void callZSuper(CompilerCallback closure)
Specified by:
callZSuper in interface MethodCompiler

checkIsExceptionHandled

public void checkIsExceptionHandled()
Specified by:
checkIsExceptionHandled in interface MethodCompiler

rethrowException

public void rethrowException()
Specified by:
rethrowException in interface MethodCompiler

loadClass

public void loadClass(java.lang.String name)
Specified by:
loadClass in interface MethodCompiler

unwrapRaiseException

public void unwrapRaiseException()
Specified by:
unwrapRaiseException in interface MethodCompiler

loadException

public void loadException()
Specified by:
loadException in interface MethodCompiler

setFilePosition

public void setFilePosition(ISourcePosition position)
Specified by:
setFilePosition in interface MethodCompiler

setLinePosition

public void setLinePosition(ISourcePosition position)
Specified by:
setLinePosition in interface MethodCompiler

checkWhenWithSplat

public void checkWhenWithSplat()
Specified by:
checkWhenWithSplat in interface MethodCompiler

issueRetryEvent

public void issueRetryEvent()
Specified by:
issueRetryEvent in interface MethodCompiler

defineNewMethod

public void defineNewMethod(java.lang.String name,
                            int methodArity,
                            StaticScope scope,
                            CompilerCallback body,
                            CompilerCallback args,
                            CompilerCallback receiver,
                            ASTInspector inspector,
                            boolean root)
Description copied from interface: MethodCompiler
Define a new method with the given name, arity, local variable count, and body callback. This will create a new compiled method and bind it to the given name at this point in the program's execution.

Specified by:
defineNewMethod in interface MethodCompiler
Parameters:
name - The name to which to bind the resulting method.
body - The callback which will generate the method's body.

rethrowIfSystemExit

public void rethrowIfSystemExit()
Specified by:
rethrowIfSystemExit in interface MethodCompiler


Copyright © 2002-2007 JRuby Team. All Rights Reserved.