gpt4 book ai didi

org.jruby.ir.targets.YieldSite.getTarget()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:16:43 27 4
gpt4 key购买 nike

本文整理了Java中org.jruby.ir.targets.YieldSite.getTarget()方法的一些代码示例,展示了YieldSite.getTarget()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YieldSite.getTarget()方法的具体详情如下:
包路径:org.jruby.ir.targets.YieldSite
类名称:YieldSite
方法名:getTarget

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);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com