Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 53aef424a370
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d3c2aa3a51e8
Choose a head ref
  • 4 commits
  • 3 files changed
  • 1 contributor

Commits on Jul 29, 2015

  1. Copy the full SHA
    ebfd448 View commit details
  2. Copy the full SHA
    04f6fa5 View commit details
  3. Copy the full SHA
    852212b View commit details
  4. do not access the jrubyClassLoader field directly - use the getter

    ... as it might not have been initialized (code gets more predictable)
    kares committed Jul 29, 2015
    Copy the full SHA
    d3c2aa3 View commit details
12 changes: 6 additions & 6 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -2930,8 +2930,6 @@ public void compileAndLoadFile(String filename, InputStream in, boolean wrap) {
InputStream readStream = in;

Script script = null;
ScriptAndCode scriptAndCode = null;
String className = null;

try {
// read full contents of file, hash it, and try to load that class first
@@ -2943,12 +2941,12 @@ public void compileAndLoadFile(String filename, InputStream in, boolean wrap) {
}
buffer = baos.toByteArray();
String hash = JITCompiler.getHashForBytes(buffer);
className = JITCompiler.RUBY_JIT_PREFIX + ".FILE_" + hash;
final String className = JITCompiler.RUBY_JIT_PREFIX + ".FILE_" + hash;

// FIXME: duplicated from ClassCache
Class contents;
try {
contents = jrubyClassLoader.loadClass(className);
contents = getJRubyClassLoader().loadClass(className);
if (RubyInstanceConfig.JIT_LOADING_DEBUG) {
LOG.info("found jitted code for " + filename + " at class: " + className);
}
@@ -2974,7 +2972,9 @@ public void compileAndLoadFile(String filename, InputStream in, boolean wrap) {
// script was not found in cache above, so proceed to compile
RootNode scriptNode = (RootNode) parseFile(readStream, filename, null);
if (script == null) {
scriptAndCode = tryCompile(scriptNode, new ClassDefiningJRubyClassLoader(jrubyClassLoader));
ScriptAndCode scriptAndCode = tryCompile(scriptNode,
new ClassDefiningJRubyClassLoader(getJRubyClassLoader())
);
if (scriptAndCode != null) script = scriptAndCode.script();
}

@@ -3341,7 +3341,7 @@ public void tearDown(boolean systemExit) {
* release the runtime loader but not otherwise - you should do that manually.
*/
public void releaseClassLoader() {
JRubyClassLoader.close( getJRubyClassLoader() );
if ( jrubyClassLoader != null ) getJRubyClassLoader().close();
}

/**
1 change: 0 additions & 1 deletion core/src/main/java/org/jruby/embed/ScriptingContainer.java
Original file line number Diff line number Diff line change
@@ -1854,7 +1854,6 @@ public void terminate() {
LocalContextProvider provider = getProvider();
if (provider.isRuntimeInitialized()) {
provider.getRuntime().tearDown(false);
// NOTE: Ruby#tearDown does getJRubyClassLoader().tearDown()
provider.getRuntime().releaseClassLoader();
}
provider.terminate();
12 changes: 1 addition & 11 deletions core/src/main/java/org/jruby/util/JRubyClassLoader.java
Original file line number Diff line number Diff line change
@@ -135,17 +135,7 @@ public void close() {
*/
public static void close(final JRubyClassLoader loader) {
if ( loader == null ) return;
// URLClassLoader#close only available since Java 7 :
try {
URLClassLoader.class.getMethod("close").invoke(loader);
}
catch (NoSuchMethodException ex) { /* noop on Java 6 */ }
catch (IllegalAccessException ex) {
LOG.info("unexpected illegal access: ", ex);
}
catch (Exception ex) {
LOG.debug(ex);
}
loader.close();
}

@Deprecated