Save This Page
Home » jruby-src-1.1.3 » org.jruby.internal.runtime.methods » [javadoc | source]
org.jruby.internal.runtime.methods
abstract public class: DynamicMethod [javadoc | source]
java.lang.Object
   org.jruby.internal.runtime.methods.DynamicMethod

Direct Known Subclasses:
    JavaMethodZero, MethodMethod, JavaMethodZeroOrOneOrTwoOrThree, JavaMethodTwo, JavaMethodZeroOrOneOrTwoOrThreeBlock, ReflectedCompiledMethod, JavaMethodZeroOrOneOrTwo, SimpleCallbackMethod, LazyCompiledMethod, JavaMethodThree, JavaMethodOneOrTwo, ProcMethod, JavaMethodOneOrTwoOrThreeBlock, JavaMethodOne, JavaMethodOneOrTwoBlock, JavaMethodOneOrTwoOrThree, ReflectedJavaMethod, JavaMethod, JavaMethodThreeBlock, JavaMethodTwoBlock, JavaObjectWrapperMethod, ReflectedJavaMultiMethod, JavaMethodTwoOrThree, JavaObjectWrapperMethodZero, AliasMethod, JavaVoidWrapperMethod, CompiledMethod, JavaMethodZeroOrOneBlock, AbstractJavaWrapperMethodZero, YARVMethod, FullFunctionCallbackMethod, JavaMethodZeroBlock, JavaMethodZeroOrOne, UndefinedMethod, DefaultMethod, AbstractJavaWrapperMethod, JavaMethodNoBlock, JavaVoidWrapperMethodZero, RubiniusMethod, WrapperMethod, JavaMethodOneBlock, JavaMethodZeroOrOneOrTwoBlock

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  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. 
protected  CallConfiguration callConfig    The "call configuration" to use for pre/post call logic. 
Constructor:
 protected DynamicMethod() 
 protected DynamicMethod(RubyModule implementationClass,
    Visibility visibility,
    CallConfiguration callConfig) 
    Base constructor for dynamic method handles.
    Parameters:
    implementationClass - The class to which this method will be immediately bound
    visibility - The visibility assigned to this method
    callConfig - The CallConfiguration to use for this method's pre/post invocation logic.
Method from org.jruby.internal.runtime.methods.DynamicMethod Summary:
calculateProtectedClass,   call,   call,   call,   call,   call,   call,   call,   call,   call,   call,   dup,   getArity,   getCallConfig,   getImplementationClass,   getProtectedClass,   getRealMethod,   getVisibility,   handleRedo,   handleReturn,   init,   isCallableFrom,   isNative,   isUndefined,   setCallConfig,   setImplementationClass,   setVisibility
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jruby.internal.runtime.methods.DynamicMethod Detail:
 protected static RubyModule calculateProtectedClass(RubyModule cls) 
    Calculate, based on given RubyModule, which class in its hierarchy should be used to determine protected access.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule clazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 abstract public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule clazz,
    String name,
    IRubyObject[] args,
    Block block)
    The minimum 'call' method required for a dynamic method handle. Subclasses must impleemnt this method, but may implement the other signatures to provide faster, non-boxing call paths. Typically subclasses will implement this method to check variable arity calls, then performing a specific-arity invocation to the appropriate method or performing variable-arity logic in-line.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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.
 public IRubyObject call(ThreadContext context,
    IRubyObject self,
    RubyModule klazz,
    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 public DynamicMethod dup()
    Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes. It is not required that this method produce a new object if the semantics of the DynamicMethod subtype do not require such.
 public Arity getArity() 
    Retrieve the arity of this method, used for reporting arity to Ruby code. This arity may or may not reflect the actual specific or variable arities of the referenced method.
 public CallConfiguration getCallConfig() 
    Get the CallConfiguration used for pre/post logic for this method handle.
 public 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.
 public DynamicMethod getRealMethod() 
    Get the "real" method contained within this method. This simply returns self except in cases where a method is wrapped to give it a new name or new implementation class (AliasMethod, WrapperMethod, ...).
 public Visibility getVisibility() 
    Get the visibility of this method.
 protected IRubyObject handleRedo(Ruby runtime) throws RaiseException 
 protected IRubyObject handleReturn(ThreadContext context,
    JumpException.ReturnJump rj) 
 protected  void init(RubyModule implementationClass,
    Visibility visibility,
    CallConfiguration callConfig) 
 public boolean isCallableFrom(IRubyObject caller,
    CallType callType) 
    Determine whether this method is callable from the given object using the given call type.
 public boolean isNative() 
    Returns true if this method is backed by native (i.e. Java) code.
 public final boolean isUndefined() 
    Whether this method is the "undefined" method, used to represent a missing or undef'ed method. Only returns true for UndefinedMethod instances, of which there should be only one (a singleton).
 public  void setCallConfig(CallConfiguration callConfig) 
    Set the CallConfiguration used for pre/post logic for this method handle.
 public  void setImplementationClass(RubyModule implClass) 
    Set the class on which this method is implemented, used for 'super' logic, among others.
 public  void setVisibility(Visibility visibility) 
    Set the visibility of this method.