Top Fields Constructors Methods
org.jruby.ext.ffi.jffi

public Class DefaultMethod

extends DynamicMethod
implements CacheableMethod
Class Inheritance
All Implemented Interfaces
org.jruby.internal.runtime.methods.CacheableMethod
Imports
com.kenai.jffi.CallContext, .Function, org.jruby.RubyModule, org.jruby.internal.runtime.methods.CacheableMethod, .DynamicMethod, org.jruby.runtime.Arity, .Block, .ThreadContext, .Visibility, org.jruby.runtime.builtin.IRubyObject, org.jruby.util.cli.Options

Field Summary

Modifier and TypeField and Description
protected final Arity
private volatile NativeInvoker
public static final boolean
private final NativeInvoker
protected final Function
private JITHandle
public static final boolean
protected final Signature
Inherited from org.jruby.internal.runtime.methods.DynamicMethod:
aliasCountdefinedClassflagshandleimplementationClassnameprotectedClassserialNumber

Constructor Summary

AccessConstructor and Description
public
DefaultMethod(RubyModule implementationClass, Function function, Signature signature, NativeInvoker defaultInvoker)

Method Summary

Modifier and TypeMethod and Description
public IRubyObject
call(ThreadContext
The thread context for the currently executing thread
context
,
IRubyObject
The 'self' or 'receiver' object to use for this call
self
,
RubyModule
The Ruby class against which this method is binding
clazz
,
String
The incoming name used to invoke this method
name
,
IRubyObject[]
The first argument to this invocation
args
)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

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
The thread context for the currently executing thread
context
,
IRubyObject
The 'self' or 'receiver' object to use for this call
self
,
RubyModule
The Ruby class against which this method is binding
clazz
,
String
The incoming name used to invoke this method
name
,
IRubyObject[]
The argument list to this invocation
args
,
Block
The block passed to this invocation
block
)

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.call.

The minimum 'call' method required for a dynamic method handle.

public final DynamicMethod
dup()

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.dup.

Duplicate this method, returning DynamicMethod referencing the same code and with the same attributes.

public final NativeInvoker
public final Arity
getArity()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getArity.

Deprecated

Retrieve the arity of this method, used for reporting arity to Ruby code.

pack-priv CallContext
pack-priv long
private synchronized JITHandle
public DynamicMethod
protected final NativeInvoker
getNativeInvoker()
Deprecated

protected final NativeInvoker
public final boolean
isNative()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.isNative.

Returns true if this method is backed by native (i.e. Java) code.

private synchronized NativeInvoker
Inherited from org.jruby.internal.runtime.methods.DynamicMethod:
adjustAliasCountcalculateProtectedClasscallcallcallcallcallcallcallcallcallRespondTogetAliasCountgetCallConfiggetDefinedClassgetHandlegetImplementationClassgetInstanceVariableNamesgetMethodDatagetNamegetProtectedClassgetRealMethodgetSerialNumbergetSignaturegetVisibilityinitinitisBuiltinisCallableFromisImplementedByisNotImplementedisNullisRefinedisUndefinedsetCallConfigsetDefinedClasssetHandlesetImplementationClasssetIsBuiltinsetNotImplementedsetRuby2KeywordssetVisibility

Field Detail

arityback to summary
protected final Arity arity
compiledInvokerback to summary
private volatile NativeInvoker compiledInvoker
DEBUGback to summary
public static final boolean DEBUG
defaultInvokerback to summary
private final NativeInvoker defaultInvoker
functionback to summary
protected final Function function
jitHandleback to summary
private JITHandle jitHandle
REIFYback to summary
public static final boolean REIFY
signatureback to summary
protected final Signature signature

Constructor Detail

DefaultMethodback to summary
public DefaultMethod(RubyModule implementationClass, Function function, Signature signature, NativeInvoker defaultInvoker)

Method Detail

callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args)

Overrides org.jruby.internal.runtime.methods.DynamicMethod.call.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.call.

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.

Parameters
context:ThreadContext

The thread context for the currently executing thread

self:IRubyObject

The 'self' or 'receiver' object to use for this call

clazz:RubyModule

The Ruby class against which this method is binding

name:String

The incoming name used to invoke this method

args:IRubyObject[]

The first argument to this invocation

Returns:IRubyObject

The result of the call

Annotations
@Override
callback to summary
public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule clazz, String name, IRubyObject[] args, Block block)

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.call.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.call.

The minimum 'call' method required for a dynamic method handle. Subclasses must implement 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.

Parameters
context:ThreadContext

The thread context for the currently executing thread

self:IRubyObject

The 'self' or 'receiver' object to use for this call

clazz:RubyModule

The Ruby class against which this method is binding

name:String

The incoming name used to invoke this method

args:IRubyObject[]

The argument list to this invocation

block:Block

The block passed to this invocation

Returns:IRubyObject

The result of the call

Annotations
@Override
dupback to summary
public final DynamicMethod dup()

Implements abstract org.jruby.internal.runtime.methods.DynamicMethod.dup.

Doc from org.jruby.internal.runtime.methods.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.

Returns:DynamicMethod

An identical DynamicMethod object to the target.

Annotations
@Override
forceCompilationback to summary
public final NativeInvoker forceCompilation()
getArityback to summary
public final Arity getArity()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.getArity.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.getArity.

Deprecated

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.

Returns:Arity

The arity of the method, as reported to Ruby consumers.

Annotations
@Deprecated
@Override
getCallContextback to summary
pack-priv CallContext getCallContext()
getFunctionAddressback to summary
pack-priv long getFunctionAddress()
getJITHandleback to summary
private synchronized JITHandle getJITHandle()
getMethodForCachingback to summary
public DynamicMethod getMethodForCaching()

Implements org.jruby.internal.runtime.methods.CacheableMethod.getMethodForCaching.

getNativeInvokerback to summary
protected final NativeInvoker getNativeInvoker()

Deprecated

Annotations
@Deprecated
getNativeInvokerback to summary
protected final NativeInvoker getNativeInvoker(ThreadContext context)
isNativeback to summary
public final boolean isNative()

Overrides org.jruby.internal.runtime.methods.DynamicMethod.isNative.

Doc from org.jruby.internal.runtime.methods.DynamicMethod.isNative.

Returns true if this method is backed by native (i.e. Java) code.

Returns:boolean

true If backed by Java code or JVM bytecode; false otherwise

Annotations
@Override
tryCompilationback to summary
private synchronized NativeInvoker tryCompilation(ThreadContext context)