.invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle();
.invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle();
.invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle();
.invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameAndScope") .handle(); .invokeVirtualQuiet(lookup(), "postMethodFrameOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle(); .invokeVirtualQuiet(lookup(), "postMethodScopeOnly") .handle();
public static MethodHandle getFrameOnlyPre(Signature signature, CallConfiguration callConfig, RubyModule implClass, String name) { Signature inbound = signature.asFold(void.class); SmartBinder binder = SmartBinder .from(inbound); switch (callConfig) { case FrameFullScopeNone: // before logic return binder .permute("context", "self", "block") .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .invokeVirtualQuiet(lookup(), "preMethodFrameOnly") .handle(); default: throw new RuntimeException("invalid input: " + callConfig); } }
public static MethodHandle getFrameOnlyPre(Signature signature, CallConfiguration callConfig, RubyModule implClass, String name) { Signature inbound = signature.asFold(void.class); SmartBinder binder = SmartBinder .from(inbound); switch (callConfig) { case FrameFullScopeNone: // before logic return binder .permute("context", "self", "block") .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .invokeVirtualQuiet(lookup(), "preMethodFrameOnly") .handle(); default: throw new RuntimeException("invalid input: " + callConfig); } }
private static MethodHandle dynamicCallTarget(Signature from, Signature to) { return SmartBinder .from(from) .fold("selfClass", from.asFold(RubyClass.class).permuteWith(PGC, "context", "self")) .permute(to) .cast(to) .invokeVirtualQuiet(lookup(), "call") .handle(); }
private static MethodHandle dynamicCallTarget(Signature from, Signature to) { return SmartBinder .from(from) .fold("selfClass", from.asFold(RubyClass.class).permuteWith(PGC, "context", "self")) .permute(to) .cast(to) .invokeVirtualQuiet(lookup(), "call") .handle(); }
.insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndScope") .handle(); .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndDummyScope") .handle(); .permute("context", "self", "block") .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .invokeVirtualQuiet(lookup(), "preMethodFrameOnly") .handle(); .permute("context") .insert(1, arrayOf("selfClass", "scope"), arrayOf(RubyModule.class, StaticScope.class), implClass, scope) .invokeVirtualQuiet(lookup(), "preMethodNoFrameAndDummyScope") .handle();
.insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndScope") .handle(); .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndDummyScope") .handle(); .permute("context", "self", "block") .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .invokeVirtualQuiet(lookup(), "preMethodFrameOnly") .handle(); .permute("context") .insert(1, arrayOf("selfClass", "scope"), arrayOf(RubyModule.class, StaticScope.class), implClass, scope) .invokeVirtualQuiet(lookup(), "preMethodScopeOnly") .handle(); .permute("context") .insert(1, arrayOf("selfClass", "scope"), arrayOf(RubyModule.class, StaticScope.class), implClass, scope) .invokeVirtualQuiet(lookup(), "preMethodNoFrameAndDummyScope") .handle();
.insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndScope") .handle(); .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndDummyScope") .handle(); .permute("context", "self", "block") .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .invokeVirtualQuiet(lookup(), "preMethodFrameOnly") .handle(); .permute("context") .insert(1, arrayOf("selfClass", "scope"), arrayOf(RubyModule.class, StaticScope.class), implClass, scope) .invokeVirtualQuiet(lookup(), "preMethodScopeOnly") .handle(); .permute("context") .insert(1, arrayOf("selfClass", "scope"), arrayOf(RubyModule.class, StaticScope.class), implClass, scope) .invokeVirtualQuiet(lookup(), "preMethodNoFrameAndDummyScope") .handle();
.insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndScope") .handle(); .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .insert(5, arrayOf("scope"), arrayOf(StaticScope.class), scope) .invokeVirtualQuiet(lookup(), "preMethodFrameAndDummyScope") .handle(); .permute("context", "self", "block") .insert(1, arrayOf("selfClass", "name"), arrayOf(RubyModule.class, String.class), implClass, name) .invokeVirtualQuiet(lookup(), "preMethodFrameOnly") .handle(); .permute("context") .insert(1, arrayOf("selfClass", "scope"), arrayOf(RubyModule.class, StaticScope.class), implClass, scope) .invokeVirtualQuiet(lookup(), "preMethodNoFrameAndDummyScope") .handle();
static MethodHandle buildGenericHandle(InvokeSite site, DynamicMethod method, RubyClass dispatchClass) { SmartBinder binder; binder = SmartBinder.from(site.signature) .permute("context", "self", "arg.*", "block") .insert(2, new String[]{"rubyClass", "name"}, new Class[]{RubyModule.class, String.class}, dispatchClass, site.name()) .insert(0, "method", DynamicMethod.class, method); if (site.arity > 3) { binder = binder.collect("args", "arg.*"); } if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info(site.name() + "\tbound indirectly " + method + ", " + Bootstrap.logMethod(method)); } return binder.invokeVirtualQuiet(LOOKUP, "call").handle(); }
static MethodHandle buildGenericHandle(InvokeSite site, DynamicMethod method, RubyClass dispatchClass) { SmartBinder binder; binder = SmartBinder.from(site.signature) .permute("context", "self", "arg.*", "block") .insert(2, new String[]{"rubyClass", "name"}, new Class[]{RubyModule.class, String.class}, dispatchClass, site.name()) .insert(0, "method", DynamicMethod.class, method); if (site.arity > 3) { binder = binder.collect("args", "arg.*"); } if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info(site.name() + "\tbound indirectly " + method + ", " + Bootstrap.logMethod(method)); } return binder.invokeVirtualQuiet(LOOKUP, "call").handle(); }
.castArg("self", nc.getNativeTarget()) .castVirtual(nc.getNativeReturn(), nc.getNativeTarget(), nc.getNativeSignature()) .invokeVirtualQuiet(LOOKUP, nc.getNativeName()) .handle();
.castArg("self", nc.getNativeTarget()) .castVirtual(nc.getNativeReturn(), nc.getNativeTarget(), nc.getNativeSignature()) .invokeVirtualQuiet(LOOKUP, nc.getNativeName()) .handle();
} else { target = targetBinder .invokeVirtualQuiet(LOOKUP, javaMethodName);
} else { target = targetBinder .invokeVirtualQuiet(LOOKUP, javaMethodName);