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: 27a53e8d1dc8
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 76ca38b7896a
Choose a head ref
Loading
Showing with 4,999 additions and 905 deletions.
  1. +1 −7 .gitignore
  2. +0 −1 .travis.yml
  3. +1 −0 bench/truffle/.gitignore
  4. +100 −0 bench/truffle/binary-trees.rb
  5. +2 −0 bench/truffle/c/Makefile
  6. +151 −0 bench/truffle/c/mandelbrot.c
  7. +137 −0 bench/truffle/compare.rb
  8. +729 −0 bench/truffle/deltablue.rb
  9. +111 −0 bench/truffle/fannkuch-redux.rb
  10. +80 −0 bench/truffle/harness.rb
  11. +143 −0 bench/truffle/java/Mandelbrot.java
  12. +137 −0 bench/truffle/js/mandelbrot.js
  13. +18 −0 bench/truffle/lib/deterministic-random.rb
  14. +121 −0 bench/truffle/mandelbrot-kernel-loop.rb
  15. +112 −0 bench/truffle/mandelbrot.rb
  16. +207 −0 bench/truffle/n-body-dynamic.rb
  17. +188 −0 bench/truffle/n-body.rb
  18. +189 −0 bench/truffle/neural-net.rb
  19. +88 −0 bench/truffle/pidigits.rb
  20. +25 −0 bench/truffle/report/all.gnuplot
  21. +25 −0 bench/truffle/report/almost-all.gnuplot
  22. +25 −0 bench/truffle/report/competition.gnuplot
  23. +25 −0 bench/truffle/report/interpreters.gnuplot
  24. +25 −0 bench/truffle/report/jruby.gnuplot
  25. +25 −0 bench/truffle/report/other-vms.gnuplot
  26. +25 −0 bench/truffle/report/rbx.gnuplot
  27. +294 −0 bench/truffle/report/report.rb
  28. +25 −0 bench/truffle/report/summary.gnuplot
  29. +25 −0 bench/truffle/report/topaz.gnuplot
  30. +401 −0 bench/truffle/richards.rb
  31. +95 −0 bench/truffle/spectral-norm.rb
  32. +26 −8 core/src/main/java/org/jruby/Ruby.java
  33. +48 −0 core/src/main/java/org/jruby/RubyBasicObject.java
  34. +17 −0 core/src/main/java/org/jruby/RubyFixnum.java
  35. +2 −0 core/src/main/java/org/jruby/RubyIO.java
  36. +7 −0 core/src/main/java/org/jruby/RubySymbol.java
  37. +2 −1 core/src/main/java/org/jruby/RubyThread.java
  38. +17 −19 core/src/main/java/org/jruby/compiler/JITCompiler.java
  39. +13 −11 core/src/main/java/org/jruby/ext/coverage/CoverageData.java
  40. +4 −4 core/src/main/java/org/jruby/ext/coverage/CoverageModule.java
  41. +1 −0 core/src/main/java/org/jruby/ir/IRScope.java
  42. +23 −10 core/src/main/java/org/jruby/ir/targets/Bootstrap.java
  43. +5 −27 core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
  44. +8 −5 core/src/main/java/org/jruby/parser/ParserConfiguration.java
  45. +9 −0 core/src/main/java/org/jruby/truffle/nodes/core/CoreMethod.java
  46. +22 −7 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  47. +30 −19 core/src/main/java/org/jruby/truffle/nodes/core/ObjectSpaceNodes.java
  48. +177 −1 core/src/main/java/org/jruby/truffle/nodes/core/ThreadNodes.java
  49. +658 −0 core/src/main/java/org/jruby/truffle/nodes/debug/ProxyNode.java
  50. +1 −2 core/src/main/java/org/jruby/truffle/nodes/debug/RubyASTProber.java
  51. +18 −589 core/src/main/java/org/jruby/truffle/nodes/debug/RubyWrapper.java
  52. +3 −3 ...va/org/jruby/truffle/nodes/debug/{ObjectSpaceSafepointInstrument.java → SafepointInstrument.java}
  53. +2 −2 .../main/java/org/jruby/truffle/nodes/debug/{ObjectSpaceSafepointProber.java → SafepointProber.java}
  54. +4 −3 core/src/main/java/org/jruby/truffle/nodes/methods/ExceptionTranslatingNode.java
  55. +37 −0 core/src/main/java/org/jruby/truffle/runtime/ObjectIDOperations.java
  56. +12 −6 core/src/main/java/org/jruby/truffle/runtime/RubyContext.java
  57. +19 −0 core/src/main/java/org/jruby/truffle/runtime/control/ThreadExitException.java
  58. +3 −1 core/src/main/java/org/jruby/truffle/runtime/core/RubyHash.java
  59. +33 −15 core/src/main/java/org/jruby/truffle/runtime/core/RubyThread.java
  60. +25 −93 core/src/main/java/org/jruby/truffle/runtime/subsystems/ObjectSpaceManager.java
  61. +119 −0 core/src/main/java/org/jruby/truffle/runtime/subsystems/SafepointManager.java
  62. +1 −1 core/src/main/java/org/jruby/truffle/runtime/subsystems/ThreadManager.java
  63. +16 −0 core/src/main/java/org/jruby/truffle/runtime/util/Consumer.java
  64. +0 −1 core/src/main/java/org/jruby/truffle/translator/MethodTranslator.java
  65. +5 −4 core/src/main/java/org/jruby/util/io/PopenExecutor.java
  66. +1 −0 maven/jruby-complete/pom.rb
  67. +12 −8 ...y_bundles_with_embedded_gems/test/src/test/java/org/jruby/embed/osgi/test/JRubyOsgiEmbedTest.java
  68. +10 −0 maven/jruby-complete/src/templates/osgi_many_bundles_with_embedded_gems/verify.bsh
  69. +2 −2 maven/jruby/pom.rb
  70. +0 −3 maven/jruby/pom.xml
  71. +1 −1 maven/pom.rb
  72. +0 −1 maven/pom.xml
  73. +19 −1 pom.rb
  74. +44 −6 pom.xml
  75. +1 −1 spec/compiler/general_spec.rb
  76. +0 −1 spec/tags/ruby/language/array_tags.txt
  77. +0 −6 spec/tags/ruby/language/block_tags.txt
  78. +0 −2 spec/tags/ruby/language/break_tags.txt
  79. +0 −3 spec/truffle/tags/core/objectspace/_id2ref_tags.txt
  80. +0 −2 spec/truffle/tags/core/objectspace/each_object_tags.txt
  81. +0 −1 spec/truffle/tags/core/objectspace/finalizers_tags.txt
  82. +0 −4 spec/truffle/tags/core/objectspace/garbage_collect_tags.txt
  83. +0 −1 spec/truffle/tags/core/objectspace/remove_finalizer_tags.txt
  84. +0 −1 spec/truffle/tags/core/objectspace/undefine_finalizer_tags.txt
  85. +0 −1 spec/truffle/tags/core/thread/alive_tags.txt
  86. +0 −2 spec/truffle/tags/core/thread/current_tags.txt
  87. +0 −1 spec/truffle/tags/core/thread/pass_tags.txt
  88. +0 −3 spec/truffle/tags/core/thread/value_tags.txt
  89. +11 −12 test/jruby/test_backquote.rb
  90. +1 −2 test/rubicon/test_io.rb
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -88,10 +88,4 @@ maven/jruby-complete/src/it/osgi*
*.iml

# Truffle benchmark stuff
bench/truffle/c/mandelbrot
bench/truffle/java/*.class
bench/truffle/js/budget.js
bench/truffle/report/*.pdf
bench/truffle/report/*.data
bench/truffle/lib/*.rbc
bench/truffle/*.rbc
reference.txt
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -50,7 +50,6 @@ matrix:
allow_failures:
- env: TARGET='-Pcomplete'
- env: TARGET='-Prake -Dtask=spec:compiler'
- env: TARGET='-Posgi'

branches:
only:
1 change: 1 addition & 0 deletions bench/truffle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
reference.data
100 changes: 100 additions & 0 deletions bench/truffle/binary-trees.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Copyright © 2004-2013 Brent Fulgham
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of "The Computer Language Benchmarks Game" nor the name
# of "The Computer Language Shootout Benchmarks" nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# The Computer Language Benchmarks Game
# http://benchmarksgame.alioth.debian.org
#
# contributed by Jesse Millikan
# Modified by Wesley Moxam

# http://benchmarksgame.alioth.debian.org/u64q/program.php?test=binarytrees&lang=yarv&id=1

def item_check(left, item, right)
return item if left.nil?
item + item_check(*left) - item_check(*right)
end

def bottom_up_tree(item, depth)
return [nil, item, nil] unless depth > 0
item_item = 2 * item
depth -= 1
[bottom_up_tree(item_item - 1, depth), item, bottom_up_tree(item_item, depth)]
end

def binary_trees(max_depth)
sum = 0

min_depth = 4

max_depth = min_depth + 2 if min_depth + 2 > max_depth

stretch_depth = max_depth + 1
stretch_tree = bottom_up_tree(0, stretch_depth)

sum += item_check(*stretch_tree)
stretch_tree = nil

long_lived_tree = bottom_up_tree(0, max_depth)

min_depth.step(max_depth + 1, 2) do |depth|
iterations = 2**(max_depth - depth + min_depth)

check = 0

for i in 1..iterations
temp_tree = bottom_up_tree(i, depth)
check += item_check(*temp_tree)

temp_tree = bottom_up_tree(-i, depth)
check += item_check(*temp_tree)
end

sum += depth
sum += check
end

sum += item_check(*long_lived_tree)

sum
end

def warmup
1000.times do
binary_trees(10)
end
end

def sample
binary_trees(15) == -87308
end

def name
return "shootout-binary-trees"
end
2 changes: 2 additions & 0 deletions bench/truffle/c/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mandelbrot: mandelbrot.c
$(CC) -std=c99 -O3 -o $@ $^
151 changes: 151 additions & 0 deletions bench/truffle/c/mandelbrot.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
// Copyright © 2004-2013 Brent Fulgham
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * Neither the name of "The Computer Language Benchmarks Game" nor the name
// of "The Computer Language Shootout Benchmarks" nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org
//
// contributed by Karl von Laudermann
// modified by Jeremy Echols
// modified by Detlef Reichl
// modified by Joseph LaFata
// modified by Peter Zotov

// http://benchmarksgame.alioth.debian.org/u64q/program.php?test=mandelbrot&lang=yarv&id=3

#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>

int mandelbrot(double size) {
int sum = 0;

int byte_acc = 0;
int bit_num = 0;

int y = 0;
while (y < size) {
double ci = (2.0*y/size)-1.0;

int x = 0;
while (x < size) {
double zr = 0.0;
double zrzr = zr;
double zi = 0.0;
double zizi = zi;
double cr = (2.0*x/size)-1.5;
int escape = 1;

int z = 0;
while (z < 50) {
double tr = zrzr - zizi + cr;
double ti = 2.0*zr*zi + ci;
zr = tr;
zi = ti;
// preserve recalculation
zrzr = zr*zr;
zizi = zi*zi;
if (zrzr+zizi > 4.0) {
escape = 0;
break;
}
z += 1;
}

byte_acc = (byte_acc << 1) | escape;
bit_num += 1;

// Code is very similar for these cases, but using separate blocks
// ensures we skip the shifting when it's unnecessary, which is most cases.
if (bit_num == 8) {
//print byte_acc.chr
sum ^= byte_acc;
byte_acc = 0;
bit_num = 0;
} else if (x == size - 1) {
byte_acc <<= (8 - bit_num);
//print byte_acc.chr
sum ^= byte_acc;
byte_acc = 0;
bit_num = 0;
}
x += 1;
}
y += 1;
}

return sum;
}

void warmup() {
for (int n = 0; n < 10000; n++) {
mandelbrot(10);
}
}

int sample() {
return mandelbrot(750) == 192;
}

double secondtime();

int main(int argc, char** argv) {
int budget = atoi(argv[0]);

warmup();

int iterations = 0;

double start = secondtime();
double elapsed;

while (1) {
if (!sample()) {
abort();
}

iterations++;

elapsed = secondtime() - start;

if (elapsed > budget)
break;
}

double score = iterations / elapsed * 1000.0;

printf("%f\n", score);
}

double secondtime() {
// Not monotonic
struct timeval t;
gettimeofday(&t, NULL);
return t.tv_sec + t.tv_usec / 1e6;
}
Loading