|
||||||||||
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)
Arity 0, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
Block block)
Arity 0, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0)
Arity 1, no 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 arg0,
Block block)
Arity 1, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1)
Arity 2, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
Block block)
Arity 2, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2)
Arity 3, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
Block block)
Arity 3, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3)
Arity 4, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
Block block)
Arity 4, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4)
Arity 5, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
Block block)
Arity 5, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5)
Arity 6, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
Block block)
Arity 6, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6)
Arity 7, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
Block block)
Arity 7, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
IRubyObject arg7)
Arity 8, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
IRubyObject arg7,
Block block)
Arity 8, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
IRubyObject arg7,
IRubyObject arg8)
Arity 9, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
IRubyObject arg7,
IRubyObject arg8,
Block block)
Arity 9, with block; calls through IRubyObject[] path |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
IRubyObject arg7,
IRubyObject arg8,
IRubyObject arg9)
Arity 10, no block |
IRubyObject |
call(ThreadContext context,
IRubyObject self,
RubyModule klazz,
java.lang.String name,
IRubyObject arg0,
IRubyObject arg1,
IRubyObject arg2,
IRubyObject arg3,
IRubyObject arg4,
IRubyObject arg5,
IRubyObject arg6,
IRubyObject arg7,
IRubyObject arg8,
IRubyObject arg9,
Block block)
Arity 10, with block; calls through IRubyObject[] path |
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)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, Block block)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, IRubyObject arg9)
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule klazz, java.lang.String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, IRubyObject arg4, IRubyObject arg5, IRubyObject arg6, IRubyObject arg7, IRubyObject arg8, IRubyObject arg9, Block block)
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 |