本文整理了Java中org.jruby.ir.targets.YieldSite.getTarget()
方法的一些代码示例,展示了YieldSite.getTarget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldSite.getTarget()
方法的具体详情如下:
包路径:org.jruby.ir.targets.YieldSite
类名称:YieldSite
方法名:getTarget
暂无
代码示例来源:origin: org.jruby/jruby-complete
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);
}
代码示例来源:origin: org.jruby/jruby-core
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);
}
代码示例来源:origin: org.jruby/jruby-core
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);
}
代码示例来源:origin: org.jruby/jruby-complete
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);
}
内容来源于网络,如有侵权,请联系作者删除!