public abstract class BaseBodyCompiler extends Object implements BodyCompiler
| Modifier and Type | Field and Description |
|---|---|
protected int |
argParamCount |
protected org.objectweb.asm.Label[] |
currentLoopLabels |
protected boolean |
inNestedMethod |
protected boolean |
inRescue |
protected ASTInspector |
inspector |
protected InvocationCompiler |
invocationCompiler |
protected SkinnyMethodAdapter |
method |
protected String |
methodName |
protected org.objectweb.asm.Label |
redoJump |
protected String |
rubyName |
protected StaticScope |
scope |
protected org.objectweb.asm.Label |
scopeEnd |
protected int |
scopeIndex |
protected org.objectweb.asm.Label |
scopeStart |
protected StandardASMCompiler |
script |
protected VariableCompiler |
variableCompiler |
| Constructor and Description |
|---|
BaseBodyCompiler(StandardASMCompiler scriptCompiler,
String methodName,
String rubyName,
ASTInspector inspector,
StaticScope scope,
int scopeIndex) |
| Modifier and Type | Method and Description |
|---|---|
void |
aliasGlobal(String newName,
String oldName) |
void |
appendByteList(org.jruby.util.ByteList value,
int codeRange,
boolean is19)
Append the given bytelist + coderange to the string currently on the stack.
|
void |
appendObject(boolean is19)
Append the object on stack to the string below it.
|
void |
appendToArray() |
void |
appendToObjectArray() |
void |
aprintln()
For logging, println the object reference currently atop the stack
|
void |
argsCat()
Pass two stack elements, converting the first to an array, to the "argsCat" utility method.
|
void |
argsCatToArguments() |
void |
argsCatToArguments19() |
void |
argsPush()
Pass two stack elements, the first an array, to the "argsPush" utility method.
|
void |
aryToAry() |
void |
assignClassVariable(String name) |
void |
assignClassVariable(String name,
CompilerCallback value) |
void |
assignConstantInCurrent(String name,
CompilerCallback value)
Assign a constant on the class or module currently in scope.
|
void |
assignConstantInModule(String name,
CompilerCallback valueAndModule)
Assign a constant on a specific class or module.
|
void |
assignConstantInObject(String name,
CompilerCallback value)
Assign a constant on the Object class.
|
void |
assignGlobalVariable(String name)
Assign the top of the stack to the global variable with the specified name.
|
void |
assignGlobalVariable(String name,
CompilerCallback value)
Assign the top of the stack to the global variable with the specified name.
|
void |
assignInstanceVariable(String name)
Assign the value on top of the stack to the instance variable with the specified name
on the current "self".
|
void |
assignInstanceVariable(String name,
CompilerCallback value)
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(String methodName)
Call a static helper method on RubyRegexp with the current backref
|
void |
beginChainedMethod() |
abstract void |
beginMethod(CompilerCallback args,
StaticScope scope) |
void |
buildNewString(ArrayCallback callback,
int count,
org.jcodings.Encoding encoding)
Build a string using the given callback.
|
void |
callZSuper(CompilerCallback closure) |
BodyCompiler |
chainToMethod(String methodName) |
void |
checkIsExceptionHandled(ArgumentsCallback rescueArgs) |
void |
checkWhenWithSplat() |
void |
clearErrorInfo() |
void |
compileSequencedConditional(CompilerCallback inputValue,
FastSwitchType fastSwitchType,
Map<CompilerCallback,int[]> switchCases,
List<ArgumentsCallback> conditionals,
List<CompilerCallback> bodies,
CompilerCallback fallback) |
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 |
createDRegexp19(ArrayCallback arrayCallback,
Object[] sourceArray,
int options) |
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 |
createNewArray(Object[] sourceArray,
ArrayCallback callback,
boolean lightweight)
Construct a Ruby array given an array of objects to feed to an ArrayCallback
to construct the elements of the array.
|
void |
createNewBignum(BigInteger value)
Generate a new "Bignum" value.
|
void |
createNewClosure(String file,
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 |
createNewClosure19(String file,
int line,
StaticScope scope,
int arity,
CompilerCallback body,
CompilerCallback args,
boolean hasMultipleArgsHead,
NodeType argsNodeId,
String parameterList,
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,
ASTInspector inspector)
Create a new closure (block) for a for loop with the given call arity and
body generated by the body callback.
|
void |
createNewHash(Object elements,
ArrayCallback callback,
int keyCount)
Create a new hash by calling back to the specified ArrayCallback.
|
void |
createNewHash19(Object elements,
ArrayCallback callback,
int keyCount) |
void |
createNewLambda(CompilerCallback closure)
Create a new literal lambda.
|
void |
createNewLiteralArray(Object[] sourceArray,
ArrayCallback callback,
boolean lightweight)
Construct a Ruby array given an array of objects to feed to an ArrayCallback
to construct the elements of the array.
|
void |
createNewLiteralHash(Object elements,
ArrayCallback callback,
int keyCount)
Create a new hash by calling back to the specified ArrayCallback.
|
void |
createNewRange(CompilerCallback beginEndCallback,
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,
org.jcodings.Encoding encoding)
Generate a new dynamic "String" value.
|
void |
createNewString(org.jruby.util.ByteList value,
int codeRange)
Generate a new "String" value.
|
void |
createNewSymbol(ArrayCallback callback,
int count,
org.jcodings.Encoding encoding) |
void |
createNewSymbol(String name)
Generate a new "Symbol" value (or fetch the existing one).
|
void |
createObjectArray(Object[] sourceArray,
ArrayCallback callback) |
protected abstract void |
createVariableCompiler() |
void |
declareClassVariable(String name) |
void |
declareClassVariable(String name,
CompilerCallback value) |
void |
defineAlias(CompilerCallback args)
Define an alias for a new name to an existing oldName'd method.
|
void |
defineClass(String name,
StaticScope staticScope,
CompilerCallback superCallback,
CompilerCallback pathCallback,
CompilerCallback bodyCallback,
CompilerCallback receiverCallback,
ASTInspector inspector) |
void |
definedCall(String name)
Check defined?() for a Call
|
void |
definedNot()
Check defined?() for a Not.
|
void |
defineModule(String name,
StaticScope staticScope,
CompilerCallback pathCallback,
CompilerCallback bodyCallback,
ASTInspector inspector) |
void |
defineNewMethod(String name,
int methodArity,
StaticScope scope,
CompilerCallback body,
CompilerCallback args,
CompilerCallback receiver,
ASTInspector inspector,
boolean root,
String filename,
int line,
String parameterDesc)
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 |
endBody()
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,
Object source,
ArrayCallback callback,
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 |
forEachInValueArray(int start,
int preCount,
Object preSource,
int postCount,
Object postSource,
ArrayCallback callback,
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'.
|
protected int |
getActualArgsCount(StaticScope scope) |
protected int |
getClosureIndex() |
void |
getCompiledClass() |
protected int |
getDynamicScopeIndex() |
protected int |
getExceptionIndex() |
protected int |
getFirstTempIndex() |
void |
getFrameKlazz() |
void |
getFrameName() |
void |
getInstanceVariable(String name) |
InvocationCompiler |
getInvocationCompiler() |
int |
getLastLine() |
String |
getNativeMethodName() |
Object |
getNewEnding() |
protected String |
getNewEnsureName() |
protected String |
getNewRescueName() |
protected int |
getPreviousExceptionIndex() |
String |
getRubyName() |
int |
getScopeIndex() |
StandardASMCompiler |
getScriptCompiler() |
protected abstract String |
getSignature() |
VariableCompiler |
getVariableCompiler() |
protected int |
getVarsArrayIndex() |
void |
getVisibilityFor(String name) |
void |
go(Object gotoToken) |
void |
hasBlock(BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
ifNotNull(Object gotoToken) |
void |
ifNotSuperMethodBound(Object token) |
void |
ifNull(Object gotoToken) |
void |
ifSingleton(Object gotoToken) |
void |
invokeIRubyObject(String methodName,
String signature) |
void |
invokeRuby(String methodName,
String signature) |
void |
invokeThreadContext(String methodName,
String signature) |
void |
invokeUtilityMethod(String methodName,
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(String name,
BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
isConstantBranch(BranchCallback setup,
String name) |
void |
isConstantDefined(String name) |
void |
isGlobalDefined(String name,
BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
isInstanceOf(Class clazz,
BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
isInstanceVariableDefined(String name) |
void |
isMethodBound(String name,
BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
isNil(BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
isNotProtected(Object gotoToken,
int toConsume) |
void |
isNull(BranchCallback trueBranch,
BranchCallback falseBranch) |
void |
isPrivate(Object gotoToken,
int toConsume) |
void |
issueLoopBreak() |
void |
issueLoopNext() |
void |
issueLoopRedo() |
void |
issueRetryEvent() |
void |
isTrue()
Invoke IRubyObject.isTrue
|
void |
lineNumber(ISourcePosition position)
This method provides a way to specify a line number for the current piece of code
being compiled.
|
void |
literal(String value) |
void |
literalSwitch(int[] cases,
Object[] bodies,
ArrayCallback arrayCallback,
CompilerCallback defaultCallback) |
void |
loadBlock() |
void |
loadClass(String name) |
void |
loadCurrentModule() |
void |
loadEncoding(org.jcodings.Encoding encoding)
Load the specified encoding.
|
void |
loadException() |
void |
loadFalse()
Load a Ruby "false" value on top of the stack.
|
void |
loadFilename() |
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 |
loadStandardError() |
protected void |
loadStaticScope() |
void |
loadThis() |
void |
loadThreadContext() |
void |
loadTrue()
Load a Ruby "true" value on top of the stack.
|
void |
mAssignConstantInCurrent(String name)
Assign a constant on the class or module currently in scope.
|
void |
mAssignConstantInModule(String name)
Assign a constant on a specific class or module.
|
void |
mAssignConstantInObject(String name)
Assign a constant on the Object class.
|
void |
match(boolean is19) |
void |
match2(CompilerCallback value,
boolean is19) |
void |
match2Capture(CompilerCallback value,
int[] scopeOffsets,
boolean is19) |
void |
match3(boolean is19) |
void |
metaclass() |
void |
negateCurrentValue()
Perform a logical Ruby "not" operation on the value on top of the stack, leaving the
negated result.
|
void |
notIsModuleAndClassVarDefined(String name,
Object gotoToken) |
void |
nthRef(int match) |
void |
nullToNil() |
abstract BaseBodyCompiler |
outline(String methodName) |
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 |
performBooleanBranch2(BranchCallback trueBranch,
BranchCallback falseBranch)
Perform a boolean branch operation based on the boolean top value
on the stack.
|
void |
performBooleanConstantBranch(String globalName,
BranchCallback trueBranch,
BranchCallback falseBranch)
Perform a boolean branch operation based on the boolean constant value
on the stack.
|
void |
performBooleanGlobalBranch(String globalName,
BranchCallback trueBranch,
BranchCallback falseBranch)
Perform a boolean branch operation based on the boolean global 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 |
performBooleanLoopLight(BranchCallback condition,
BranchCallback body,
boolean checkFirst)
Perform a boolean loop using the given condition-calculating branch and body branch.
|
void |
performBooleanLoopSafe(BranchCallback condition,
BranchCallback body,
boolean checkFirst)
Perform a boolean loop using the given condition-calculating branch and body branch.
|
void |
performEnsure(BranchCallback regularCode,
BranchCallback protectedCode) |
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 |
performRescue(BranchCallback regularCode,
BranchCallback rubyCatchCode,
BranchCallback rubyElseCode,
boolean needsRetry) |
void |
performRescueInternal(BranchCallback regularCode,
BranchCallback rubyCatchCode,
BranchCallback rubyElseCode,
boolean needsRetry,
boolean light) |
void |
performRescueLight(BranchCallback regularCode,
BranchCallback rubyCatchCode,
BranchCallback rubyElseCode,
boolean needsRetry) |
void |
pollThreadEvents() |
void |
preMultiAssign(int head,
boolean args) |
void |
println() |
void |
protect(BranchCallback regularCode,
BranchCallback protectedCode,
Class ret)
Makes sure that the code in protectedCode will always run after regularCode.
|
void |
pushByteList(org.jruby.util.ByteList byteList) |
void |
pushDefinedMessage(DefinedMessage definedMessage) |
void |
pushNull() |
void |
pushString(String str) |
void |
raiseTypeError(String msg) |
void |
rescue(BranchCallback regularCode,
Class exception,
BranchCallback catchCode,
Class ret) |
void |
rethrowException() |
void |
rethrowIfSystemExit() |
void |
retrieveClassVariable(String name) |
void |
retrieveConstant(String name)
Retrieve the constant with the specified name available at the current point in the
program's execution.
|
void |
retrieveConstantFromModule(String name)
Retreive a named constant from the RubyModule/RubyClass that's just been pushed.
|
void |
retrieveConstantFromObject(String name)
Retreive a named constant from the RubyModule/RubyClass that's just been pushed.
|
void |
retrieveGlobalVariable(String name)
Retrieve the global variable with the specified name to the top of the stack.
|
void |
retrieveInstanceVariable(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 |
reverseValues(int count)
Reverse the top n values on the stack.
|
void |
runBeginBlock(StaticScope scope,
CompilerCallback body) |
void |
selfIsKindOf(Object gotoToken) |
void |
setEnding(Object endingToken) |
void |
setFilePosition(ISourcePosition position) |
void |
setLinePosition(ISourcePosition position) |
void |
shortcutAppend(boolean is19)
A "shortcut" append that skips conversions to String where possible.
|
protected boolean |
shouldUseBoxedArgs(StaticScope scope) |
void |
singlifySplattedValue()
Given a splatted value, extract a single value.
|
void |
singlifySplattedValue19()
1.9 version of singlifySplattedValue.
|
void |
splatCurrentValue(String methodName)
Convert the current value into a "splatted value" suitable for passing as
method arguments or disassembling into multiple variables.
|
void |
splatToArguments() |
void |
splatToArguments19() |
void |
storeExceptionInErrorInfo()
Store the current live exception object in the $! thread-global.
|
void |
storeNativeExceptionInErrorInfo()
Store the current exception in $!, wrapping in NativeException if necessary.
|
void |
stringOrNil() |
void |
stringToSymbol(boolean is19)
Convert a String on stack to a Symbol
|
void |
superClass() |
void |
swapValues()
Swap the top and second values on the stack.
|
void |
toJavaString() |
void |
traceClass() |
void |
traceEnd() |
void |
traceLine() |
void |
typeCheckBranch(Class type,
BranchCallback trueCallback,
BranchCallback falseCallback) |
void |
undefMethod(CompilerCallback nameArg) |
void |
unwrapPassedBlock() |
void |
unwrapRaiseException() |
void |
wrapJavaException() |
void |
wrapJavaObject() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisSimpleRoot, issueBreakEvent, issueNextEvent, issueRedoEvent, performReturnprotected SkinnyMethodAdapter method
protected VariableCompiler variableCompiler
protected InvocationCompiler invocationCompiler
protected int argParamCount
protected org.objectweb.asm.Label[] currentLoopLabels
protected org.objectweb.asm.Label scopeStart
protected org.objectweb.asm.Label scopeEnd
protected org.objectweb.asm.Label redoJump
protected boolean inNestedMethod
protected boolean inRescue
protected StaticScope scope
protected ASTInspector inspector
protected String methodName
protected String rubyName
protected StandardASMCompiler script
protected int scopeIndex
public BaseBodyCompiler(StandardASMCompiler scriptCompiler, String methodName, String rubyName, ASTInspector inspector, StaticScope scope, int scopeIndex)
public String getNativeMethodName()
getNativeMethodName in interface BodyCompilerpublic String getRubyName()
protected boolean shouldUseBoxedArgs(StaticScope scope)
protected int getActualArgsCount(StaticScope scope)
protected abstract String getSignature()
protected abstract void createVariableCompiler()
public abstract void beginMethod(CompilerCallback args, StaticScope scope)
public abstract void endBody()
BodyCompilerendBody in interface BodyCompilerpublic BodyCompiler chainToMethod(String methodName)
chainToMethod in interface BodyCompilerpublic void beginChainedMethod()
public abstract BaseBodyCompiler outline(String methodName)
outline in interface BodyCompilerpublic StandardASMCompiler getScriptCompiler()
public void lineNumber(ISourcePosition position)
BodyCompilerlineNumber in interface BodyCompilerposition - The ISourcePosition information to use.public int getLastLine()
public void loadThreadContext()
public void loadSelf()
loadSelf in interface BodyCompilerprotected int getClosureIndex()
protected int getPreviousExceptionIndex()
protected int getDynamicScopeIndex()
protected int getVarsArrayIndex()
protected int getFirstTempIndex()
protected int getExceptionIndex()
protected void loadStaticScope()
public void loadThis()
public void loadRuntime()
public void loadBlock()
public void loadNil()
BodyCompilerloadNil in interface BodyCompilerpublic void loadNull()
loadNull in interface BodyCompilerpublic void loadObject()
BodyCompilerloadObject in interface BodyCompilerpublic void invokeUtilityMethod(String methodName, String signature)
public void consumeCurrentValue()
BodyCompilerconsumeCurrentValue in interface BodyCompilerpublic void duplicateCurrentValue()
BodyCompilerduplicateCurrentValue in interface BodyCompilerpublic void swapValues()
BodyCompilerswapValues in interface BodyCompilerpublic void reverseValues(int count)
BodyCompilerreverseValues in interface BodyCompilercount - The number of values to reverse.public void retrieveSelf()
BodyCompilerretrieveSelf in interface BodyCompilerpublic void retrieveSelfClass()
BodyCompilerretrieveSelfClass in interface BodyCompilerpublic VariableCompiler getVariableCompiler()
getVariableCompiler in interface BodyCompilerpublic InvocationCompiler getInvocationCompiler()
getInvocationCompiler in interface BodyCompilerpublic void assignConstantInCurrent(String name, CompilerCallback value)
BodyCompilerassignConstantInCurrent in interface BodyCompilername - name of the constantvalue - callback to load the valuepublic void assignConstantInModule(String name, CompilerCallback valueAndModule)
BodyCompilerassignConstantInModule in interface BodyCompilername - name of the constantvalueAndModule - callback to load the class/module and valuepublic void assignConstantInObject(String name, CompilerCallback value)
BodyCompilerassignConstantInObject in interface BodyCompilername - name of the constantvalue - callback to load the valuepublic void mAssignConstantInCurrent(String name)
BodyCompilermAssignConstantInCurrent in interface BodyCompilername - name of the constantpublic void mAssignConstantInModule(String name)
BodyCompilermAssignConstantInModule in interface BodyCompilername - name of the constantpublic void mAssignConstantInObject(String name)
BodyCompilermAssignConstantInObject in interface BodyCompilername - name of the constantpublic void retrieveConstant(String name)
BodyCompilerretrieveConstant in interface BodyCompilername - The name of the constantpublic void retrieveConstantFromModule(String name)
BodyCompilerretrieveConstantFromModule in interface BodyCompilername - The name of the constantpublic void retrieveConstantFromObject(String name)
BodyCompilerretrieveConstantFromObject in interface BodyCompilername - The name of the constantpublic void retrieveClassVariable(String name)
retrieveClassVariable in interface BodyCompilerpublic void assignClassVariable(String name)
assignClassVariable in interface BodyCompilerpublic void assignClassVariable(String name, CompilerCallback value)
assignClassVariable in interface BodyCompilerpublic void declareClassVariable(String name)
declareClassVariable in interface BodyCompilerpublic void declareClassVariable(String name, CompilerCallback value)
declareClassVariable in interface BodyCompilerpublic void createNewFloat(double value)
BodyCompilercreateNewFloat in interface BodyCompilerpublic void createNewFixnum(long value)
BodyCompilercreateNewFixnum in interface BodyCompilerpublic void createNewBignum(BigInteger value)
BodyCompilercreateNewBignum in interface BodyCompilerpublic void createNewString(ArrayCallback callback, int count, org.jcodings.Encoding encoding)
BodyCompilercreateNewString in interface BodyCompilerpublic void buildNewString(ArrayCallback callback, int count, org.jcodings.Encoding encoding)
BodyCompilerbuildNewString in interface BodyCompilerpublic void appendByteList(org.jruby.util.ByteList value,
int codeRange,
boolean is19)
BodyCompilerappendByteList in interface BodyCompilerpublic void appendObject(boolean is19)
BodyCompilerappendObject in interface BodyCompilerpublic void shortcutAppend(boolean is19)
BodyCompilershortcutAppend in interface BodyCompilerpublic void stringToSymbol(boolean is19)
BodyCompilerstringToSymbol in interface BodyCompilerpublic void createNewSymbol(ArrayCallback callback, int count, org.jcodings.Encoding encoding)
createNewSymbol in interface BodyCompilerpublic void createNewString(org.jruby.util.ByteList value,
int codeRange)
BodyCompilercreateNewString in interface BodyCompilerpublic void createNewSymbol(String name)
BodyCompilercreateNewSymbol in interface BodyCompilerpublic void createNewArray(boolean lightweight)
BodyCompilercreateNewArray in interface BodyCompilerpublic void createNewArray(Object[] sourceArray, ArrayCallback callback, boolean lightweight)
BodyCompilercreateNewArray in interface BodyCompilersourceArray - The objects that will be used to construct elementscallback - The callback to which to pass the objectslightweight - Whether the array should be lightweightpublic void createNewLiteralArray(Object[] sourceArray, ArrayCallback callback, boolean lightweight)
BodyCompilercreateNewLiteralArray in interface BodyCompilersourceArray - The objects that will be used to construct elementscallback - The callback to which to pass the objectslightweight - Whether the array should be lightweightpublic void createEmptyArray()
BodyCompilercreateEmptyArray in interface BodyCompilerpublic void createObjectArray(Object[] sourceArray, ArrayCallback callback)
createObjectArray in interface BodyCompilerpublic void createEmptyHash()
BodyCompilercreateEmptyHash in interface BodyCompilerpublic void createNewHash(Object elements, ArrayCallback callback, int keyCount)
BodyCompilercreateNewHash in interface BodyCompilerelements - 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.public void createNewLiteralHash(Object elements, ArrayCallback callback, int keyCount)
BodyCompilercreateNewLiteralHash in interface BodyCompilerelements - 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.public void createNewHash19(Object elements, ArrayCallback callback, int keyCount)
createNewHash19 in interface BodyCompilerCreate new hash running in ruby 1.9 compat version.public void createNewRange(CompilerCallback beginEndCallback, boolean isExclusive)
BodyCompilercreateNewRange in interface BodyCompilerisExclusive - Whether the range is exclusive or not (inclusive)public void createNewLambda(CompilerCallback closure)
BodyCompilercreateNewLambda in interface BodyCompilerpublic void isTrue()
isTrue in interface BodyCompilerpublic void performBooleanBranch(BranchCallback trueBranch, BranchCallback falseBranch)
BodyCompilerperformBooleanBranch in interface BodyCompilertrueBranch - The callback for generating code for the "true" conditionfalseBranch - The callback for generating code for the "false" conditionpublic void performBooleanBranch2(BranchCallback trueBranch, BranchCallback falseBranch)
BodyCompilerperformBooleanBranch2 in interface BodyCompilertrueBranch - The callback for generating code for the "true" conditionfalseBranch - The callback for generating code for the "false" conditionpublic void performBooleanGlobalBranch(String globalName, BranchCallback trueBranch, BranchCallback falseBranch)
BodyCompilerperformBooleanGlobalBranch in interface BodyCompilertrueBranch - The callback for generating code for the "true" conditionfalseBranch - The callback for generating code for the "false" conditionpublic void performBooleanConstantBranch(String globalName, BranchCallback trueBranch, BranchCallback falseBranch)
BodyCompilerperformBooleanConstantBranch in interface BodyCompilertrueBranch - The callback for generating code for the "true" conditionfalseBranch - The callback for generating code for the "false" conditionpublic void performLogicalAnd(BranchCallback longBranch)
BodyCompilerperformLogicalAnd in interface BodyCompilerlongBranch - The branch to execute if the "and" operation does not short-circuit.public void performLogicalOr(BranchCallback longBranch)
BodyCompilerperformLogicalOr in interface BodyCompilerlongBranch - The branch to execute if the "or" operation does not short-circuit.public void performBooleanLoopSafe(BranchCallback condition, BranchCallback body, boolean checkFirst)
BodyCompilerperformBooleanLoopSafe in interface BodyCompilercondition - 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.public void performBooleanLoop(BranchCallback condition, BranchCallback body, boolean checkFirst)
BodyCompilerperformBooleanLoop in interface BodyCompilercondition - 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.public void performBooleanLoopLight(BranchCallback condition, BranchCallback body, boolean checkFirst)
BodyCompilerperformBooleanLoopLight in interface BodyCompilercondition - 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.public void createNewClosure(String file, int line, StaticScope scope, int arity, CompilerCallback body, CompilerCallback args, boolean hasMultipleArgsHead, NodeType argsNodeId, ASTInspector inspector)
BodyCompilercreateNewClosure in interface BodyCompilerpublic void createNewClosure19(String file, int line, StaticScope scope, int arity, CompilerCallback body, CompilerCallback args, boolean hasMultipleArgsHead, NodeType argsNodeId, String parameterList, ASTInspector inspector)
BodyCompilercreateNewClosure19 in interface BodyCompilerpublic void runBeginBlock(StaticScope scope, CompilerCallback body)
runBeginBlock in interface BodyCompilerpublic void createNewForLoop(int arity,
CompilerCallback body,
CompilerCallback args,
boolean hasMultipleArgsHead,
NodeType argsNodeId,
ASTInspector inspector)
BodyCompilercreateNewForLoop in interface BodyCompilerpublic void createNewEndBlock(CompilerCallback body)
createNewEndBlock in interface BodyCompilerpublic void getCompiledClass()
public void println()
public void defineAlias(CompilerCallback args)
BodyCompilerdefineAlias in interface BodyCompilerpublic void literal(String value)
literal in interface BodyCompilerpublic void loadFalse()
BodyCompilerloadFalse in interface BodyCompilerpublic void loadTrue()
BodyCompilerloadTrue in interface BodyCompilerpublic void loadCurrentModule()
loadCurrentModule in interface BodyCompilerpublic void retrieveInstanceVariable(String name)
BodyCompilerretrieveInstanceVariable in interface BodyCompilername - The name of the instance variable to retrieve.public void assignInstanceVariable(String name)
BodyCompilerassignInstanceVariable in interface BodyCompilername - The name of the value to assign.public void assignInstanceVariable(String name, CompilerCallback value)
BodyCompilerassignInstanceVariable in interface BodyCompilername - The name of the value to assign.value - A callback for compiling the value to assignpublic void retrieveGlobalVariable(String name)
BodyCompilerretrieveGlobalVariable in interface BodyCompilername - The name of the global variable.public void assignGlobalVariable(String name)
BodyCompilerassignGlobalVariable in interface BodyCompilername - The name of the global variable.public void assignGlobalVariable(String name, CompilerCallback value)
BodyCompilerassignGlobalVariable in interface BodyCompilername - The name of the global variable.value - The callback to compile the value to assignpublic void negateCurrentValue()
BodyCompilernegateCurrentValue in interface BodyCompilerpublic void splatCurrentValue(String methodName)
BodyCompilersplatCurrentValue in interface BodyCompilerpublic void singlifySplattedValue()
BodyCompilersinglifySplattedValue in interface BodyCompilerpublic void singlifySplattedValue19()
BodyCompilersinglifySplattedValue19 in interface BodyCompilerpublic void aryToAry()
aryToAry in interface BodyCompilerpublic void ensureRubyArray()
BodyCompilerensureRubyArray in interface BodyCompilerpublic void ensureMultipleAssignableRubyArray(boolean masgnHasHead)
BodyCompilerensureMultipleAssignableRubyArray in interface BodyCompilerpublic void forEachInValueArray(int start,
int count,
Object source,
ArrayCallback callback,
CompilerCallback argsCallback)
BodyCompilerforEachInValueArray in interface BodyCompilerpublic void forEachInValueArray(int start,
int preCount,
Object preSource,
int postCount,
Object postSource,
ArrayCallback callback,
CompilerCallback argsCallback)
BodyCompilerforEachInValueArray in interface BodyCompilerpublic void asString()
asString in interface BodyCompilerpublic void toJavaString()
toJavaString in interface BodyCompilerpublic void nthRef(int match)
nthRef in interface BodyCompilerpublic void match(boolean is19)
match in interface BodyCompilerpublic void match2(CompilerCallback value, boolean is19)
match2 in interface BodyCompilerpublic void match2Capture(CompilerCallback value, int[] scopeOffsets, boolean is19)
match2Capture in interface BodyCompilerpublic void match3(boolean is19)
match3 in interface BodyCompilerpublic void createNewRegexp(org.jruby.util.ByteList value,
int options)
createNewRegexp in interface BodyCompilerpublic void createNewRegexp(CompilerCallback createStringCallback, int options)
createNewRegexp in interface BodyCompilerpublic void createDRegexp19(ArrayCallback arrayCallback, Object[] sourceArray, int options)
createDRegexp19 in interface BodyCompilerpublic void pollThreadEvents()
pollThreadEvents in interface BodyCompilerpublic void nullToNil()
nullToNil in interface BodyCompilerpublic void isInstanceOf(Class clazz, BranchCallback trueBranch, BranchCallback falseBranch)
isInstanceOf in interface BodyCompilerpublic void isCaptured(int number,
BranchCallback trueBranch,
BranchCallback falseBranch)
isCaptured in interface BodyCompilerpublic void backref()
BodyCompilerbackref in interface BodyCompilerpublic void backrefMethod(String methodName)
BodyCompilerbackrefMethod in interface BodyCompilerpublic void issueLoopBreak()
public void issueLoopNext()
public void issueLoopRedo()
protected String getNewEnsureName()
public void protect(BranchCallback regularCode, BranchCallback protectedCode, Class ret)
BodyCompilerprotect in interface BodyCompilerpublic void performEnsure(BranchCallback regularCode, BranchCallback protectedCode)
performEnsure in interface BodyCompilerprotected String getNewRescueName()
public void storeExceptionInErrorInfo()
BodyCompilerstoreExceptionInErrorInfo in interface BodyCompilerpublic void storeNativeExceptionInErrorInfo()
BodyCompilerstoreNativeExceptionInErrorInfo in interface BodyCompilerpublic void clearErrorInfo()
clearErrorInfo in interface BodyCompilerpublic void rescue(BranchCallback regularCode, Class exception, BranchCallback catchCode, Class ret)
rescue in interface BodyCompilerpublic void performRescue(BranchCallback regularCode, BranchCallback rubyCatchCode, BranchCallback rubyElseCode, boolean needsRetry)
performRescue in interface BodyCompilerpublic void performRescueLight(BranchCallback regularCode, BranchCallback rubyCatchCode, BranchCallback rubyElseCode, boolean needsRetry)
performRescueLight in interface BodyCompilerpublic void performRescueInternal(BranchCallback regularCode, BranchCallback rubyCatchCode, BranchCallback rubyElseCode, boolean needsRetry, boolean light)
public void wrapJavaException()
wrapJavaException in interface BodyCompilerpublic void wrapJavaObject()
public void stringOrNil()
stringOrNil in interface BodyCompilerpublic void pushNull()
pushNull in interface BodyCompilerpublic void pushString(String str)
pushString in interface BodyCompilerpublic void pushByteList(org.jruby.util.ByteList byteList)
pushByteList in interface BodyCompilerpublic void pushDefinedMessage(DefinedMessage definedMessage)
pushDefinedMessage in interface BodyCompilerpublic void isMethodBound(String name, BranchCallback trueBranch, BranchCallback falseBranch)
isMethodBound in interface BodyCompilerpublic void hasBlock(BranchCallback trueBranch, BranchCallback falseBranch)
hasBlock in interface BodyCompilerpublic void isGlobalDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch)
isGlobalDefined in interface BodyCompilerpublic void isConstantDefined(String name)
isConstantDefined in interface BodyCompilerpublic void isInstanceVariableDefined(String name)
isInstanceVariableDefined in interface BodyCompilerpublic void isClassVarDefined(String name, BranchCallback trueBranch, BranchCallback falseBranch)
isClassVarDefined in interface BodyCompilerpublic Object getNewEnding()
getNewEnding in interface BodyCompilerpublic void isNil(BranchCallback trueBranch, BranchCallback falseBranch)
isNil in interface BodyCompilerpublic void isNull(BranchCallback trueBranch, BranchCallback falseBranch)
isNull in interface BodyCompilerpublic void ifNull(Object gotoToken)
ifNull in interface BodyCompilerpublic void ifNotNull(Object gotoToken)
ifNotNull in interface BodyCompilerpublic void setEnding(Object endingToken)
setEnding in interface BodyCompilerpublic void go(Object gotoToken)
go in interface BodyCompilerpublic void isConstantBranch(BranchCallback setup, String name)
isConstantBranch in interface BodyCompilerpublic void metaclass()
metaclass in interface BodyCompilerpublic void aprintln()
BodyCompileraprintln in interface BodyCompilerpublic void getVisibilityFor(String name)
getVisibilityFor in interface BodyCompilerpublic void isPrivate(Object gotoToken, int toConsume)
isPrivate in interface BodyCompilerpublic void isNotProtected(Object gotoToken, int toConsume)
isNotProtected in interface BodyCompilerpublic void selfIsKindOf(Object gotoToken)
selfIsKindOf in interface BodyCompilerpublic void notIsModuleAndClassVarDefined(String name, Object gotoToken)
notIsModuleAndClassVarDefined in interface BodyCompilerpublic void ifSingleton(Object gotoToken)
ifSingleton in interface BodyCompilerpublic void getInstanceVariable(String name)
getInstanceVariable in interface BodyCompilerpublic void getFrameName()
getFrameName in interface BodyCompilerpublic void getFrameKlazz()
getFrameKlazz in interface BodyCompilerpublic void superClass()
superClass in interface BodyCompilerpublic void attached()
attached in interface BodyCompilerpublic void ifNotSuperMethodBound(Object token)
ifNotSuperMethodBound in interface BodyCompilerpublic void concatArrays()
concatArrays in interface BodyCompilerpublic void concatObjectArrays()
public void appendToArray()
appendToArray in interface BodyCompilerpublic void appendToObjectArray()
appendToObjectArray in interface BodyCompilerpublic void splatToArguments()
splatToArguments in interface BodyCompilerpublic void splatToArguments19()
splatToArguments19 in interface BodyCompilerpublic void argsCatToArguments()
argsCatToArguments in interface BodyCompilerpublic void argsCatToArguments19()
argsCatToArguments19 in interface BodyCompilerpublic void convertToJavaArray()
convertToJavaArray in interface BodyCompilerpublic void aliasGlobal(String newName, String oldName)
aliasGlobal in interface BodyCompilerpublic void raiseTypeError(String msg)
raiseTypeError in interface BodyCompilerpublic void undefMethod(CompilerCallback nameArg)
undefMethod in interface BodyCompilerpublic void defineClass(String name, StaticScope staticScope, CompilerCallback superCallback, CompilerCallback pathCallback, CompilerCallback bodyCallback, CompilerCallback receiverCallback, ASTInspector inspector)
defineClass in interface BodyCompilerpublic void defineModule(String name, StaticScope staticScope, CompilerCallback pathCallback, CompilerCallback bodyCallback, ASTInspector inspector)
defineModule in interface BodyCompilerpublic void unwrapPassedBlock()
unwrapPassedBlock in interface BodyCompilerpublic void performBackref(char type)
performBackref in interface BodyCompilerpublic void callZSuper(CompilerCallback closure)
callZSuper in interface BodyCompilerpublic void checkIsExceptionHandled(ArgumentsCallback rescueArgs)
checkIsExceptionHandled in interface BodyCompilerpublic void rethrowException()
rethrowException in interface BodyCompilerpublic void loadClass(String name)
loadClass in interface BodyCompilerpublic void loadStandardError()
loadStandardError in interface BodyCompilerpublic void unwrapRaiseException()
unwrapRaiseException in interface BodyCompilerpublic void loadException()
loadException in interface BodyCompilerpublic void setFilePosition(ISourcePosition position)
setFilePosition in interface BodyCompilerpublic void setLinePosition(ISourcePosition position)
setLinePosition in interface BodyCompilerpublic void checkWhenWithSplat()
checkWhenWithSplat in interface BodyCompilerpublic void issueRetryEvent()
issueRetryEvent in interface BodyCompilerpublic void defineNewMethod(String name, int methodArity, StaticScope scope, CompilerCallback body, CompilerCallback args, CompilerCallback receiver, ASTInspector inspector, boolean root, String filename, int line, String parameterDesc)
BodyCompilerdefineNewMethod in interface BodyCompilerpublic void rethrowIfSystemExit()
rethrowIfSystemExit in interface BodyCompilerpublic void literalSwitch(int[] cases,
Object[] bodies,
ArrayCallback arrayCallback,
CompilerCallback defaultCallback)
literalSwitch in interface BodyCompilerpublic void typeCheckBranch(Class type, BranchCallback trueCallback, BranchCallback falseCallback)
typeCheckBranch in interface BodyCompilerpublic void loadFilename()
loadFilename in interface BodyCompilerpublic void compileSequencedConditional(CompilerCallback inputValue, FastSwitchType fastSwitchType, Map<CompilerCallback,int[]> switchCases, List<ArgumentsCallback> conditionals, List<CompilerCallback> bodies, CompilerCallback fallback)
compileSequencedConditional in interface BodyCompilerpublic void traceLine()
traceLine in interface BodyCompilerpublic void traceClass()
traceClass in interface BodyCompilerpublic void traceEnd()
traceEnd in interface BodyCompilerpublic void preMultiAssign(int head,
boolean args)
preMultiAssign in interface BodyCompilerpublic void argsPush()
BodyCompilerargsPush in interface BodyCompilerpublic void argsCat()
BodyCompilerargsCat in interface BodyCompilerpublic void loadEncoding(org.jcodings.Encoding encoding)
BodyCompilerloadEncoding in interface BodyCompilerpublic void definedCall(String name)
BodyCompilerdefinedCall in interface BodyCompilerpublic void definedNot()
BodyCompilerdefinedNot in interface BodyCompilerpublic int getScopeIndex()
Copyright © 2001-2013 JRuby. All Rights Reserved.