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: bb76e66fe81c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5223ee83edec
Choose a head ref

Commits on Aug 6, 2015

  1. Fix an embedded runtime memory leak in Java7ClassValue

    Commit 09f15f9 enabled the
    Java7ClassValue implementation by default which exposed a runtime
    memory leak in the embedded use case. This fixes that leak by wrapping
    values stored in the java.lang.ClassValue instance with a
    WeakReference.
    bbrowning committed Aug 6, 2015
    Copy the full SHA
    0a1b66c View commit details

Commits on Aug 28, 2015

  1. Copy the full SHA
    41d4a6a View commit details
  2. Copy the full SHA
    961f6ee View commit details
  3. Copy the full SHA
    492d310 View commit details
  4. Copy the full SHA
    0c99acc View commit details
  5. [Truffle] Store core files under jruby-truffle in the jar to avoid po…

    …lluting top-level directory in shaded jars.
    chrisseaton committed Aug 28, 2015
    Copy the full SHA
    9f1d4cb View commit details
  6. Copy the full SHA
    9c613b1 View commit details

Commits on Aug 29, 2015

  1. Copy the full SHA
    bb925e7 View commit details
  2. Merge pull request #3228 from bbrowning/classvalue-runtime-leak

    Fix an embedded runtime memory leak in Java7ClassValue
    headius committed Aug 29, 2015
    Copy the full SHA
    9c91759 View commit details
  3. Copy the full SHA
    be1d57f View commit details
  4. Copy the full SHA
    b9e23d3 View commit details
  5. Copy the full SHA
    6db2894 View commit details
  6. Copy the full SHA
    5af5d7d View commit details
  7. Copy the full SHA
    9c22739 View commit details

Commits on Aug 31, 2015

  1. Copy the full SHA
    d73d6ef View commit details
  2. Copy the full SHA
    522f220 View commit details
  3. Copy the full SHA
    9e9c13f View commit details
  4. Copy the full SHA
    30f1f4c View commit details
  5. Revert "Oops. Commit for the pom.rb changes I made in 145518e."

    This reverts commit 9c613b1.
    nirvdrum committed Aug 31, 2015
    Copy the full SHA
    d7e02ce View commit details
  6. Revert "Disable doclint for javadoc on JDK 8."

    This reverts commit 145518e.
    nirvdrum committed Aug 31, 2015
    Copy the full SHA
    573752a View commit details
  7. Copy the full SHA
    bf175cf View commit details
  8. Copy the full SHA
    769e023 View commit details
  9. Copy the full SHA
    fdafb5a View commit details
  10. Copy the full SHA
    0691ff2 View commit details
  11. Copy the full SHA
    abf1edf View commit details
  12. Copy the full SHA
    286c29b View commit details
  13. Copy the full SHA
    f1e2d63 View commit details
  14. Copy the full SHA
    4af1559 View commit details
  15. More places objects could hide from ObjectSpace - thread and fiber lo…

    …cals and at_exit handlers.
    chrisseaton committed Aug 31, 2015
    Copy the full SHA
    593fd60 View commit details
  16. Copy the full SHA
    0ed92b5 View commit details
  17. Merge branch 'jruby-1_7'

    * jruby-1_7:
      remove staging repo for jruby-openssl 0.9.11 (use released version)
      [build] test-out jruby-openssl 0.9.11 from staging
    
    Conflicts:
    	lib/pom.rb
    kares committed Aug 31, 2015
    Copy the full SHA
    34791ce View commit details
  18. Copy the full SHA
    49694f7 View commit details
  19. Copy the full SHA
    12e2381 View commit details
  20. Fix spec name.

    chrisseaton committed Aug 31, 2015
    Copy the full SHA
    36bffc3 View commit details

Commits on Sep 1, 2015

  1. Copy the full SHA
    fdec4d5 View commit details
  2. Copy the full SHA
    ec56c06 View commit details
  3. Copy the full SHA
    039a405 View commit details
  4. Copy the full SHA
    527bc08 View commit details
  5. Copy the full SHA
    35aa81a View commit details
  6. Merge pull request #3299 from jruby/objectspace-specs

    ObjectSpace specs
    chrisseaton committed Sep 1, 2015
    Copy the full SHA
    4425d99 View commit details
  7. Copy the full SHA
    48a030e View commit details
  8. Merge pull request #3296 from jruby/truffle-metrics

    [Truffle] Add tools for measuring startup time and memory consumption.
    chrisseaton committed Sep 1, 2015
    Copy the full SHA
    eb79c9b View commit details
  9. Merge branch 'master' into truffle-head

    Conflicts:
    	core/src/main/java/org/jruby/util/cli/Options.java
    chrisseaton committed Sep 1, 2015
    Copy the full SHA
    5223ee8 View commit details
Showing with 902 additions and 140 deletions.
  1. +28 −0 core/src/main/java/org/jruby/Main.java
  2. +8 −1 core/src/main/java/org/jruby/Ruby.java
  3. +6 −2 core/src/main/java/org/jruby/util/cli/Options.java
  4. +23 −4 core/src/main/java/org/jruby/util/collections/Java7ClassValue.java
  5. +4 −1 lib/pom.rb
  6. +1 −1 lib/pom.xml
  7. +0 −1 maven/jruby-complete/pom.rb
  8. +8 −1 pom.rb
  9. +16 −0 pom.xml
  10. +18 −0 spec/regression/embedded_runtime_leak_spec.rb
  11. +127 −0 spec/ruby/core/objectspace/each_object_spec.rb
  12. +32 −0 spec/ruby/core/objectspace/fixtures.rb
  13. +7 −17 spec/ruby/core/thread/raise_spec.rb
  14. +1 −0 spec/tags/ruby/core/objectspace/each_object_tags.txt
  15. +0 −1 spec/truffle/tags/core/time/_load_tags.txt
  16. +0 −1 spec/truffle/tags/core/time/getlocal_tags.txt
  17. +0 −2 spec/truffle/tags/core/time/localtime_tags.txt
  18. +1 −0 spec/truffle/tags/library/weakref/send_tags.txt
  19. +0 −1 spec/truffle/truffle.mspec
  20. +59 −0 test/truffle/memory/minimum-heap.rb
  21. +33 −0 test/truffle/memory/total-allocation.rb
  22. +25 −0 test/truffle/startup/count-classes.rb
  23. +14 −0 test/truffle/startup/jruby-timed
  24. +49 −0 test/truffle/startup/process-times.rb
  25. +21 −0 test/truffle/subjects/client.rb
  26. +24 −0 test/truffle/subjects/server.rb
  27. +1 −1 tool/jruby_eclipse
  28. +1 −0 truffle/pom.rb
  29. +1 −0 truffle/pom.xml
  30. +3 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/FiberNodes.java
  31. +8 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  32. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/core/MutexNodes.java
  33. +2 −6 truffle/src/main/java/org/jruby/truffle/nodes/core/ObjectSpaceNodes.java
  34. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/core/QueueNodes.java
  35. +3 −3 truffle/src/main/java/org/jruby/truffle/nodes/core/SizedQueueNodes.java
  36. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  37. +43 −43 truffle/src/main/java/org/jruby/truffle/nodes/core/ThreadNodes.java
  38. +2 −2 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/IOPrimitiveNodes.java
  39. +1 −0 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/RubiniusPrimitiveManager.java
  40. +14 −9 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/ThreadPrimitiveNodes.java
  41. +5 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/TimePrimitiveNodes.java
  42. +1 −1 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/VMPrimitiveNodes.java
  43. +65 −0 truffle/src/main/java/org/jruby/truffle/nodes/rubinius/WeakRefPrimitiveNodes.java
  44. +26 −9 truffle/src/main/java/org/jruby/truffle/nodes/supercall/LookupSuperMethodNode.java
  45. +14 −1 truffle/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  46. +1 −0 truffle/src/main/java/org/jruby/truffle/runtime/layouts/Layouts.java
  47. +32 −0 truffle/src/main/java/org/jruby/truffle/runtime/layouts/rubinius/WeakRefLayout.java
  48. +59 −6 truffle/src/main/java/org/jruby/truffle/runtime/object/ObjectGraph.java
  49. +9 −0 truffle/src/main/java/org/jruby/truffle/runtime/subsystems/AtExitManager.java
  50. +18 −5 truffle/src/main/java/org/jruby/truffle/runtime/subsystems/ObjectSpaceManager.java
  51. +2 −2 truffle/src/main/java/org/jruby/truffle/runtime/subsystems/ThreadManager.java
  52. +1 −1 truffle/src/main/java/org/jruby/truffle/runtime/util/FileUtils.java
  53. +2 −2 truffle/src/main/ruby/core.rb
  54. +0 −1 truffle/src/main/ruby/core/rubinius/api/shims/{thread_common.rb → thread_bootstrap.rb}
  55. +70 −0 truffle/src/main/ruby/core/rubinius/bootstrap/weakref.rb
  56. +7 −0 truffle/src/main/ruby/core/thread.rb
28 changes: 28 additions & 0 deletions core/src/main/java/org/jruby/Main.java
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.SafePropertyAccessor;
import org.jruby.util.cli.Options;
import org.jruby.util.cli.OutputStrings;
import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;
@@ -183,6 +184,8 @@ public static class Status {
* @param args command-line args, provided by the JVM.
*/
public static void main(String[] args) {
printTruffleTimeMetric("before-main");

doGCJCheck();

Main main;
@@ -217,6 +220,9 @@ public static void main(String[] args) {

System.exit(1);
}

printTruffleTimeMetric("after-main");
printTruffleMemoryMetric();
}

public Status run(String[] args) {
@@ -531,6 +537,28 @@ protected static int handleRaiseException(RaiseException rj) {
}
}

public static void printTruffleTimeMetric(String id) {
if (Options.TRUFFLE_METRICS_TIME.load()) {
final long millis = System.currentTimeMillis();
System.err.printf("%s %d.%03d%n", id, millis / 1000, millis % 1000);
}
}

private static void printTruffleMemoryMetric() {
if (Options.TRUFFLE_METRICS_MEMORY_USED_ON_EXIT.load()) {
for (int n = 0; n < 10; n++) {
System.gc();
}

try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}

System.err.printf("allocated %d%n", ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed());
}
}

private final RubyInstanceConfig config;
}

9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -79,7 +79,6 @@
import org.jruby.common.RubyWarnings;
import org.jruby.compiler.JITCompiler;
import org.jruby.embed.Extension;
import org.jruby.exceptions.JumpException;
import org.jruby.exceptions.MainExitException;
import org.jruby.exceptions.RaiseException;
import org.jruby.exceptions.Unrescuable;
@@ -549,7 +548,9 @@ public void runFromMain(InputStream inputStream, String filename) {
return;
}

Main.printTruffleTimeMetric("before-parse-initial");
ParseResult parseResult = parseFromMain(filename, inputStream);
Main.printTruffleTimeMetric("after-parse-initial");

// if no DATA, we're done with the stream, shut it down
if (fetchGlobalConstant("DATA") == null) {
@@ -843,7 +844,9 @@ public IRubyObject runInterpreter(ThreadContext context, Node rootNode, IRubyObj
if (getInstanceConfig().getCompileMode() == CompileMode.TRUFFLE) {
assert rootNode instanceof RootNode;
assert self == getTopSelf();
Main.printTruffleTimeMetric("before-run");
getTruffleContext().execute((RootNode) rootNode);
Main.printTruffleTimeMetric("after-run");
return getNil();
} else {
return Interpreter.getInstance().execute(this, rootNode, self);
@@ -891,6 +894,8 @@ public TruffleContextInterface getTruffleContext() {
}

private TruffleContextInterface loadTruffleContext() {
Main.printTruffleTimeMetric("before-load-truffle-context");

final Class<?> clazz;

try {
@@ -910,6 +915,8 @@ private TruffleContextInterface loadTruffleContext() {

truffleContext.initialize();

Main.printTruffleTimeMetric("after-load-truffle-context");

return truffleContext;
}

8 changes: 6 additions & 2 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -97,7 +97,8 @@ public class Options {
public static final Option<Boolean> INVOKEDYNAMIC_CACHE_CONSTANTS = bool(INVOKEDYNAMIC, "invokedynamic.cache.constants", true, "Use invokedynamic to load constants.");
public static final Option<Boolean> INVOKEDYNAMIC_CACHE_LITERALS = bool(INVOKEDYNAMIC, "invokedynamic.cache.literals", true, "Use invokedynamic to load literals.");
public static final Option<Boolean> INVOKEDYNAMIC_CACHE_IVARS = bool(INVOKEDYNAMIC, "invokedynamic.cache.ivars", true, "Use invokedynamic to get/set instance variables.");
public static final Option<Boolean> INVOKEDYNAMIC_CLASS_VALUES = bool(INVOKEDYNAMIC, "invokedynamic.class.values", true, "Use ClassValue to store class-specific data.");
// ClassValue in OpenJDK appears to root data even after it goes away, so this is disabled again. See jruby/jruby#3228
public static final Option<Boolean> INVOKEDYNAMIC_CLASS_VALUES = bool(INVOKEDYNAMIC, "invokedynamic.class.values", false, "Use ClassValue to store class-specific data.");
public static final Option<Integer> INVOKEDYNAMIC_GLOBAL_MAXFAIL = integer(INVOKEDYNAMIC, "invokedynamic.global.maxfail", 100, "Maximum global cache failures after which to use slow path.");
public static final Option<Boolean> INVOKEDYNAMIC_HANDLES = bool(INVOKEDYNAMIC, "invokedynamic.handles", false, "Use MethodHandles rather than generated code to bind Ruby methods.");

@@ -125,7 +126,7 @@ public class Options {
public static final Option<Boolean> IR_WRITING_DEBUG = bool(IR, "ir.writing.debug", false, "Debug writing JRuby IR file.");
public static final Option<String> IR_INLINE_COMPILER_PASSES = string(IR, "ir.inline_passes", "Specify comma delimeted list of passes to run after inlining a method.");

public static final Option<String> TRUFFLE_CORE_LOAD_PATH = string(TRUFFLE, "truffle.core.load_path", "truffle:/", "Directory to load the Truffle core library from.");
public static final Option<String> TRUFFLE_CORE_LOAD_PATH = string(TRUFFLE, "truffle.core.load_path", "truffle:/jruby-truffle", "Directory to load the Truffle core library from.");

public static final Option<Integer> TRUFFLE_DISPATCH_POLYMORPHIC_MAX = integer(TRUFFLE, "truffle.dispatch.polymorphic.max", 8, "Maximum size of a polymorphic call site cache.");
public static final Option<Integer> TRUFFLE_ARRAYS_UNINITIALIZED_SIZE = integer(TRUFFLE, "truffle.arrays.uninitialized_size", 32, "How large an array to allocate when we have no other information to go on.");
@@ -151,6 +152,9 @@ public class Options {

public static final Option<Boolean> TRUFFLE_INCLUDE_CORE_FILE_CALLERS_IN_SET_TRACE_FUNC = bool(TRUFFLE, "truffle.set_trace_func.include_core_file_callers", false, "Include internal core library calls in set_trace_func output.");

public static final Option<Boolean> TRUFFLE_METRICS_TIME = bool(TRUFFLE, "truffle.metrics.time", false, "Print the time at various stages of VM operation.");
public static final Option<Boolean> TRUFFLE_METRICS_MEMORY_USED_ON_EXIT = bool(TRUFFLE, "truffle.metrics.memory_used_on_exit", false, "Print the size of heap memory in use on exit.");

public static final Option<Boolean> NATIVE_ENABLED = bool(NATIVE, "native.enabled", true, "Enable/disable native code, including POSIX features and C exts.");
public static final Option<Boolean> NATIVE_VERBOSE = bool(NATIVE, "native.verbose", false, "Enable verbose logging of native extension loading.");
public static final Option<Boolean> FFI_COMPILE_DUMP = bool(NATIVE, "ffi.compile.dump", false, "Dump bytecode-generated FFI stubs to console.");
27 changes: 23 additions & 4 deletions core/src/main/java/org/jruby/util/collections/Java7ClassValue.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package org.jruby.util.collections;

import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;

/**
* A proxy cache that uses Java 7's ClassValue.
*/
@@ -10,13 +14,28 @@ public Java7ClassValue(ClassValueCalculator<T> calculator) {
}

public T get(Class cls) {
return proxy.get(cls);
// We don't check for null on the WeakReference since the
// value is strongly referenced by proxy's list
return (T)proxy.get(cls).get();
}

private final java.lang.ClassValue<T> proxy = new java.lang.ClassValue<T>() {
// If we put any objects that reference an org.jruby.Ruby runtime
// (like RubyClass instances) in here we run into a circular
// reference situation that GC isn't handling where they will
// always be strongly referenced and never garbage collected. We
// break that by holding the computed values with a WeakReference.
// This appears to be a bug in OpenJDK. See jruby/jruby#3228.
private final java.lang.ClassValue<WeakReference<T>> proxy = new java.lang.ClassValue<WeakReference<T>>() {
// Strongly reference all computed values so they don't get
// garbage collected until this Java7ClassValue instance goes
// out of scope
private final List<T> values = new ArrayList<T>();

@Override
protected T computeValue(Class<?> type) {
return calculator.computeValue(type);
protected WeakReference<T> computeValue(Class<?> type) {
T value = calculator.computeValue(type);
values.add(value);
return new WeakReference(value);
}
};
}
5 changes: 4 additions & 1 deletion lib/pom.rb
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ def version

default_gems =
[
ImportedGem.new( 'jruby-openssl', '0.9.10', true ),
ImportedGem.new( 'jruby-openssl', '0.9.11', true ),
ImportedGem.new( 'jruby-readline', '1.0', false ),
ImportedGem.new( 'rake', 'rake.version', true ),
ImportedGem.new( 'rdoc', 'rdoc.version', true ),
@@ -72,6 +72,9 @@ def to_pathname
:id => 'rubygems-releases' )
repository( :url => 'http://rubygems-proxy.torquebox.org/releases',
:id => 'tb-rubygems-releases' )
# for testing out jruby-ossl before final release :
#repository( :url => 'http://oss.sonatype.org/content/repositories/staging',
# :id => 'gem-staging' )

plugin( :clean,
:filesets => [ { :directory => '${basedir}/ruby/gems/shared/specifications/default',
2 changes: 1 addition & 1 deletion lib/pom.xml
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ DO NOT MODIFIY - GENERATED CODE
<dependency>
<groupId>rubygems</groupId>
<artifactId>jruby-openssl</artifactId>
<version>0.9.10</version>
<version>0.9.11</version>
<type>gem</type>
<scope>provided</scope>
<exclusions>
1 change: 0 additions & 1 deletion maven/jruby-complete/pom.rb
Original file line number Diff line number Diff line change
@@ -117,6 +117,5 @@
jdk '1.8'
end
plugin :invoker, :pomExcludes => ['osgi_many_bundles_with_embedded_gems_felix-3.2/pom.xml', '${its.j2ee}', '${its.osgi}']
properties 'javadoc.opts' => '-Xdoclint:none'
end
end
9 changes: 8 additions & 1 deletion pom.rb
Original file line number Diff line number Diff line change
@@ -288,7 +288,7 @@
execute_goals('jar-no-fork', :id => 'attach-sources')
end
plugin(:javadoc) do
execute_goals('jar', :id => 'attach-javadocs', :configuration => [ xml('<additionalparam>${javadoc.opts}</additionalparam>') ])
execute_goals('jar', :id => 'attach-javadocs')
end
end

@@ -299,6 +299,13 @@
properties 'invoker.skip' => false
end

profile 'jdk8' do
activation do
jdk '1.8'
end
plugin :javadoc, :additionalparam => '-Xdoclint:none'
end

reporting do
plugin( :'project-info-reports', '2.4',
'dependencyLocationsEnabled' => 'false',
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -871,5 +871,21 @@ DO NOT MODIFIY - GENERATED CODE
<invoker.skip>false</invoker.skip>
</properties>
</profile>
<profile>
<id>jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
18 changes: 18 additions & 0 deletions spec/regression/embedded_runtime_leak_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe "embedded runtimes" do
it "should not leak runtimes after tearing them down" do
num_runtimes = 10
mbean = java.lang.management.ManagementFactory.getMemoryMXBean
num_runtimes.times do
instance = org.jruby.Ruby.newInstance
instance.evalScriptlet <<-EOS
# eat up some memory in each runtime
$arr = 500000.times.map { |i| "foobarbaz\#{i}" }
EOS
instance.tearDown(false)
# Make sure GC can keep up
while mbean.getObjectPendingFinalizationCount > 0
sleep 0.2
end
end.should_not raise_error
end
end
Loading