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

Commits on Dec 6, 2015

  1. Copy the full SHA
    72b0912 View commit details
  2. [Truffle] PE: move the code in a method to make compilation faster.

    * Use a while loop to avoid compiling Kernel#loop.
    * Also remove Thread.pass which would be compiled every time.
    * Save the return value in a global variable.
    eregon committed Dec 6, 2015
    Copy the full SHA
    70603e3 View commit details
Showing with 14 additions and 7 deletions.
  1. +12 −5 test/truffle/pe/pe.rb
  2. +2 −2 truffle/src/main/ruby/core/thread.rb
17 changes: 12 additions & 5 deletions test/truffle/pe/pe.rb
Original file line number Diff line number Diff line change
@@ -95,8 +95,15 @@ def report(status, code, message = nil)
test_thread = Thread.new do
begin
tested += 1
value = nil
eval "loop { value = Truffle::Primitive.assert_constant begin; #{example.code}; end; Truffle::Primitive.assert_not_compiled; Thread.pass }"
$value = nil
eval "
def test_pe_code
$value = Truffle::Primitive.assert_constant(begin; #{example.code}; end)
Truffle::Primitive.assert_not_compiled
end"
while true
test_pe_code
end
rescue RubyTruffleError => e
if e.message.include? 'Truffle::Primitive.assert_not_compiled'
constant = true
@@ -115,16 +122,16 @@ def report(status, code, message = nil)
report 'FAILED', example.code, "wasn't constant"
failed += 1
else
if value == example.expected_value
if $value == example.expected_value
report 'OK', example.code
else
report 'INCORRECT', example.code, "was: #{value.inspect} and not: #{example.expected_value.inspect}"
report 'INCORRECT', example.code, "was: #{$value.inspect} and not: #{example.expected_value.inspect}"
failed += 1
end
end
else
if constant
report 'QUERY', example.code, "wasn't supposed to be constant but it was (#{value.inspect})"
report 'QUERY', example.code, "wasn't supposed to be constant but it was (#{$value.inspect})"
failed += 1
else
report 'OK (counter)', example.code
4 changes: 2 additions & 2 deletions truffle/src/main/ruby/core/thread.rb
Original file line number Diff line number Diff line change
@@ -37,8 +37,8 @@ def thread_variables
__thread_local_variables.keys
end

def self.start(&block)
Thread.new(&block)
def self.start(*args, &block)
Thread.new(*args, &block)
end

def self.abort_on_exception