public IRubyObject yieldSpecific(ThreadContext context, Block block) throws Throwable { if (Options.INVOKEDYNAMIC_YIELD.load()) { BlockBody body = block.getBody(); MethodHandle target; if (block.getBody() instanceof CompiledIRBlockBody) { CompiledIRBlockBody compiledBody = (CompiledIRBlockBody) block.getBody(); if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound directly as yieldSpecific:" + Bootstrap.logBlock(block)); } target = compiledBody.getNormalYieldSpecificHandle(); } else { if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound indirectly as yieldSpecific:" + Bootstrap.logBlock(block)); } target = Binder.from(type()) .permute(1, 0) .invokeVirtualQuiet(MethodHandles.lookup(), "yieldSpecific"); } MethodHandle fallback = getTarget(); MethodHandle test = body.getTestBlockBody(); MethodHandle guard = MethodHandles.guardWithTest(test, target, fallback); setTarget(guard); return (IRubyObject) target.invokeExact(context, block); } return block.yieldSpecific(context); }
public IRubyObject yieldSpecific(ThreadContext context, Block block) throws Throwable { if (Options.INVOKEDYNAMIC_YIELD.load()) { BlockBody body = block.getBody(); MethodHandle target; if (block.getBody() instanceof CompiledIRBlockBody) { CompiledIRBlockBody compiledBody = (CompiledIRBlockBody) block.getBody(); if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound directly as yieldSpecific:" + Bootstrap.logBlock(block)); } target = compiledBody.getNormalYieldSpecificHandle(); } else { if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound indirectly as yieldSpecific:" + Bootstrap.logBlock(block)); } target = Binder.from(type()) .permute(1, 0) .invokeVirtualQuiet(MethodHandles.lookup(), "yieldSpecific"); } MethodHandle fallback = getTarget(); MethodHandle test = body.getTestBlockBody(); MethodHandle guard = MethodHandles.guardWithTest(test, target, fallback); setTarget(guard); return (IRubyObject) target.invokeExact(context, block); } return block.yieldSpecific(context); }
public IRubyObject yield(ThreadContext context, Block block, IRubyObject arg) throws Throwable { if (Options.INVOKEDYNAMIC_YIELD.load()) { BlockBody body = block.getBody(); MethodHandle target; if (block.getBody() instanceof CompiledIRBlockBody) { CompiledIRBlockBody compiledBody = (CompiledIRBlockBody) block.getBody(); if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound directly as yield:" + Bootstrap.logBlock(block)); } target = unwrap ? compiledBody.getNormalYieldUnwrapHandle() : compiledBody.getNormalYieldHandle(); } else { if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound indirectly as yield:" + Bootstrap.logBlock(block)); } target = Binder.from(type()) .append(unwrap) .invokeStaticQuiet(MethodHandles.lookup(), IRRuntimeHelpers.class, "yield"); } MethodHandle fallback = getTarget(); MethodHandle test = body.getTestBlockBody(); MethodHandle guard = MethodHandles.guardWithTest(test, target, fallback); setTarget(guard); return (IRubyObject) target.invokeExact(context, block, arg); } return IRRuntimeHelpers.yield(context, block, arg, unwrap); }
public IRubyObject yield(ThreadContext context, Block block, IRubyObject arg) throws Throwable { if (Options.INVOKEDYNAMIC_YIELD.load()) { BlockBody body = block.getBody(); MethodHandle target; if (block.getBody() instanceof CompiledIRBlockBody) { CompiledIRBlockBody compiledBody = (CompiledIRBlockBody) block.getBody(); if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound directly as yield:" + Bootstrap.logBlock(block)); } target = unwrap ? compiledBody.getNormalYieldUnwrapHandle() : compiledBody.getNormalYieldHandle(); } else { if (Options.INVOKEDYNAMIC_LOG_BINDING.load()) { LOG.info("yield \tbound indirectly as yield:" + Bootstrap.logBlock(block)); } target = Binder.from(type()) .append(unwrap) .invokeStaticQuiet(MethodHandles.lookup(), IRRuntimeHelpers.class, "yield"); } MethodHandle fallback = getTarget(); MethodHandle test = body.getTestBlockBody(); MethodHandle guard = MethodHandles.guardWithTest(test, target, fallback); setTarget(guard); return (IRubyObject) target.invokeExact(context, block, arg); } return IRRuntimeHelpers.yield(context, block, arg, unwrap); }