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: 03d227b67395
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 05a520725048
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Sep 17, 2015

  1. Copy the full SHA
    eb18bb8 View commit details
  2. Copy the full SHA
    05a5207 View commit details
Showing with 27 additions and 22 deletions.
  1. +7 −5 COPYING
  2. +10 −9 test/truffle/memory/minimum-heap.rb
  3. +5 −3 test/truffle/memory/total-allocation.rb
  4. +5 −3 test/truffle/startup/count-classes.rb
  5. +0 −2 truffle/src/main/ruby/core/rubinius/README.md
12 changes: 7 additions & 5 deletions COPYING
Original file line number Diff line number Diff line change
@@ -64,11 +64,13 @@ below. Also see LICENSE.RUBY for most files found in lib/ruby/stdlib.
The Rubinius API implementation in truffle/src/main/ruby/core/rubinius/api
is copyright (c) 2011, Evan Phoenix, and released under the 3-clause BSD license.

The Rubinius core library implementation
in truffle/src/main/ruby/core/rubinius/bootstrap
and truffle/src/main/ruby/core/rubinius/common is
copyright (c) 2007-2014, Evan Phoenix and contributors,
and released under the 3-clause BSD license.
The Rubinius core library implementation in truffle/src/main/ruby/core/rubinius
is copyright (c) 2007-2015, Evan Phoenix and contributors, and released under
the 3-clause BSD license.

Some parts of the Truffle Java code is derived from Rubinius C++ code which is
copyright (c) 2007-2015, Evan Phoenix and contributors, and released under the
3-clause BSD license.

Some parts of the RubySL implementations of the stdlib in lib/ruby/truffle/rubysl
are copyright (c) 2013 Brian Shirai and are licensed under the 3-clause BSD license.
19 changes: 10 additions & 9 deletions test/truffle/memory/minimum-heap.rb
Original file line number Diff line number Diff line change
@@ -11,18 +11,19 @@
# Not run it fast - just run it at all.

# For example:
# $ ruby test/truffle/memory/minimum-heap.rb bin/jruby "-X+T -e 'puts 14'"
# $ ruby test/truffle/memory/minimum-heap.rb foo bin/jruby "-X+T -e 'puts 14'"

COMMAND = ARGV[0]
OPTIONS = ARGV[1]
NAME = ARGV[0]
COMMAND = ARGV[1]
OPTIONS = ARGV[2]

TOLERANCE = 1
TOLERANCE = 1024
UPPER_FACTOR = 4

def can_run(heap)
print "trying #{heap} MB... "
print "trying #{heap} KB... "

output = `#{COMMAND} -J-Xmx#{heap}m #{OPTIONS} 2>&1`
output = `#{COMMAND} -J-Xmx#{heap}k #{OPTIONS} 2>&1`
can_run = !output.include?('OutOfMemoryError')

if can_run
@@ -37,14 +38,14 @@ def can_run(heap)
puts "looking for an upper bound..."

lower = 0
upper = 1
upper = 1024

while !can_run(upper)
lower = upper
upper *= UPPER_FACTOR
end

puts "binary search between #{lower} and #{upper} MB..."
puts "binary search between #{lower} and #{upper} KB..."

while upper - lower > TOLERANCE
mid = lower + (upper - lower) / 2
@@ -56,4 +57,4 @@ def can_run(heap)
end
end

puts "minimum heap: #{upper} MB"
puts "#{NAME}: #{upper} KB"
8 changes: 5 additions & 3 deletions test/truffle/memory/total-allocation.rb
Original file line number Diff line number Diff line change
@@ -10,12 +10,14 @@
# Calculates the total memory allocated to run a program.

# For example:
# $ bin/jruby -X+T -Xtruffle.metrics.memory_used_on_exit=true -J-verbose:gc -e 'puts 14' 2>&1 | ruby test/truffle/memory/total-allocation.rb
# $ bin/jruby -X+T -Xtruffle.metrics.memory_used_on_exit=true -J-verbose:gc -e 'puts 14' 2>&1 | ruby test/truffle/memory/total-allocation.rb foo

NAME = ARGV[0]

on_exit = nil
allocated = 0

ARGF.each do |line|
$stdin.each_line do |line|
if line =~ /(\d+)K->(\d+)K/
before = $1.to_i * 1024
after = $2.to_i * 1024
@@ -30,4 +32,4 @@

allocated += on_exit

puts "total-allocation: #{allocated/1024.0} KB"
puts "#{NAME}: #{allocated/1024} KB"
8 changes: 5 additions & 3 deletions test/truffle/startup/count-classes.rb
Original file line number Diff line number Diff line change
@@ -10,16 +10,18 @@
# Counts how many classes are loaded to run a program.

# For example:
# $ bin/jruby -X+T -J-XX:+TraceClassLoading -e 'puts 14' 2>&1 | ruby test/truffle/startup/count-classes.rb
# $ bin/jruby -X+T -J-XX:+TraceClassLoading -e 'puts 14' 2>&1 | ruby test/truffle/startup/count-classes.rb foo

NAME = ARGV[0]

classes = 0

ARGF.each do |line|
$stdin.each_line do |line|
if line.start_with? '[Loaded '
classes += 1
else
puts line
end
end

puts "classes-loaded #{classes}"
puts "#{NAME}: #{classes}"
2 changes: 0 additions & 2 deletions truffle/src/main/ruby/core/rubinius/README.md
Original file line number Diff line number Diff line change
@@ -24,6 +24,4 @@ files from `rubinius-core-api` and Rubinius itself separate and to be consistent
about what we're using from where and why. In the end it's a bit of a mix from
the two projects, and a mix of modification and shimming that works for us.

The only file the VM loads is `core.rb` - everything else is loaded from there.

We have directly attached copyright and license information to each file.