Package org.jruby.ir.targets.indy
Class InvokeSite
java.lang.Object
java.lang.invoke.CallSite
java.lang.invoke.MutableCallSite
org.jruby.ir.targets.indy.InvokeSite
- Direct Known Subclasses:
NormalInvokeSite,SelfInvokeSite
Created by headius on 10/23/14.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intfinal intprivate static final Map<com.headius.invokebinder.Signature,MethodHandle> private booleanprotected CacheEntryfinal CallTypeprivate static final MethodHandle(package private) final MethodHandleprotected final Stringfinal com.headius.invokebinder.Signatureprotected final intprivate booleanprivate static final Loggerprivate static final boolean(package private) static final MethodHandles.Lookupprotected final Stringstatic final MethodHandlefinal com.headius.invokebinder.Signatureprivate final longprivate static final MethodHandleprivate final SiteTracker -
Constructor Summary
ConstructorsConstructorDescriptionInvokeSite(MethodType type, String name, CallType callType, boolean literalClosure, String file, int line) InvokeSite(MethodType type, String name, CallType callType, String file, int line) -
Method Summary
Modifier and TypeMethodDescriptionprivate MethodHandlestatic CallSitebootstrap(InvokeSite site, MethodHandles.Lookup lookup) (package private) MethodHandlebuildAliasHandle(CacheEntry entry, IRubyObject self) (package private) MethodHandlebuildJavaFieldHandle(InvokeSite site, CacheEntry entry, IRubyObject self) (package private) MethodHandlebuildNewInstanceHandle(CacheEntry entry, IRubyObject self) (package private) MethodHandlebuildNotEqualHandle(CacheEntry entry, IRubyObject self) (package private) MethodHandlebuildStructHandle(CacheEntry entry) static IRubyObjectcallMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject[] args, Block block) Variable arity method_missing invocation.static IRubyObjectcallMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject arg0, Block block) Arity one method_missing invocationstatic IRubyObjectcallMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject arg0, IRubyObject arg1, Block block) Arity two method_missing invocationstatic IRubyObjectcallMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) Arity three method_missing invocationfail(ThreadContext context, IRubyObject caller, IRubyObject self, Block block) Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg0, Block block) Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.private static MethodHandlegetBlockEscape(com.headius.invokebinder.Signature signature) protected MethodHandlegetHandle(IRubyObject self, CacheEntry entry) invoke(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) private voidlogBind(InvokeSite.CacheAction action) private voidlogFail()private static StringlogMethod(DynamicMethod method) private voidprivate voidlogPic(DynamicMethod method) abstract booleanmethodMissing(CacheEntry entry, IRubyObject caller) name()static IRubyObjectnegate(IRubyObject object, RubyNil nil, RubyBoolean.True tru, RubyBoolean.False fals) static RubyClasspollAndGetClass(ThreadContext context, IRubyObject self) com.headius.invokebinder.BinderprepareBinder(boolean varargs) Prepare a binder for this call site's target, forcing varargs if specifiedvoidsetInitialTarget(MethodHandle target) voidsetTarget(MethodHandle target) static boolean(package private) InvokeSite.CacheActiontestThresholds(RubyModule testClass) toString()protected MethodHandleupdateInvocationTarget(MethodHandle target, IRubyObject self, RubyModule testClass, DynamicMethod method, SwitchPoint switchPoint) Update the given call site using the new target, wrapping with appropriate bind and argument-juggling logic.Methods inherited from class java.lang.invoke.MutableCallSite
dynamicInvoker, getTarget, syncAll
-
Field Details
-
LOG
-
LOG_BINDING
private static final boolean LOG_BINDING -
LOOKUP
-
signature
public final com.headius.invokebinder.Signature signature -
fullSignature
public final com.headius.invokebinder.Signature fullSignature -
arity
public final int arity -
methodName
-
fallback
-
tracker
-
siteID
private final long siteID -
argOffset
private final int argOffset -
file
-
line
protected final int line -
boundOnce
private boolean boundOnce -
literalClosure
private boolean literalClosure -
cache
-
callType
-
ESCAPE_BLOCK
-
BLOCK_ESCAPES
-
NEGATE
-
TEST_CLASS
-
-
Constructor Details
-
InvokeSite
-
InvokeSite
public InvokeSite(MethodType type, String name, CallType callType, boolean literalClosure, String file, int line)
-
-
Method Details
-
name
-
bootstrap
-
invoke
public IRubyObject invoke(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) throws Throwable - Throws:
Throwable
-
getBlockEscape
-
fail
public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) throws Throwable Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.- Throws:
Throwable
-
fail
public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject self, Block block) throws Throwable Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.- Throws:
Throwable
-
fail
public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg0, Block block) throws Throwable Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.- Throws:
Throwable
-
fail
public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg0, IRubyObject arg1, Block block) throws Throwable Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.- Throws:
Throwable
-
fail
public IRubyObject fail(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) throws Throwable Failover version uses a monomorphic cache and DynamicMethod.call, as in non-indy.- Throws:
Throwable
-
prepareBinder
public com.headius.invokebinder.Binder prepareBinder(boolean varargs) Prepare a binder for this call site's target, forcing varargs if specified- Parameters:
varargs- whether to only call an arg-boxed variable arity path- Returns:
- the prepared binder
-
getHandle
- Throws:
Throwable
-
buildJavaFieldHandle
MethodHandle buildJavaFieldHandle(InvokeSite site, CacheEntry entry, IRubyObject self) throws Throwable - Throws:
Throwable
-
buildNewInstanceHandle
-
buildNotEqualHandle
-
negate
public static IRubyObject negate(IRubyObject object, RubyNil nil, RubyBoolean.True tru, RubyBoolean.False fals) -
buildAliasHandle
- Throws:
Throwable
-
buildStructHandle
- Throws:
Throwable
-
updateInvocationTarget
protected MethodHandle updateInvocationTarget(MethodHandle target, IRubyObject self, RubyModule testClass, DynamicMethod method, SwitchPoint switchPoint) Update the given call site using the new target, wrapping with appropriate bind and argument-juggling logic. Return a handle suitable for invoking with the site's original method type. -
logMethodMissing
private void logMethodMissing() -
logBind
-
logPic
-
logFail
private void logFail() -
bindToFail
-
testThresholds
-
pollAndGetClass
-
setTarget
- Overrides:
setTargetin classMutableCallSite
-
setInitialTarget
-
methodMissing
-
callMethodMissing
public static IRubyObject callMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject[] args, Block block) Variable arity method_missing invocation. Arity zero also passes through here. -
callMethodMissing
public static IRubyObject callMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject arg0, Block block) Arity one method_missing invocation -
callMethodMissing
public static IRubyObject callMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject arg0, IRubyObject arg1, Block block) Arity two method_missing invocation -
callMethodMissing
public static IRubyObject callMethodMissing(CacheEntry entry, CallType callType, ThreadContext context, IRubyObject self, RubyClass selfClass, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, Block block) Arity three method_missing invocation -
logMethod
-
testClass
-
toString
-