org.jruby.Ruby.getJITCompiler()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(135)

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

Ruby.getJITCompiler介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

private void tryJit(ThreadContext context) {
  if (context.runtime.isBooting() && !Options.JIT_KERNEL.load()) return; // don't JIT during runtime boot
  synchronized (this) {
    if (callCount >= 0 && callCount++ >= Options.JIT_THRESHOLD.load()) {
      context.runtime.getJITCompiler().buildThresholdReached(context, this);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private void promoteToFullBuild(ThreadContext context) {
  if (context.runtime.isBooting() && !Options.JIT_KERNEL.load()) return; // don't Promote to full build during runtime boot
  if (callCount++ >= Options.JIT_THRESHOLD.load()) {
    context.runtime.getJITCompiler().buildThresholdReached(context, this);
  }
}

代码示例来源:origin: org.jruby/jruby-core

private void promoteToFullBuild(ThreadContext context) {
  if (context.runtime.isBooting() && !Options.JIT_KERNEL.load()) return; // don't Promote to full build during runtime boot
  if (callCount++ >= Options.JIT_THRESHOLD.load()) {
    context.runtime.getJITCompiler().buildThresholdReached(context, this);
  }
}

代码示例来源:origin: org.jruby/jruby-core

private void tryJit(ThreadContext context) {
  if (context.runtime.isBooting() && !Options.JIT_KERNEL.load()) return; // don't JIT during runtime boot
  synchronized (this) {
    if (callCount >= 0 && callCount++ >= Options.JIT_THRESHOLD.load()) {
      context.runtime.getJITCompiler().buildThresholdReached(context, this);
    }
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private void promoteToFullBuild(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (runtime.isBooting() && !Options.JIT_KERNEL.load()) return;   // don't Promote to full build during runtime boot
  if (callCount++ >= Options.JIT_THRESHOLD.load()) runtime.getJITCompiler().buildThresholdReached(context, this);
  if (IRRuntimeHelpers.shouldPrintIR(implementationClass.getRuntime())) {
    ByteArrayOutputStream baos = IRDumper.printIR(method, true, true);
    LOG.info("Printing full IR for " + method.getId() + ":\n" + new String(baos.toByteArray()));
  }
}

代码示例来源:origin: org.jruby/jruby-core

private void promoteToFullBuild(ThreadContext context) {
  Ruby runtime = context.runtime;
  if (runtime.isBooting() && !Options.JIT_KERNEL.load()) return;   // don't Promote to full build during runtime boot
  if (callCount++ >= Options.JIT_THRESHOLD.load()) runtime.getJITCompiler().buildThresholdReached(context, this);
  if (IRRuntimeHelpers.shouldPrintIR(implementationClass.getRuntime())) {
    ByteArrayOutputStream baos = IRDumper.printIR(method, true, true);
    LOG.info("Printing full IR for " + method.getId() + ":\n" + new String(baos.toByteArray()));
  }
}

代码示例来源:origin: org.jruby/jruby-complete

public void inlineMethod(IRMethod methodToInline, long callsiteId, int classToken, boolean cloneHost) {
  if (alreadyHasInline) return;
  FullInterpreterContext newContext = inlineMethodCommon(methodToInline, callsiteId, classToken, cloneHost);
  if (newContext == null) {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " failed: " + inlineFailed + ".");
    return;
  } else {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " succeeded.");
  }
  newContext.generateInstructionsForInterpretation();
  this.optimizedInterpreterContext = newContext;
  manager.getRuntime().getJITCompiler().getTaskFor(manager.getRuntime().getCurrentContext(), compilable).run();
}

代码示例来源:origin: org.jruby/jruby-complete

public void inlineMethodCompiled(IRMethod methodToInline, long callsiteId, int classToken, boolean cloneHost) {
  if (alreadyHasInline) return;
  FullInterpreterContext newContext = inlineMethodCommon(methodToInline, callsiteId, classToken, cloneHost);
  if (newContext == null) {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " failed: " + inlineFailed + ".");
    return;
  } else {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " succeeded.");
  }
  // We are not running any JIT-specific passes here.
  newContext.linearizeBasicBlocks();
  this.optimizedInterpreterContext = newContext;
  manager.getRuntime().getJITCompiler().getTaskFor(manager.getRuntime().getCurrentContext(), compilable).run();
}

代码示例来源:origin: org.jruby/jruby-complete

public void inlineMethodJIT(IRMethod methodToInline, long callsiteId, int classToken, boolean cloneHost) {
  if (alreadyHasInline) return;
  FullInterpreterContext newContext = inlineMethodCommon(methodToInline, callsiteId, classToken, cloneHost);
  if (newContext == null) {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " failed: " + inlineFailed + ".");
    return;
  } else {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " succeeded.");
  }
  // We are not running any JIT-specific passes here.
  newContext.linearizeBasicBlocks();
  this.optimizedInterpreterContext = newContext;
  manager.getRuntime().getJITCompiler().getTaskFor(manager.getRuntime().getCurrentContext(), compilable).run();
 }

代码示例来源:origin: org.jruby/jruby-core

public void inlineMethod(IRMethod methodToInline, long callsiteId, int classToken, boolean cloneHost) {
  if (alreadyHasInline) return;
  FullInterpreterContext newContext = inlineMethodCommon(methodToInline, callsiteId, classToken, cloneHost);
  if (newContext == null) {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " failed: " + inlineFailed + ".");
    return;
  } else {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " succeeded.");
  }
  newContext.generateInstructionsForInterpretation();
  this.optimizedInterpreterContext = newContext;
  manager.getRuntime().getJITCompiler().getTaskFor(manager.getRuntime().getCurrentContext(), compilable).run();
}

代码示例来源:origin: org.jruby/jruby-core

public void inlineMethodCompiled(IRMethod methodToInline, long callsiteId, int classToken, boolean cloneHost) {
  if (alreadyHasInline) return;
  FullInterpreterContext newContext = inlineMethodCommon(methodToInline, callsiteId, classToken, cloneHost);
  if (newContext == null) {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " failed: " + inlineFailed + ".");
    return;
  } else {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " succeeded.");
  }
  // We are not running any JIT-specific passes here.
  newContext.linearizeBasicBlocks();
  this.optimizedInterpreterContext = newContext;
  manager.getRuntime().getJITCompiler().getTaskFor(manager.getRuntime().getCurrentContext(), compilable).run();
}

代码示例来源:origin: org.jruby/jruby-core

public void inlineMethodJIT(IRMethod methodToInline, long callsiteId, int classToken, boolean cloneHost) {
  if (alreadyHasInline) return;
  FullInterpreterContext newContext = inlineMethodCommon(methodToInline, callsiteId, classToken, cloneHost);
  if (newContext == null) {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " failed: " + inlineFailed + ".");
    return;
  } else {
    if (IRManager.IR_INLINER_VERBOSE) LOG.info("Inline of " + methodToInline + " into " + this + " succeeded.");
  }
  // We are not running any JIT-specific passes here.
  newContext.linearizeBasicBlocks();
  this.optimizedInterpreterContext = newContext;
  manager.getRuntime().getJITCompiler().getTaskFor(manager.getRuntime().getCurrentContext(), compilable).run();
 }

代码示例来源:origin: org.talend.sdk.component/documentation

}).thenAccept(ignored -> {
  Ruby.getGlobalRuntime().getJITCompiler().tearDown();
});
tasks.register(() -> generatedTypes(generatedDir));

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private DynamicMethod tryJitReturnMethod(ThreadContext context) {
  String className;
  if (implementationClass.isSingleton()) {
    MetaClass metaClass = (MetaClass)implementationClass;
    RubyClass realClass = metaClass.getRealClass();
    // if real class is Class
    if (realClass == context.runtime.getClassClass()) {
      // use the attached class's name
      className = ((RubyClass)metaClass.getAttached()).getName();
    } else {
      // use the real class name
      className = realClass.getName();
    }
  } else {
    // use the class name
    className = implementationClass.getName();
  }
  context.runtime.getJITCompiler().tryJIT(this, context, className, name);
  return box.actualMethod;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private DynamicMethod tryJitReturnMethod(ThreadContext context) {
  String className;
  if (implementationClass.isSingleton()) {
    MetaClass metaClass = (MetaClass)implementationClass;
    RubyClass realClass = metaClass.getRealClass();
    // if real class is Class
    if (realClass == context.runtime.getClassClass()) {
      // use the attached class's name
      className = ((RubyClass)metaClass.getAttached()).getName();
    } else {
      // use the real class name
      className = realClass.getName();
    }
  } else {
    // use the class name
    className = implementationClass.getName();
  }
  context.runtime.getJITCompiler().tryJIT(this, context, className, name);
  return box.actualMethod;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

getJITCompiler().tearDown();

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

getJITCompiler().tearDown();

代码示例来源:origin: org.jruby/jruby-complete

private void promoteToFullBuild(ThreadContext context) {
  if (context.runtime.isBooting() && !Options.JIT_KERNEL.load()) return; // don't JIT during runtime boot
  if (callCount >= 0) {
    synchronized (this) {
      // check call count again
      if (callCount < 0) return;
      if (callCount++ >= Options.JIT_THRESHOLD.load()) {
        callCount = -1;
        // ensure we've got code ready for JIT
        ensureInstrsReady();
        closure.getNearestTopLocalVariableScope().prepareForCompilation();
        // if we don't have an explicit protocol, disable JIT
        if (!closure.hasExplicitCallProtocol()) {
          if (Options.JIT_LOGGING.load()) {
            LOG.info("JIT failed; no protocol found in block: " + closure);
          }
          return;
        }
        context.runtime.getJITCompiler().buildThresholdReached(context, this);
      }
    }
  }
}

代码示例来源:origin: org.jruby/jruby-core

private void promoteToFullBuild(ThreadContext context) {
  if (context.runtime.isBooting() && !Options.JIT_KERNEL.load()) return; // don't JIT during runtime boot
  if (callCount >= 0) {
    synchronized (this) {
      // check call count again
      if (callCount < 0) return;
      if (callCount++ >= Options.JIT_THRESHOLD.load()) {
        callCount = -1;
        // ensure we've got code ready for JIT
        ensureInstrsReady();
        closure.getNearestTopLocalVariableScope().prepareForCompilation();
        // if we don't have an explicit protocol, disable JIT
        if (!closure.hasExplicitCallProtocol()) {
          if (Options.JIT_LOGGING.load()) {
            LOG.info("JIT failed; no protocol found in block: " + closure);
          }
          return;
        }
        context.runtime.getJITCompiler().buildThresholdReached(context, this);
      }
    }
  }
}

相关文章

Ruby类方法