|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jruby.internal.runtime.methods.DynamicMethod
public abstract class DynamicMethod
DynamicMethod represents a method handle in JRuby, to provide both entry points into AST and bytecode interpreters, but also to provide handles to JIT-compiled and hand-implemented Java methods. All methods invokable from Ruby code are referenced by method handles, either directly or through delegation or callback mechanisms.
Field Summary | |
---|---|
protected CallConfiguration |
callConfig
The "call configuration" to use for pre/post call logic. |
protected RubyModule |
implementationClass
The Ruby module or class in which this method is immediately defined. |
protected RubyModule |
protectedClass
The "protected class" used for calculating protected access. |
protected Visibility |
visibility
The visibility of this method. |
Constructor Summary | |
---|---|
protected |
DynamicMethod()
A no-arg constructor used only by the UndefinedMethod subclass and CompiledMethod handles. |
protected |
DynamicMethod(RubyModule implementationClass,
Visibility visibility,
CallConfiguration callConfig)
Base constructor for dynamic method handles. |
Method Summary | |
---|---|
protected static RubyModule |
calculateProtectedClass(RubyModule cls)
Calculate, based on given RubyModule, which class in its hierarchy should be used to determine protected access. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name)
A default implementation of zero arity, non-block 'call' method, which simply calls the zero-arity, block-receiving version with Block.NULL_BLOCK. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
Block block)
A default implementation of zero arity, block-receiving 'call' method, which simply calls the n-arity, block-receiving version with IRubyObject.NULL_ARRAY. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg)
A default implementation of one-arity, non-block 'call' method, which simply calls the one-arity, block-receiving version with the argument and Block.NULL_BLOCK. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule clazz,
java.lang.String name,
IRubyObject[] args)
A default implementation of n-arity, non-block 'call' method, which simply calls the n-arity, block-receiving version with the arg list and Block.NULL_BLOCK. |
abstract IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule clazz,
java.lang.String name,
IRubyObject[] args,
Block block)
The minimum 'call' method required for a dynamic method handle. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg,
Block block)
A default implementation of one-arity, block-receiving 'call' method, which simply calls the n-arity, block-receiving version with a boxed arg list. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg1,
IRubyObject arg2)
A default implementation of two-arity, non-block 'call' method, which simply calls the two-arity, block-receiving version with the arguments and Block.NULL_BLOCK. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg1,
IRubyObject arg2,
Block block)
A default implementation of two-arity, block-receiving 'call' method, which simply calls the n-arity, block-receiving version with a boxed arg list. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3)
A default implementation of three-arity, non-block 'call' method, which simply calls the three-arity, block-receiving version with the arguments and Block.NULL_BLOCK. |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
Block block)
A default implementation of three-arity, block-receiving 'call' method, which simply calls the n-arity, block-receiving version with a boxed arg list. |
abstract DynamicMethod |
dup()
Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes. |
Arity |
getArity()
Retrieve the arity of this method, used for reporting arity to Ruby code. |
CallConfiguration |
getCallConfig()
Get the CallConfiguration used for pre/post logic for this method handle. |
RubyModule |
getImplementationClass()
Retrieve the class or module on which this method is implemented, used for 'super' logic among others. |
protected RubyModule |
getProtectedClass()
Retrieve the pre-calculated "protected class" used for access checks. |
DynamicMethod |
getRealMethod()
Get the "real" method contained within this method. |
Visibility |
getVisibility()
Get the visibility of this method. |
protected IRubyObject |
handleRedo(Ruby runtime)
|
protected IRubyObject |
handleReturn(ThreadContext context,
JumpException.ReturnJump rj)
|
protected void |
init(RubyModule implementationClass,
Visibility visibility,
CallConfiguration callConfig)
|
boolean |
isCallableFrom(IRubyObject caller,
CallType callType)
Determine whether this method is callable from the given object using the given call type. |
boolean |
isNative()
Returns true if this method is backed by native (i.e. |
boolean |
isUndefined()
Whether this method is the "undefined" method, used to represent a missing or undef'ed method. |
void |
setCallConfig(CallConfiguration callConfig)
Set the CallConfiguration used for pre/post logic for this method handle. |
void |
setImplementationClass(RubyModule implClass)
Set the class on which this method is implemented, used for 'super' logic, among others. |
void |
setVisibility(Visibility visibility)
Set the visibility of this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected RubyModule implementationClass
protected RubyModule protectedClass
protected Visibility visibility
protected CallConfiguration callConfig
Constructor Detail |
---|
protected DynamicMethod(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig)
implementationClass
- The class to which this method will be
immediately boundvisibility
- The visibility assigned to this methodcallConfig
- The CallConfiguration to use for this method's
pre/post invocation logic.protected DynamicMethod()
Method Detail |
---|
protected void init(RubyModule implementationClass, Visibility visibility, CallConfiguration callConfig)
public abstract IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, java.lang.String name, IRubyObject[] args, Block block)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodargs
- The argument list to this invocationblock
- The block passed to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, java.lang.String name, IRubyObject[] args)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg1
- The first argument to this invocationarg2
- The second argument to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg1
- The first argument to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg1, IRubyObject arg2)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg1
- The first argument to this invocationarg2
- The second argument to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg1
- The first argument to this invocationarg2
- The second argument to this invocationarg2
- The third argument to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodblock
- The block passed to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, Block block)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodblock
- The block passed to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg, Block block)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg
- The one argument to this methodblock
- The block passed to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg1, IRubyObject arg2, Block block)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg1
- The first argument to this invocationarg2
- The second argument to this invocationblock
- The block passed to this invocation
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block)
context
- The thread context for the currently executing threadself
- The 'self' or 'receiver' object to use for this callklazz
- The Ruby class against which this method is bindingname
- The incoming name used to invoke this methodarg1
- The first argument to this invocationarg2
- The second argument to this invocationarg2
- The third argument to this invocationblock
- The block passed to this invocation
public abstract DynamicMethod dup()
public boolean isCallableFrom(IRubyObject caller, CallType callType)
caller
- The calling objectcallType
- The type of call
protected static RubyModule calculateProtectedClass(RubyModule cls)
cls
- The class from which to calculate
protected RubyModule getProtectedClass()
public RubyModule getImplementationClass()
public void setImplementationClass(RubyModule implClass)
implClass
- The class on which this method is implementedpublic Visibility getVisibility()
public void setVisibility(Visibility visibility)
visibility
- The visibility of this methodpublic final boolean isUndefined()
public Arity getArity()
public DynamicMethod getRealMethod()
public CallConfiguration getCallConfig()
public void setCallConfig(CallConfiguration callConfig)
callConfig
- The CallConfiguration for this method handlepublic boolean isNative()
protected IRubyObject handleRedo(Ruby runtime) throws RaiseException
RaiseException
protected IRubyObject handleReturn(ThreadContext context, JumpException.ReturnJump rj)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |