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

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

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

Ruby.tryCompile介绍

[英]Try to compile the code associated with the given Node, returning an instance of the successfully-compiled Script or null if the script could not be compiled.
[中]尝试编译与给定节点关联的代码,返回已成功编译脚本的实例,如果无法编译脚本,则返回null。

代码示例

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

/**
 * Try to compile the code associated with the given Node, returning an
 * instance of the successfully-compiled Script or null if the script could
 * not be compiled.
 *
 * @param node The node to attempt to compiled
 * @return an instance of the successfully-compiled Script, or null.
 */
public Script tryCompile(Node node) {
  return tryCompile(node, null, new JRubyClassLoader(getJRubyClassLoader()), false);
}

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

/**
 * Try to compile the code associated with the given Node, returning an
 * instance of the successfully-compiled Script or null if the script could
 * not be compiled.
 *
 * @param node The node to attempt to compiled
 * @return an instance of the successfully-compiled Script, or null.
 */
public Script tryCompile(Node node) {
  return tryCompile(node, null, new JRubyClassLoader(getJRubyClassLoader()), false);
}

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

/**
 * Try to compile the code associated with the given Node, returning an
 * instance of the successfully-compiled Script or null if the script could
 * not be compiled. This version accepts an ASTInspector instance assumed to
 * have appropriate flags set for compile optimizations, such as to turn
 * on heap-based local variables to share an existing scope.
 *
 * @param node The node to attempt to compiled
 * @param inspector The ASTInspector to use for making optimization decisions
 * @return an instance of the successfully-compiled Script, or null.
 */
public Script tryCompile(Node node, ASTInspector inspector) {
  return tryCompile(node, null, new JRubyClassLoader(getJRubyClassLoader()), inspector, false);
}

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

/**
 * Try to compile the code associated with the given Node, returning an
 * instance of the successfully-compiled Script or null if the script could
 * not be compiled. This version accepts an ASTInspector instance assumed to
 * have appropriate flags set for compile optimizations, such as to turn
 * on heap-based local variables to share an existing scope.
 *
 * @param node The node to attempt to compiled
 * @param inspector The ASTInspector to use for making optimization decisions
 * @return an instance of the successfully-compiled Script, or null.
 */
public Script tryCompile(Node node, ASTInspector inspector) {
  return tryCompile(node, null, new JRubyClassLoader(getJRubyClassLoader()), inspector, false);
}

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

/**
 * Try to compile the code associated with the given Node, returning an
 * instance of the successfully-compiled Script or null if the script could
 * not be compiled.
 *
 * @param node The node to attempt to compiled
 * @return an instance of the successfully-compiled Script, or null.
 */
public Script tryCompile(Node node) {
  return tryCompile((RootNode) node, new ClassDefiningJRubyClassLoader(getJRubyClassLoader())).script();
}

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

/**
 * Try to compile the code associated with the given Node, returning an
 * instance of the successfully-compiled Script or null if the script could
 * not be compiled.
 *
 * @param node The node to attempt to compiled
 * @return an instance of the successfully-compiled Script, or null.
 */
public Script tryCompile(Node node) {
  return tryCompile((RootNode) node, new ClassDefiningJRubyClassLoader(getJRubyClassLoader())).script();
}

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

script = tryCompile(scriptNode, className, new JRubyClassLoader(jrubyClassLoader), false);

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

script = tryCompile(scriptNode, className, new JRubyClassLoader(jrubyClassLoader), false);

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

inspector.inspect(node);
return tryCompile(node, cachedClassName, classLoader, inspector, dump);

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

inspector.inspect(node);
return tryCompile(node, cachedClassName, classLoader, inspector, dump);

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

private ScriptAndCode precompileCLI(RootNode scriptNode) {
  ScriptAndCode scriptAndCode = null;
  // IR JIT does not handle all scripts yet, so let those that fail run in interpreter instead
  // FIXME: restore error once JIT should handle everything
  try {
    scriptAndCode = tryCompile(scriptNode, new ClassDefiningJRubyClassLoader(getJRubyClassLoader()));
    if (scriptAndCode != null && Options.JIT_LOGGING.load()) {
      LOG.info("done compiling target script: {}", scriptNode.getFile());
    }
  } catch (Exception e) {
    if (Options.JIT_LOGGING.load()) {
      if (Options.JIT_LOGGING_VERBOSE.load()) {
        LOG.error("failed to compile target script: " + scriptNode.getFile(), e);
      }
      else {
        LOG.error("failed to compile target script: " + scriptNode.getFile() + " - " + e);
      }
    }
  }
  return scriptAndCode;
}

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

private ScriptAndCode precompileCLI(RootNode scriptNode) {
  ScriptAndCode scriptAndCode = null;
  // IR JIT does not handle all scripts yet, so let those that fail run in interpreter instead
  // FIXME: restore error once JIT should handle everything
  try {
    scriptAndCode = tryCompile(scriptNode, new ClassDefiningJRubyClassLoader(getJRubyClassLoader()));
    if (scriptAndCode != null && Options.JIT_LOGGING.load()) {
      LOG.info("done compiling target script: {}", scriptNode.getFile());
    }
  } catch (Exception e) {
    if (Options.JIT_LOGGING.load()) {
      if (Options.JIT_LOGGING_VERBOSE.load()) {
        LOG.error("failed to compile target script: " + scriptNode.getFile(), e);
      }
      else {
        LOG.error("failed to compile target script: " + scriptNode.getFile() + " - " + e);
      }
    }
  }
  return scriptAndCode;
}

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

/**
 * Run the specified script without any of the loop-processing wrapper
 * code.
 * 
 * @param scriptNode The root node of the script to be executed
 * bytecode before execution
 * @return The result of executing the script
 */
public IRubyObject runNormally(Node scriptNode) {
  Script script = null;
  boolean compile = getInstanceConfig().getCompileMode().shouldPrecompileCLI();
  if (compile || config.isShowBytecode()) {
    script = tryCompile(scriptNode, null, new JRubyClassLoader(getJRubyClassLoader()), config.isShowBytecode());
  }
  if (script != null) {
    if (config.isShowBytecode()) {
      return getNil();
    }
    return runScript(script);
  } else {
    failForcedCompile(scriptNode);
    
    return runInterpreter(scriptNode);
  }
}

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

/**
 * Run the specified script without any of the loop-processing wrapper
 * code.
 * 
 * @param scriptNode The root node of the script to be executed
 * bytecode before execution
 * @return The result of executing the script
 */
public IRubyObject runNormally(Node scriptNode) {
  Script script = null;
  boolean compile = getInstanceConfig().getCompileMode().shouldPrecompileCLI();
  if (compile || config.isShowBytecode()) {
    script = tryCompile(scriptNode, null, new JRubyClassLoader(getJRubyClassLoader()), config.isShowBytecode());
  }
  if (script != null) {
    if (config.isShowBytecode()) {
      return getNil();
    }
    return runScript(script);
  } else {
    failForcedCompile(scriptNode);
    
    return runInterpreter(scriptNode);
  }
}

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

if (compileMode == CompileMode.FORCE) {
  Script script = runtime.tryCompile(node);
  if (script != null) {
    return new EmbedEvalUnitImpl(container, node, scope, script);

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

if (compileMode == CompileMode.FORCE) {
  Script script = runtime.tryCompile(node);
  if (script != null) {
    return new EmbedEvalUnitImpl(container, node, scope, script);

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

Script script = runtime.tryCompile(node, inspector);
if (script != null) {
  return new EmbedEvalUnitImpl(container, node, scope, script);

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

if (compile) {
  try {
    script = tryCompile(scriptNode);
    if (Options.JIT_LOGGING.load()) {
      LOG.info("successfully compiled: {}", scriptNode.getFile());

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

if (compile) {
  try {
    script = tryCompile(scriptNode);
    if (Options.JIT_LOGGING.load()) {
      LOG.info("successfully compiled: {}", scriptNode.getFile());

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

boolean compile = getInstanceConfig().getCompileMode().shouldPrecompileCLI();
if (compile) {
  script = tryCompile(scriptNode);
  if (compile && script == null) {

相关文章

微信公众号

最新文章

更多

Ruby类方法