本文整理了Java中org.jruby.Ruby.getInstanceConfig
方法的一些代码示例,展示了Ruby.getInstanceConfig
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getInstanceConfig
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getInstanceConfig
暂无
代码示例来源:origin: org.jruby/jruby-core
public JITCompiler(Ruby runtime) {
this.runtime = runtime;
this.config = runtime.getInstanceConfig();
this.executor = new ThreadPoolExecutor(
0, // don't start threads until needed
2, // two max
60, // stop then if no jitting for 60 seconds
TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
new DaemonThreadFactory("Ruby-" + runtime.getRuntimeNumber() + "-JIT", Thread.MIN_PRIORITY));
}
代码示例来源:origin: org.jruby/jruby-core
private void doSetContextClassLoader(Ruby runtime) {
// set thread context JRuby classloader here, for the main thread
try {
Thread.currentThread().setContextClassLoader(runtime.getJRubyClassLoader());
} catch (SecurityException se) {
// can't set TC classloader
if (runtime.getInstanceConfig().isVerbose()) {
config.getError().println("WARNING: Security restrictions disallowed setting context classloader for main thread.");
}
}
}
代码示例来源:origin: org.jruby/jruby-complete
public void prepareBacktrace(ThreadContext context) {
// if it's null, build a backtrace
if (backtraceData == null) {
backtraceData = context.runtime.getInstanceConfig().getTraceType().getBacktrace(context);
}
}
代码示例来源:origin: org.jruby/jruby-core
public void prepareBacktrace(ThreadContext context) {
// if it's null, build a backtrace
if (backtraceData == null) {
backtraceData = context.runtime.getInstanceConfig().getTraceType().getBacktrace(context);
}
}
代码示例来源:origin: org.jruby/jruby-complete
RubyInstanceConfig getGlobalRuntimeConfig(AbstractLocalContextProvider provider) {
// make sure we do not yet initialize the runtime here
if ( isGlobalRuntimeReady() ) {
return getGlobalRuntime(provider).getInstanceConfig();
}
return provider.config;
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Returns the environment as a hash of Ruby strings.
*
* @param runtime
*/
public static Map<RubyString, RubyString> environmentVariableMap(Ruby runtime) {
@SuppressWarnings("unchecked")
Map<String, String> env = runtime.getInstanceConfig().getEnvironment();
if ( env != null ) return asMapOfRubyStrings(runtime, env);
if ( Ruby.isSecurityRestricted() ) return Collections.emptyMap();
return asMapOfRubyStrings(runtime, System.getenv());
}
代码示例来源:origin: org.jruby/jruby-core
@Deprecated // un-used
public static void rewriteStackTrace(final Ruby runtime, final Throwable e) {
final StackTraceElement[] javaTrace = e.getStackTrace();
BacktraceData backtraceData = runtime.getInstanceConfig().getTraceType().getIntegratedBacktrace(runtime.getCurrentContext(), javaTrace);
e.setStackTrace(RaiseException.javaTraceFromRubyTrace(backtraceData.getBacktrace(runtime)));
}
代码示例来源:origin: org.jruby/jruby-complete
@Deprecated // un-used
public static void rewriteStackTrace(final Ruby runtime, final Throwable e) {
final StackTraceElement[] javaTrace = e.getStackTrace();
BacktraceData backtraceData = runtime.getInstanceConfig().getTraceType().getIntegratedBacktrace(runtime.getCurrentContext(), javaTrace);
e.setStackTrace(RaiseException.javaTraceFromRubyTrace(backtraceData.getBacktrace(runtime)));
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(meta = true) // for RubyGems' JRuby defaults
public static IRubyObject classpath_launcher(ThreadContext context, IRubyObject recv) {
final Ruby runtime = context.runtime;
String launcher = runtime.getInstanceConfig().getEnvironment().get("RUBY");
if ( launcher == null ) launcher = ClasspathLauncher.jrubyCommand(runtime);
return runtime.newString(launcher);
}
代码示例来源:origin: org.jruby/jruby-complete
public BacktraceData getBacktraceData(ThreadContext context, StackTraceElement[] javaTrace) {
return new BacktraceData(
javaTrace,
context.getBacktrace(),
false,
context.runtime.getInstanceConfig().getBacktraceMask(),
false);
}
},
代码示例来源:origin: org.jruby/jruby-complete
public static IRubyObject rewriteStackTraceAndThrow(ThreadContext context, Throwable t) {
Ruby runtime = context.runtime;
StackTraceElement[] javaTrace = t.getStackTrace();
BacktraceData backtraceData = runtime.getInstanceConfig().getTraceType().getIntegratedBacktrace(context, javaTrace);
t.setStackTrace(RaiseException.javaTraceFromRubyTrace(backtraceData.getBacktrace(runtime)));
throwException(t);
return null; // not reached
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "extra_gem_paths", meta = true) // used from RGs' JRuby defaults
public static IRubyObject extra_gem_paths(ThreadContext context, IRubyObject recv) {
final Ruby runtime = context.runtime;
final List<String> extraGemPaths = runtime.getInstanceConfig().getExtraGemPaths();
IRubyObject[] extra_gem_paths = new IRubyObject[extraGemPaths.size()];
int i = 0; for (String gemPath : extraGemPaths) {
extra_gem_paths[i++] = runtime.newString(gemPath);
}
return RubyArray.newArrayNoCopy(runtime, extra_gem_paths);
}
代码示例来源:origin: org.jruby/jruby-core
public static IRubyObject rewriteStackTraceAndThrow(ThreadContext context, Throwable t) {
Ruby runtime = context.runtime;
StackTraceElement[] javaTrace = t.getStackTrace();
BacktraceData backtraceData = runtime.getInstanceConfig().getTraceType().getIntegratedBacktrace(context, javaTrace);
t.setStackTrace(RaiseException.javaTraceFromRubyTrace(backtraceData.getBacktrace(runtime)));
throwException(t);
return null; // not reached
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(name = "did_you_mean_disabled?")
public static IRubyObject did_you_mean_disabled_p(ThreadContext context, IRubyObject self) {
return context.runtime.newBoolean(context.runtime.getInstanceConfig().isDisableDidYouMean());
}
}
代码示例来源:origin: org.jruby/jruby-complete
static RubyInstanceConfig getGlobalRuntimeConfigOrNew() {
return Ruby.isGlobalRuntimeReady() ?
Ruby.getGlobalRuntime().getInstanceConfig() :
new RubyInstanceConfig();
}
代码示例来源:origin: org.jruby/jruby-complete
public MixedModeIRMethod(IRScope method, Visibility visibility, RubyModule implementationClass) {
super(method, visibility, implementationClass);
// disable JIT if JIT is disabled
if (!implementationClass.getRuntime().getInstanceConfig().getCompileMode().shouldJIT() ||
Options.JIT_THRESHOLD.load() < 0) {
callCount = -1;
}
// This is so profiled callsite can access the sites original method (callsites has IRScope in it).
method.compilable = this;
}
代码示例来源:origin: org.jruby/jruby-complete
/**
* Render the current backtrace as a string to the given StringBuilder. This will honor the currently-configured
* backtrace format and content.
*
* @param sb the StringBuilder to which to render the backtrace
*/
public void renderCurrentBacktrace(StringBuilder sb) {
TraceType traceType = runtime.getInstanceConfig().getTraceType();
BacktraceData backtraceData = traceType.getBacktrace(this);
traceType.getFormat().renderBacktrace(backtraceData.getBacktrace(runtime), sb, false);
}
代码示例来源:origin: org.jruby/jruby-complete
public static int matcherSearch(ThreadContext context, Matcher matcher, int start, int range, int option) {
if (!context.runtime.getInstanceConfig().isInterruptibleRegexps()) return matcher.search(start, range, option);
try {
RubyThread thread = context.getThread();
SearchMatchTask task = new SearchMatchTask(thread, start, range, option, false);
return thread.executeTask(context, matcher, task);
} catch (InterruptedException e) {
throw context.runtime.newInterruptedRegexpError("Regexp Interrupted");
}
}
代码示例来源:origin: org.jruby/jruby-complete
@JIT @Interp
public static RubyString freezeLiteralString(RubyString string, ThreadContext context, String file, int line) {
Ruby runtime = context.runtime;
if (runtime.getInstanceConfig().isDebuggingFrozenStringLiteral()) {
// stuff location info into the string and then freeze it
RubyArray info = (RubyArray) runtime.newArray(runtime.newString(file).freeze(context), runtime.newFixnum(line)).freeze(context);
string.setInstanceVariable(RubyString.DEBUG_INFO_FIELD, info);
}
string.setFrozen(true);
return string;
}
代码示例来源:origin: org.jruby/jruby-core
@JIT @Interp
public static RubyString freezeLiteralString(RubyString string, ThreadContext context, String file, int line) {
Ruby runtime = context.runtime;
if (runtime.getInstanceConfig().isDebuggingFrozenStringLiteral()) {
// stuff location info into the string and then freeze it
RubyArray info = (RubyArray) runtime.newArray(runtime.newString(file).freeze(context), runtime.newFixnum(line)).freeze(context);
string.setInstanceVariable(RubyString.DEBUG_INFO_FIELD, info);
}
string.setFrozen(true);
return string;
}
内容来源于网络,如有侵权,请联系作者删除!