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: 31e6aa46fd3d
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 592e312afaa9
Choose a head ref
  • 11 commits
  • 61 files changed
  • 1 contributor

Commits on Apr 27, 2016

  1. Copy the full SHA
    7b20b59 View commit details
  2. Copy the full SHA
    747dba4 View commit details
  3. Copy the full SHA
    be7badd View commit details
  4. Copy the full SHA
    98944fe View commit details
  5. Copy the full SHA
    ec93de7 View commit details
  6. Copy the full SHA
    526416e View commit details
  7. Copy the full SHA
    de266f5 View commit details
  8. Copy the full SHA
    37fbe78 View commit details
  9. Copy the full SHA
    aa1d1d5 View commit details
  10. Copy the full SHA
    ab6e290 View commit details
  11. Copy the full SHA
    592e312 View commit details
Showing with 683 additions and 571 deletions.
  1. +1 −1 core/src/main/java/org/jruby/util/cli/Options.java
  2. +1 −1 lib/ruby/truffle/shims/stringio.rb
  3. +1 −9 lib/ruby/truffle/truffle/coverage.rb
  4. +8 −0 lib/ruby/truffle/truffle/etc.rb
  5. +2 −2 lib/ruby/truffle/truffle/objspace.rb
  6. +3 −3 samples/truffle/can-we-fold-yet.rb
  7. +1 −1 spec/truffle/specs/truffle/array/append_spec.rb
  8. +1 −1 spec/truffle/specs/truffle/array/element_set_spec.rb
  9. +1 −1 spec/truffle/specs/truffle/fixnum/and_spec.rb
  10. +4 −4 spec/truffle/specs/truffle/{primitive/gc_time_spec.rb → gc/count_spec.rb}
  11. +4 −4 spec/truffle/specs/truffle/{primitive/gc_count_spec.rb → gc/time_spec.rb}
  12. +4 −4 spec/truffle/specs/truffle/{primitive → graal}/assert_constant_spec.rb
  13. +4 −4 spec/truffle/specs/truffle/{primitive → graal}/assert_not_compiled_spec.rb
  14. +3 −3 spec/truffle/specs/truffle/{ → graal}/graal_spec.rb
  15. +3 −3 spec/truffle/specs/truffle/{ → graal}/substrate_spec.rb
  16. +3 −3 spec/truffle/specs/truffle/{primitive/host_os_spec.rb → graal/version_spec.rb}
  17. +4 −4 spec/truffle/specs/truffle/{primitive → }/home_directory_spec.rb
  18. +3 −3 spec/truffle/specs/truffle/{version_spec.rb → host_os_spec.rb}
  19. +2 −2 spec/truffle/specs/truffle/{primitive → }/simple_shell_spec.rb
  20. +1 −1 spec/truffle/tags/truffle/primitive/gc_count_tags.txt
  21. +1 −1 spec/truffle/tags/truffle/primitive/gc_time_tags.txt
  22. +5 −4 test/truffle/compiler/attachments-optimise/attachments-optimise.rb
  23. +6 −5 test/truffle/compiler/osr/osr.rb
  24. +3 −3 test/truffle/compiler/pe/core/string_pe.rb
  25. +6 −6 test/truffle/compiler/pe/pe.rb
  26. +5 −4 test/truffle/compiler/stf-optimises/stf-optimises.rb
  27. +5 −4 test/truffle/compiler/tp-optimises/tp-optimises.rb
  28. +3 −3 test/truffle/integration/safe.sh
  29. +1 −1 tool/truffle/callgraph2html.rb
  30. +3 −3 truffle/src/main/java/org/jruby/truffle/JRubyTruffleImpl.java
  31. +12 −6 truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
  32. +99 −0 truffle/src/main/java/org/jruby/truffle/core/GCNodes.java
  33. +2 −2 truffle/src/main/java/org/jruby/truffle/core/exception/CoreExceptions.java
  34. +16 −18 truffle/src/main/java/org/jruby/truffle/extra/AttachmentsManager.java
  35. +80 −0 truffle/src/main/java/org/jruby/truffle/extra/GraalNodes.java
  36. +3 −136 truffle/src/main/java/org/jruby/truffle/extra/{TrufflePrimitiveNodes.java → TruffleNodes.java}
  37. +1 −1 truffle/src/main/java/org/jruby/truffle/interop/{TruffleInteropNodes.java → InteropNodes.java}
  38. +1 −1 truffle/src/main/java/org/jruby/truffle/language/DataNode.java
  39. +1 −1 truffle/src/main/java/org/jruby/truffle/language/arguments/ReadRestArgumentNode.java
  40. +1 −1 truffle/src/main/java/org/jruby/truffle/language/arguments/RunBlockKWArgsHelperNode.java
  41. +4 −4 truffle/src/main/java/org/jruby/truffle/language/parser/jruby/BodyTranslator.java
  42. +1 −1 truffle/src/main/java/org/jruby/truffle/{debug → platform/graal}/AssertConstantNode.java
  43. +1 −1 truffle/src/main/java/org/jruby/truffle/{debug → platform/graal}/AssertNotCompiledNode.java
  44. +5 −1 truffle/src/main/java/org/jruby/truffle/platform/{ → graal}/Graal.java
  45. +82 −0 truffle/src/main/java/org/jruby/truffle/stdlib/CoverageNodes.java
  46. +232 −232 truffle/src/main/ruby/core.rb
  47. +3 −3 truffle/src/main/ruby/core/config.rb
  48. +1 −1 truffle/src/main/ruby/core/kernel.rb
  49. +1 −1 truffle/src/main/ruby/core/library.rb
  50. +1 −1 truffle/src/main/ruby/core/main.rb
  51. +3 −3 truffle/src/main/ruby/core/post.rb
  52. +2 −2 truffle/src/main/ruby/core/rubinius/api/shims/io.rb
  53. +4 −4 truffle/src/main/ruby/core/rubinius/api/shims/kernel.rb
  54. +2 −2 truffle/src/main/ruby/core/rubinius/api/shims/metrics.rb
  55. +1 −1 truffle/src/main/ruby/core/rubinius/platform/pointer.rb
  56. +5 −5 truffle/src/main/ruby/core/rubinius/primitives.rb
  57. +10 −10 truffle/src/main/ruby/core/shims.rb
  58. +2 −2 truffle/src/main/ruby/core/truffle/attachments.rb
  59. +9 −9 truffle/src/main/ruby/core/truffle/debug.rb
  60. +3 −3 truffle/src/main/ruby/core/truffle/runtime.rb
  61. +3 −31 truffle/src/main/ruby/core/truffle/truffle.rb
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -232,7 +232,7 @@ public class Options {
public static final Option<Boolean> TRUFFLE_PLATFORM_SAFE_SIGNALS = bool(TRUFFLE, "truffle.platform.safe.siganls", TRUFFLE_PLATFORM_SAFE.load(), "Treat any methods that deal with signals as safe.");
public static final Option<Boolean> TRUFFLE_PLATFORM_SAFE_EXIT = bool(TRUFFLE, "truffle.platform.safe.exit", TRUFFLE_PLATFORM_SAFE.load(), "Treat #exit! (hard exiting the VM) as safe.");
public static final Option<Boolean> TRUFFLE_PLATFORM_SAFE_AT_EXIT = bool(TRUFFLE, "truffle.platform.safe.at_exit", TRUFFLE_PLATFORM_SAFE.load(), "Treat #at_exit as safe.");
public static final Option<Boolean> TRUFFLE_PLATFORM_SAFE_PUTS = bool(TRUFFLE, "truffle.platform.safe_puts", true, "Treat Truffle::Primitive.safe_puts as safe.");
public static final Option<Boolean> TRUFFLE_PLATFORM_SAFE_PUTS = bool(TRUFFLE, "truffle.platform.safe_puts", true, "Treat Truffle.safe_puts as safe.");
public static final Option<Boolean> TRUFFLE_PLATFORM_USE_JAVA = bool(TRUFFLE, "truffle.platform.use_java", false, "Use a pure-Java platform, so no native POSIX.");

public static final Option<Boolean> TRUFFLE_COVERAGE_GLOBAL = bool(TRUFFLE, "truffle.coverage.global", false, "Run coverage for all code and print results on exit.");
2 changes: 1 addition & 1 deletion lib/ruby/truffle/shims/stringio.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ def initialize(string=nil, mode=nil)
def gets
line = @lines.shift
line += "\n" unless line.nil?
Truffle::Primitive.binding_of_caller.local_variable_set(:$_, line)
Truffle.binding_of_caller.local_variable_set(:$_, line)
line
end

10 changes: 1 addition & 9 deletions lib/ruby/truffle/truffle/coverage.rb
Original file line number Diff line number Diff line change
@@ -7,13 +7,5 @@
# GNU Lesser General Public License version 2.1

module Coverage

def self.start
Truffle::Primitive.coverage_start
end

def self.result
Truffle::Primitive.coverage_result
end

include Truffle::Coverage
end
8 changes: 8 additions & 0 deletions lib/ruby/truffle/truffle/etc.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. This
# code is released under a tri EPL/GPL/LGPL license. You can use it,
# redistribute it and/or modify it under the terms of the:
#
# Eclipse Public License version 1.0
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

module Etc
include Truffle::Etc
end
4 changes: 2 additions & 2 deletions lib/ruby/truffle/truffle/objspace.rb
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ def count_nodes(nodes = {})
class << self

def count_nodes_method(method, nodes)
node_stack = [Truffle::Primitive.ast(method)]
node_stack = [Truffle.ast(method)]

until node_stack.empty?
node = node_stack.pop
@@ -74,7 +74,7 @@ def count_objects_size(hash = {})

def count_tdata_objects(hash = {})
ObjectSpace.each_object do |object|
object_type = Truffle::Primitive.object_type_of(object)
object_type = Truffle.object_type_of(object)
hash[object_type] ||= 0
hash[object_type] += 1
end
6 changes: 3 additions & 3 deletions samples/truffle/can-we-fold-yet.rb
Original file line number Diff line number Diff line change
@@ -21,11 +21,11 @@

test_thread = Thread.new do
begin
eval "loop { Truffle::Primitive.assert_constant #{code}; Truffle::Primitive.assert_not_compiled; Thread.pass }"
eval "loop { Truffle.assert_constant #{code}; Truffle.assert_not_compiled; Thread.pass }"
rescue RubyTruffleError => e
if e.message.include? 'Truffle::Primitive.assert_not_compiled'
if e.message.include? 'Truffle.assert_not_compiled'
puts "Yes! Truffle can constant fold this to #{eval(code).inspect}"
elsif e.message.include? 'Truffle::Primitive.assert_constant'
elsif e.message.include? 'Truffle.assert_constant'
puts "No :( Truffle can't constant fold that"
else
puts "There was an error executing that :("
2 changes: 1 addition & 1 deletion spec/truffle/specs/truffle/array/append_spec.rb
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

describe "Array#<<" do
def storage(ary)
Truffle::Primitive.array_storage(ary)
Truffle.array_storage(ary)
end

before :each do
2 changes: 1 addition & 1 deletion spec/truffle/specs/truffle/array/element_set_spec.rb
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@

describe "Array#[]=" do
def storage(ary)
Truffle::Primitive.array_storage(ary)
Truffle.array_storage(ary)
end

before :each do
2 changes: 1 addition & 1 deletion spec/truffle/specs/truffle/fixnum/and_spec.rb
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
describe "Fixnum#&" do
before :each do
@long = (1 << 48) + 1
@mask = Truffle::Primitive.fixnum_lower((1 << 30) - 1)
@mask = Truffle.fixnum_lower((1 << 30) - 1)
end

it "returns an int for (int, int)" do
Original file line number Diff line number Diff line change
@@ -8,19 +8,19 @@

require_relative '../../../../ruby/spec_helper'

describe "Truffle::Primitive.gc_time" do
describe "Truffle::GC.count" do

it "returns an Integer" do
Truffle::Primitive.gc_time.should be_kind_of(Integer)
Truffle::GC.gc_count.should be_kind_of(Integer)
end

it "increases as collections are run" do
time_before = Truffle::Primitive.gc_time
count_before = Truffle::GC.gc_count
escape = []
100_000.times do
escape << Time.now.to_s
end
Truffle::Primitive.gc_time.should > time_before
Truffle::GC.gc_count.should > count_before
end

end
Original file line number Diff line number Diff line change
@@ -8,19 +8,19 @@

require_relative '../../../../ruby/spec_helper'

describe "Truffle::Primitive.gc_count" do
describe "Truffle::GC.time" do

it "returns an Integer" do
Truffle::Primitive.gc_count.should be_kind_of(Integer)
Truffle::GC.time.should be_kind_of(Integer)
end

it "increases as collections are run" do
count_before = Truffle::Primitive.gc_count
time_before = Truffle::GC.time
escape = []
100_000.times do
escape << Time.now.to_s
end
Truffle::Primitive.gc_count.should > count_before
Truffle::GC.time.should > time_before
end

end
Original file line number Diff line number Diff line change
@@ -8,15 +8,15 @@

require_relative '../../../../ruby/spec_helper'

describe "Truffle::Primitive.assert_constant" do
describe "Truffle::Graal.assert_constant" do

it "raises a RuntimeError when called dynamically" do
lambda{ Truffle::Primitive.send(:assert_constant, 14 + 2) }.should raise_error(RuntimeError)
lambda{ Truffle::Graal.send(:assert_constant, 14 + 2) }.should raise_error(RuntimeError)
end

unless Truffle.graal?
unless Truffle::Graal.graal?
it "returns the value of the argument" do
Truffle::Primitive.assert_constant(14 + 2).should == 16
Truffle::Graal.assert_constant(14 + 2).should == 16
end
end

Original file line number Diff line number Diff line change
@@ -8,15 +8,15 @@

require_relative '../../../../ruby/spec_helper'

describe "Truffle::Primitive.assert_not_compiled" do
describe "Truffle::Graal.assert_not_compiled" do

it "raises a RuntimeError when called dynamically" do
lambda{ Truffle::Primitive.send(:assert_not_compiled) }.should raise_error(RuntimeError)
lambda{ Truffle::Graal.send(:assert_not_compiled) }.should raise_error(RuntimeError)
end

unless Truffle.graal?
unless Truffle::Graal.graal?
it "returns nil" do
Truffle::Primitive.assert_not_compiled.should be_nil
Truffle::Graal.assert_not_compiled.should be_nil
end
end

Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.graal?" do
describe "Truffle::Graal.graal?" do

it "returns a Boolean value" do
Truffle.graal?.should be_true_or_false
Truffle::Graal.graal?.should be_true_or_false
end

end
Original file line number Diff line number Diff line change
@@ -6,12 +6,12 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../ruby/spec_helper'
require_relative '../../../../ruby/spec_helper'

describe "Truffle.substrate?" do
describe "Truffle::Graal.substrate?" do

it "returns a Boolean value" do
Truffle.substrate?.should be_true_or_false
Truffle::Graal.substrate?.should be_true_or_false
end

end
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@

require_relative '../../../../ruby/spec_helper'

describe "Truffle::Primitive.host_os" do
describe "Truffle::Graal.version" do

it "returns a String" do
Truffle::Primitive.host_os.should be_kind_of(String)
Truffle::Graal.version.should be_kind_of(String)
end

end
Original file line number Diff line number Diff line change
@@ -6,16 +6,16 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../../ruby/spec_helper'
require_relative '../../../ruby/spec_helper'

describe "Truffle::Primitive.home_directory" do
describe "Truffle.home_directory" do

it "returns a String" do
Truffle::Primitive.home_directory.should be_kind_of(String)
Truffle.home_directory.should be_kind_of(String)
end

it "returns a path to a directory" do
Dir.exist?(Truffle::Primitive.home_directory).should be_true
Dir.exist?(Truffle.home_directory).should be_true
end

end
Original file line number Diff line number Diff line change
@@ -8,10 +8,10 @@

require_relative '../../../ruby/spec_helper'

describe "Truffle.version" do
describe "Truffle.host_os" do

it "returns a String" do
Truffle.version.should be_kind_of(String)
Truffle.host_os.should be_kind_of(String)
end

end
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@
# GNU General Public License version 2
# GNU Lesser General Public License version 2.1

require_relative '../../../../ruby/spec_helper'
require_relative '../../../ruby/spec_helper'

describe "Truffle::Primitive.simple_shell" do
describe "Truffle.simple_shell" do

it "needs to be reviewed for spec completeness"

2 changes: 1 addition & 1 deletion spec/truffle/tags/truffle/primitive/gc_count_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
slow:Truffle::Primitive.gc_count increases as collections are run
slow:Truffle.gc_count increases as collections are run
2 changes: 1 addition & 1 deletion spec/truffle/tags/truffle/primitive/gc_time_tags.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
slow:Truffle::Primitive.gc_time increases as collections are run
slow:Truffle.time increases as collections are run
Original file line number Diff line number Diff line change
@@ -19,17 +19,18 @@ def foo
loop do
x = foo
raise 'value not correct' unless x == 200
Truffle::Primitive.assert_constant x
Truffle::Primitive.assert_not_compiled
Truffle::Graal.assert_constant x
Truffle::Graal.assert_not_compiled
end
rescue RubyTruffleError => e
if e.message.include? 'Truffle::Primitive.assert_not_compiled'
if e.message.include? 'Truffle::Graal.assert_not_compiled'
puts 'attachments optimising'
exit 0
elsif e.message.include? 'Truffle::Primitive.assert_constant'
elsif e.message.include? 'Truffle::Graal.assert_constant'
puts 'attachments not optimising'
exit 1
else
p e.message
puts 'some other error'
exit 1
end
11 changes: 6 additions & 5 deletions test/truffle/compiler/osr/osr.rb
Original file line number Diff line number Diff line change
@@ -10,17 +10,18 @@

begin
while Time.now < timeout
Truffle::Primitive.assert_not_compiled
Truffle::Graal.assert_not_compiled
end

puts "while loop optimisation timed out"
puts 'while loop optimisation timed out'
exit 1
rescue RubyTruffleError => e
if e.message.include? 'Truffle::Primitive.assert_not_compiled'
puts "while loop optimising"
if e.message.include? 'Truffle::Graal.assert_not_compiled'
puts 'while loop optimising'
exit 0
else
puts "some other error"
p e.message
puts 'some other error'
exit 1
end
end
6 changes: 3 additions & 3 deletions test/truffle/compiler/pe/core/string_pe.rb
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@

simple_string = 'test'

example "Truffle::Primitive.create_simple_string.length", simple_string.length
example "Truffle::Primitive.create_simple_string.getbyte(0)", simple_string.getbyte(0)
example "Truffle::Primitive.create_simple_string.ord", simple_string.ord
example "Truffle.create_simple_string.length", simple_string.length
example "Truffle.create_simple_string.getbyte(0)", simple_string.getbyte(0)
example "Truffle.create_simple_string.ord", simple_string.ord

example "'abc'.length", 3
example "'こにちわ'.length", 4
12 changes: 6 additions & 6 deletions test/truffle/compiler/pe/pe.rb
Original file line number Diff line number Diff line change
@@ -19,14 +19,14 @@
# do:
#
# loop do
# Truffle::Primitive.assert_constant expression
# Truffle::Graal.assert_constant expression
# end
#
# Run with:
#
# jt run --graal -J-G:+TraceTruffleCompilation -J-G:+TruffleCompilationExceptionsAreFatal -J-G:+TruffleIterativePartialEscape test.rb

unless Truffle.graal?
unless Truffle::Graal.graal?
puts 'not running Graal'
exit 1
end
@@ -119,16 +119,16 @@ def report(status, code, message = nil)
$value = nil
eval "
def test_pe_code
$value = Truffle::Primitive.assert_constant(begin; #{example.code}; end)
Truffle::Primitive.assert_not_compiled
$value = Truffle::Graal.assert_constant(begin; #{example.code}; end)
Truffle::Graal.assert_not_compiled
end"
while true
test_pe_code
end
rescue RubyTruffleError => e
if e.message.include? 'Truffle::Primitive.assert_not_compiled'
if e.message.include? 'Truffle::Graal.assert_not_compiled'
constant = true
elsif e.message.include? 'Truffle::Primitive.assert_constant'
elsif e.message.include? 'Truffle::Graal.assert_constant'
constant = false
else
constant = nil
Loading