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

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

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

Ruby.isBooting介绍

暂无

代码示例

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

public void addInvalidatorsAndFlush(List<Invalidator> invalidators) {
  // add this class's invalidators to the aggregate
  invalidators.add(methodInvalidator);
  
  // if we're not at boot time, don't bother fully clearing caches
  if (!runtime.isBooting()) cachedMethods.clear();
  // no subclasses, don't bother with lock and iteration
  if (subclasses == null || subclasses.isEmpty()) return;
  
  // cascade into subclasses
  synchronized (runtime.getHierarchyLock()) {
    Set<RubyClass> mySubclasses = subclasses;
    if (mySubclasses != null) for (RubyClass subclass : mySubclasses) {
      subclass.addInvalidatorsAndFlush(invalidators);
    }
  }
}

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

public void addInvalidatorsAndFlush(List<Invalidator> invalidators) {
  // add this class's invalidators to the aggregate
  invalidators.add(methodInvalidator);
  
  // if we're not at boot time, don't bother fully clearing caches
  if (!runtime.isBooting()) cachedMethods.clear();
  // no subclasses, don't bother with lock and iteration
  if (subclasses == null || subclasses.isEmpty()) return;
  
  // cascade into subclasses
  synchronized (runtime.getHierarchyLock()) {
    Set<RubyClass> mySubclasses = subclasses;
    if (mySubclasses != null) for (RubyClass subclass : mySubclasses) {
      subclass.addInvalidatorsAndFlush(invalidators);
    }
  }
}

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

/**
 * If the ir.print property is enabled and we are not booting, or the ir.print.all property is enabled and we are
 * booting, return true to indicate IR should be printed.
 *
 * @param runtime the current runtime
 * @return whether to print IR
 */
public static boolean shouldPrintIR(Ruby runtime) {
  boolean booting = runtime.isBooting();
  boolean print = Options.IR_PRINT.load();
  boolean printAll = Options.IR_PRINT_ALL.load();
  return (print && !booting) || (booting && printAll);
}

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

/**
 * If the ir.print property is enabled and we are not booting, or the ir.print.all property is enabled and we are
 * booting, return true to indicate IR should be printed.
 *
 * @param runtime the current runtime
 * @return whether to print IR
 */
public static boolean shouldPrintIR(Ruby runtime) {
  boolean booting = runtime.isBooting();
  boolean print = Options.IR_PRINT.load();
  boolean printAll = Options.IR_PRINT_ALL.load();
  return (print && !booting) || (booting && printAll);
}

代码示例来源: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-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-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 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: com.ning.billing/killbill-osgi-bundles-jruby

protected void invalidateCoreClasses() {
  if (!getRuntime().isBooting()) {
    if (this == getRuntime().getFixnum()) {
      getRuntime().reopenFixnum();
    } else if (this == getRuntime().getFloat()) {
      getRuntime().reopenFloat();
    }
  }
}

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

protected void invalidateCoreClasses() {
  if (!getRuntime().isBooting()) {
    if (this == getRuntime().getFixnum()) {
      getRuntime().reopenFixnum();
    } else if (this == getRuntime().getFloat()) {
      getRuntime().reopenFloat();
    }
  }
}

代码示例来源: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类方法