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: 1ff060465958
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 75b7542a934d
Choose a head ref
  • 5 commits
  • 4 files changed
  • 3 contributors

Commits on Sep 28, 2015

  1. [Truffle] Better name.

    chrisseaton committed Sep 28, 2015
    Copy the full SHA
    94ae555 View commit details

Commits on Sep 29, 2015

  1. put all the temporary jar created by the JRubyClassLoader into on dir…

    …ectory
    
    these temporary jars get cleaned up after the jvm exits BUT on hard kill
    the jars do not get cleaned. creating a directory 'jruby-${PID}' might help
    to clean up easier.
    
    Sponsored by Lookout Inc.
    mkristian committed Sep 29, 2015
    Copy the full SHA
    28f6507 View commit details
  2. Copy the full SHA
    89ee83c View commit details
  3. [Truffle] Fix typo.

    chrisseaton committed Sep 29, 2015
    Copy the full SHA
    89e1d0c View commit details
  4. Copy the full SHA
    75b7542 View commit details
20 changes: 19 additions & 1 deletion core/src/main/java/org/jruby/util/JRubyClassLoader.java
Original file line number Diff line number Diff line change
@@ -35,8 +35,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.management.ManagementFactory;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;

import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;
@@ -60,10 +62,26 @@ public class JRubyClassLoader extends ClassDefiningJRubyClassLoader {

private Runnable unloader;

private File tempdir;

public JRubyClassLoader(ClassLoader parent) {
super(parent);
}

private File getTempDir() {
if (tempdir == null) {
String processName = ManagementFactory.getRuntimeMXBean().getName();
long pid = Long.parseLong(processName.split("@")[0]);
File dir = new File(System.getProperty("java.io.tmpdir"), "jruby-" + pid);
if (dir.mkdirs()) {
dir.deleteOnExit();
}
;
tempdir = dir;
}
return tempdir;
}

// Change visibility so others can see it
@Override
public void addURL(URL url) {
@@ -74,7 +92,7 @@ public void addURL(URL url) {
OutputStream out = null;
try
{
File f = File.createTempFile( "jruby", new File(url.getFile()).getName());
File f = File.createTempFile("jruby", new File(url.getFile()).getName(), getTempDir());
f.deleteOnExit();
out = new BufferedOutputStream( new FileOutputStream( f ) );
in = new BufferedInputStream( url.openStream() );
32 changes: 1 addition & 31 deletions spec/truffle/truffle.mspec
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ class MSpecScript
"spec/ruby/language"
]

core = [
set :core, [
"spec/ruby/core",

# Can't load these - so tags aren't enough to exclude them. The problem is
@@ -39,36 +39,6 @@ class MSpecScript
"^spec/ruby/core/io/advise_spec.rb",
]

core += [
# Windows
"^spec/ruby/core/method/source_location_spec.rb",
"^spec/ruby/core/struct/each_spec.rb",
"^spec/ruby/core/struct/element_reference_spec.rb",
"^spec/ruby/core/struct/element_set_spec.rb",
"^spec/ruby/core/struct/eql_spec.rb",
"^spec/ruby/core/struct/equal_value_spec.rb",
"^spec/ruby/core/struct/hash_spec.rb",
"^spec/ruby/core/struct/initialize_copy_spec.rb",
"^spec/ruby/core/struct/initialize_spec.rb",
"^spec/ruby/core/struct/inspect_spec.rb",
"^spec/ruby/core/struct/instance_variables_spec.rb",
"^spec/ruby/core/struct/length_spec.rb",
"^spec/ruby/core/struct/members_spec.rb",
"^spec/ruby/core/struct/new_spec.rb",
"^spec/ruby/core/struct/select_spec.rb",
"^spec/ruby/core/struct/size_spec.rb",
"^spec/ruby/core/struct/struct_spec.rb",
"^spec/ruby/core/struct/to_a_spec.rb",
"^spec/ruby/core/struct/to_h_spec.rb",
"^spec/ruby/core/struct/to_s_spec.rb",
"^spec/ruby/core/struct/values_at_spec.rb",
"^spec/ruby/core/struct/values_spec.rb",
"^spec/ruby/core/symbol/versions/encoding_1.9_spec.rb",
"^spec/ruby/core/unboundmethod/source_location_spec.rb",
] if windows?

set :core, core

set :library, [
"spec/ruby/library",

Original file line number Diff line number Diff line change
@@ -95,17 +95,17 @@ public RandomizerRandIntPrimitiveNode(RubyContext context, SourceSection sourceS
@Specialization
public int randomizerRandInt(DynamicObject randomizer, int limit) {
final Random r = Layouts.RANDOMIZER.getRandom(randomizer);
return (int) putIntoRange(r, (long) limit);
return (int) randInt(r, (long) limit);
}

@Specialization
public long randomizerRandInt(DynamicObject randomizer, long limit) {
final Random r = Layouts.RANDOMIZER.getRandom(randomizer);
return putIntoRange(r, limit);
return randInt(r, limit);
}

@TruffleBoundary
protected static long putIntoRange(Random r, long limit) {
protected static long randInt(Random r, long limit) {
return RubyRandom.randLimitedFixnumInner(r, limit);
}

Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@
import org.jcodings.specific.UTF8Encoding;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.objects.AllocateObjectNode;
import org.jruby.truffle.nodes.objects.AllocateObjectNodeGen;
@@ -326,12 +327,11 @@ public TimeEnvZonePrimitiveNode(RubyContext context, SourceSection sourceSection
super(context, sourceSection);
}

@TruffleBoundary
@Specialization
public Object timeEnvZone(DynamicObject time) {
final DateTime dt = Layouts.TIME.getDateTime(time);

final String timezone = dt.getZone().getShortName(dt.getMillis());

return Layouts.STRING.createString(getContext().getCoreLibrary().getStringFactory(), RubyString.encodeBytelist(timezone, UTF8Encoding.INSTANCE), StringSupport.CR_UNKNOWN, null);
}