Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@ public JavaSupport loadJavaSupport() {
}

private void loadBundler() {
loadService.loadFromClassLoader(getClassLoader(), "jruby/bundler/startup.rb", false);
loadService.loadFromClassLoader("jruby/bundler/startup.rb", false);
}

@SuppressWarnings("ReturnValueIgnored")
Expand Down Expand Up @@ -1781,15 +1781,15 @@ private void initJavaSupport(ThreadContext context) {

private void initRubyKernel() {
// load Ruby parts of core
loadService.loadFromClassLoader(getClassLoader(), "jruby/kernel.rb", false);
loadService.loadFromClassLoader("jruby/kernel.rb", false);
}

private void initRubyPreludes() {
// We cannot load any .rb and debug new parser features
if (RubyInstanceConfig.DEBUG_PARSER) return;

// load Ruby parts of core
loadService.loadFromClassLoader(getClassLoader(), "jruby/preludes.rb", false);
loadService.loadFromClassLoader("jruby/preludes.rb", false);
}

public IRManager getIRManager() {
Expand Down Expand Up @@ -2630,7 +2630,7 @@ public RubyObjectSpecializer getObjectSpecializer() {
}

public static ClassLoader getClassLoader() {
// we try to getService the classloader that loaded JRuby, falling back on System
// we try to get the classloader that loaded JRuby, falling back on System
ClassLoader loader = Ruby.class.getClassLoader();
if (loader == null) {
loader = ClassLoader.getSystemClassLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public void load(Ruby runtime, boolean wrap) throws IOException {
RubyBigDecimal.createBigDecimal(context);

// using load since this file does not exist in MRI
loadService(context).loadFromClassLoader(Ruby.class.getClassLoader(), "jruby/bigdecimal.rb", false);
loadService(context).loadFromClassLoader("jruby/bigdecimal.rb", false);
}
}// BigDecimalLibrary
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void load(Ruby runtime, boolean wrap) {
var Object = objectClass(context);

// load Ruby parts of the 'jruby' library
loadService(context).loadFromClassLoader(runtime.getJRubyClassLoader(), "jruby/jruby.rb", false);
loadService(context).loadFromClassLoader("jruby/jruby.rb", false);

var JRuby = defineModule(context, "JRuby").
defineMethods(context, JRubyLibrary.class).defineMethods(context, JRubyUtilLibrary.class);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/javasupport/Java.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void load(Ruby runtime, boolean wrap) {
RubyClass objectClass = (RubyClass) getProxyClass(context, java.lang.Object.class);

// load Ruby parts of the 'java' library
loadService(context).loadFromClassLoader(Ruby.class.getClassLoader(), "jruby/java.rb", false);
loadService(context).loadFromClassLoader("jruby/java.rb", false);

// rewire ArrayJavaProxy superclass to point at Object, so it inherits Object behaviors
Access.getClass(context, "ArrayJavaProxy").
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,15 @@ public String[] getSuffixes() {
protected final Map<String, JarFile> jarFiles = new HashMap<>(0);

protected final Ruby runtime;
protected final ClassLoader systemClassLoader;
protected LibrarySearcher librarySearcher;

protected String mainScript;
protected String mainScriptPath;

public LoadService(Ruby runtime) {
this.runtime = runtime;
this.systemClassLoader = Ruby.getClassLoader();
if (RubyInstanceConfig.DEBUG_LOAD_TIMINGS) {
loadTimer = new TracingLoadTimer();
} else {
Expand Down Expand Up @@ -383,6 +385,10 @@ public void load(String file, boolean wrap) {
}
}

public void loadFromClassLoader(String file, boolean wrap) {
loadFromClassLoader(systemClassLoader, file, wrap);
}

public void loadFromClassLoader(ClassLoader classLoader, String file, boolean wrap) {
long startTime = loadTimer.startLoad("classloader:" + file);
int currentLine = runtime.getCurrentLine();
Expand Down
Loading