作者热门文章
- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.jruby.ir.targets.YieldSite.setTarget()
方法的一些代码示例,展示了YieldSite.setTarget()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldSite.setTarget()
方法的具体详情如下:
包路径:org.jruby.ir.targets.YieldSite
类名称:YieldSite
方法名:setTarget
暂无
代码示例来源:origin: org.jruby/jruby-complete
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type, int unwrap) throws Throwable {
YieldSite site = new YieldSite(type, unwrap == 1 ? true : false);
MethodHandle handle;
switch (name) {
case "yield":
case "yieldSpecific":
handle = Binder.from(type)
.prepend(YieldSite.class, site)
.invokeVirtual(lookup, name);
break;
case "yieldValues":
handle = Binder.from(type)
.collect(2, IRubyObject[].class)
.prepend(YieldSite.class, site)
.invokeVirtual(lookup, name);
break;
default:
throw new RuntimeException("invalid yield type: " + name);
}
site.setTarget(handle);
return site;
}
代码示例来源:origin: org.jruby/jruby-core
public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type, int unwrap) throws Throwable {
YieldSite site = new YieldSite(type, unwrap == 1 ? true : false);
MethodHandle handle;
switch (name) {
case "yield":
case "yieldSpecific":
handle = Binder.from(type)
.prepend(YieldSite.class, site)
.invokeVirtual(lookup, name);
break;
case "yieldValues":
handle = Binder.from(type)
.collect(2, IRubyObject[].class)
.prepend(YieldSite.class, site)
.invokeVirtual(lookup, name);
break;
default:
throw new RuntimeException("invalid yield type: " + name);
}
site.setTarget(handle);
return site;
}
代码示例来源: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 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-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-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);
}
本文整理了Java中org.jruby.ir.targets.YieldSite.getTarget()方法的一些代码示例,展示了YieldSite.getTarget()的具体用法。这些代码示例主要
本文整理了Java中org.jruby.ir.targets.YieldSite.setTarget()方法的一些代码示例,展示了YieldSite.setTarget()的具体用法。这些代码示例主要
我是一名优秀的程序员,十分优秀!