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: bc0dbfc1b846
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a70518b55dcb
Choose a head ref
  • 20 commits
  • 26 files changed
  • 4 contributors

Commits on Jun 19, 2016

  1. Copy the full SHA
    26066d1 View commit details
  2. Copy the full SHA
    39379ba View commit details
  3. Copy the full SHA
    63bc467 View commit details
  4. Copy the full SHA
    c69b2f7 View commit details
  5. Squashed 'spec/mspec/' changes from 8ed21cb..52e059d

    52e059d Simply close the dup'd fd once we restored the original state
    3d38b3c Fix output_to_fd to let exceptions propagate
    
    git-subtree-dir: spec/mspec
    git-subtree-split: 52e059d96d7264d2bd3919d36623f908d50861d4
    eregon committed Jun 19, 2016
    Copy the full SHA
    5ef25b0 View commit details
  6. Copy the full SHA
    9125888 View commit details
  7. Copy the full SHA
    4c84cdb View commit details
  8. [Truffle] New slow tags.

    eregon committed Jun 19, 2016
    Copy the full SHA
    81472e5 View commit details
  9. Remove useless GC.start

    eregon committed Jun 19, 2016
    Copy the full SHA
    c0eed59 View commit details
  10. Copy the full SHA
    7e7f233 View commit details
  11. [Truffle] Simplify the slow specs tagger by looking at ARGV.

    * Extend it to cover more slow methods.
    eregon committed Jun 19, 2016
    Copy the full SHA
    1083d4b View commit details
  12. [Truffle] New slow tags.

    eregon committed Jun 19, 2016
    Copy the full SHA
    eb5d06f View commit details
  13. Copy the full SHA
    55f8377 View commit details
  14. [Truffle] New slow tags.

    eregon committed Jun 19, 2016
    Copy the full SHA
    156ce20 View commit details
  15. 2
    Copy the full SHA
    c6db8f6 View commit details
  16. Copy the full SHA
    831cbdb View commit details
  17. Copy the full SHA
    3f648c0 View commit details
  18. Copy the full SHA
    c0c21f4 View commit details
  19. Copy the full SHA
    f139904 View commit details
  20. Copy the full SHA
    a70518b View commit details
Showing with 470 additions and 149 deletions.
  1. +15 −2 ci.hocon
  2. +1 −1 core/src/main/java/org/jruby/Ruby.java
  3. +1 −0 lib/ruby/truffle/jruby+truffle/gem_configurations/activemodel.yaml
  4. +134 −51 lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
  5. +49 −0 mx.jruby/mx_jruby.py
  6. +22 −24 spec/mspec/lib/mspec/matchers/output_to_fd.rb
  7. +9 −0 spec/mspec/spec/matchers/output_to_fd_spec.rb
  8. +10 −16 spec/ruby/library/weakref/send_spec.rb
  9. +4 −3 spec/truffle/specs/truffle/gc/count_spec.rb
  10. +4 −3 spec/truffle/specs/truffle/gc/time_spec.rb
  11. +22 −22 spec/truffle/tags/core/kernel/spawn_tags.txt
  12. +0 −5 spec/truffle/tags/core/kernel/sprintf_tags.txt
  13. +2 −0 spec/truffle/tags/core/kernel/system_tags.txt
  14. +22 −0 spec/truffle/tags/core/objectspace/each_object_tags.txt
  15. +11 −7 spec/truffle/tags/core/process/spawn_tags.txt
  16. +0 −2 spec/truffle/tags/core/string/modulo_tags.txt
  17. +1 −0 spec/truffle/tags/language/predefined_tags.txt
  18. +4 −0 spec/truffle/tags/library/timeout/timeout_tags.txt
  19. +2 −0 spec/truffle/tags/library/zlib/deflate/deflate_tags.txt
  20. +2 −0 spec/truffle/tags/library/zlib/inflate/inflate_tags.txt
  21. +1 −0 spec/truffle/tags/truffle/gc/count_tags.txt
  22. +1 −0 spec/truffle/tags/truffle/gc/time_tags.txt
  23. +21 −7 spec/truffle/truffle.mspec
  24. +17 −1 truffle/src/main/java/org/jruby/truffle/core/TruffleProcessNodes.java
  25. +93 −0 truffle/src/main/java/org/jruby/truffle/core/format/format/FormatIntegerBinaryNode.java
  26. +22 −5 truffle/src/main/java/org/jruby/truffle/core/format/printf/PrintfTreeBuilder.java
17 changes: 15 additions & 2 deletions ci.hocon
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ common: {

setup: ${common-setup}

timelimit: "01:00:00"
timelimit: "00:30:00"
}

no-graal: {
@@ -126,10 +126,12 @@ gate-caps: {

bench-caps: {
capabilities: [x52, linux, amd64, bench, post-push]
timelimit: "02:00:00"
}

daily-bench-caps: {
capabilities: [x52, linux, amd64, daily]
timelimit: "02:00:00"
}

post-process-and-upload-results: [
@@ -175,6 +177,12 @@ chunky-benchmarks: {
] ${post-process-and-upload-results}
}

psd-benchmarks: {
run: ${setup-benchmarks} [
[mx, benchmark, psd]
] ${post-process-and-upload-results}
}

builds: [
{name: ruby-test-fast} ${common} ${gate-caps} {run: [${jt} [test, fast]]},
{name: ruby-test-specs-command-line} ${common} ${gate-caps} {run: [${jt} [test, specs, ":command_line"]]},
@@ -207,5 +215,10 @@ builds: [
//{name: ruby-benchmarks-chunky-noindy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-noindy-benchmark} ${chunky-benchmarks},
//{name: ruby-benchmarks-chunky-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${chunky-benchmarks},
{name: ruby-benchmarks-chunky-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${chunky-benchmarks},
{name: ruby-benchmarks-chunky-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${chunky-benchmarks}
{name: ruby-benchmarks-chunky-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${chunky-benchmarks},

//{name: ruby-benchmarks-psd-noindy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-noindy-benchmark} ${psd-benchmarks},
//{name: ruby-benchmarks-psd-indy} ${common} ${no-graal} ${daily-bench-caps} ${jruby-indy-benchmark} ${psd-benchmarks},
{name: ruby-benchmarks-psd-graal-core} ${common} ${graal-core} ${bench-caps} ${jruby-truffle} ${psd-benchmarks},
{name: ruby-benchmarks-psd-graalvm} ${common} ${graalvm} ${bench-caps} ${jruby-truffle} ${psd-benchmarks}
]
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -925,7 +925,7 @@ private JRubyTruffleInterface loadTruffle() {
try {
clazz = getJRubyClassLoader().loadClass("org.jruby.truffle.JRubyTruffleImpl");
} catch (Exception e) {
throw new RuntimeException("Truffle backend not available", e);
throw new RuntimeException("JRuby's Truffle backend not available - either it was not compiled because JRuby was built with Java 7, or it has been removed", e);
}

final JRubyTruffleInterface truffleContext;
Original file line number Diff line number Diff line change
@@ -74,6 +74,7 @@
# do not let bundler to install db gem group
:without:
- db
- job
:before:
# temporary workaround, rake 10.4.2 will not install
- $JRUBY_BIN -e 'File.write "../Gemfile.lock", File.read("../Gemfile.lock").gsub(/rake \(10\.4\.2\)/,"rake (11.1.2)")'
185 changes: 134 additions & 51 deletions lib/ruby/truffle/jruby+truffle/lib/truffle/runner.rb
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@
require 'pathname'
require 'rbconfig'
require 'rubygems'
require 'bundler'

module Truffle
class Runner
@@ -64,6 +65,28 @@ def print_cmd(cmd, dir, print)
return cmd
end

def dig_deep(data, selection)
return data if selection.nil?

selection = case selection
when Hash
selection
when Array
selection.reduce({}) { |h, k| h.update k => nil }
else
{ selection => nil }
end

case data
when Hash
selection.each_with_object({}) { |(key, sel), hash| hash[key] = dig_deep data[key], sel }
when Array
selection.map { |key, sel| dig_deep data[key], sel }
else
raise data.inspect + selection.inspect
end
end

end

include Utils
@@ -87,7 +110,7 @@ module OptionBlocks
include OptionBlocks

begin
apply_pattern = -> (pattern, old, options) do
apply_pattern = -> (pattern, old, options) do
Dir.glob(pattern) do |file|
if options[:exclude_pattern].any? { |p| /#{p}/ =~ file }
puts "skipped: #{file}" if verbose?
@@ -98,13 +121,19 @@ module OptionBlocks
old << pattern
end

shared_offline_options = {
offline: ['--[no-]offline', 'Use local gems only', STORE_NEW_VALUE, false],
offline_gem_path: ['--offline-gem-path', 'Path to a local pre-installed gems', STORE_NEW_VALUE,
JRUBY_PATH.join('..', 'jruby-truffle-gem-test-pack', 'gems')] }


# Format:
# subcommand_name: {
# :'option_name (also used as a key in yaml)' => [option_parser_on_method_args,
# -> (new_value, old_value) { result_of_this_block_is_stored },
# -> (new_value, old_value, options) { result_of_this_block_is_stored },
# default_value]
# }
OPTION_DEFINITIONS = {
OPTION_DEFINITIONS = {
global: {
verbose: ['-v', '--verbose', 'Run verbosely (prints options)', STORE_NEW_VALUE, false],
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false],
@@ -122,13 +151,12 @@ module OptionBlocks
configuration: ['--config GEM_NAME', 'Load configuration for specified gem', STORE_NEW_VALUE, nil],
dir: ['--dir DIRECTORY', 'Set working directory', STORE_NEW_VALUE, nil],
},
setup: {
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false],
before: ['--before SH_CMD', 'Commands to execute before setup', ADD_TO_ARRAY, []],
after: ['--after SH_CMD', 'Commands to execute after setup', ADD_TO_ARRAY, []],
file: ['--file NAME,CONTENT', Array, 'Create file in truffle_bundle_path', MERGE_TO_HASH, {}],
without: ['--without GROUP', 'Do not install listed gem group by bundler', ADD_TO_ARRAY, []]
},
setup: { help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false],
before: ['--before SH_CMD', 'Commands to execute before setup', ADD_TO_ARRAY, []],
after: ['--after SH_CMD', 'Commands to execute after setup', ADD_TO_ARRAY, []],
file: ['--file NAME,CONTENT', Array, 'Create file in truffle_bundle_path', MERGE_TO_HASH, {}],
without: ['--without GROUP', 'Do not install listed gem group by bundler', ADD_TO_ARRAY, []]
}.merge(shared_offline_options),
run: {
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false],
interpreter_path: ['--interpreter-path PATH', "Path to #{BRANDING} interpreter executable", STORE_NEW_VALUE,
@@ -148,12 +176,11 @@ module OptionBlocks
xmx: ['--xmx SIZE', 'Max memory size', STORE_NEW_VALUE, '2G'],
no_asserts: ['--no-asserts', 'Disable asserts -ea -esa', STORE_NEW_NEGATED_VALUE, false]
},
ci: {
batch: ['--batch FILE', 'Run batch of ci tests supplied in a file. One ci command options per line. If FILE is in or stdin it reads from $stdin.',
STORE_NEW_VALUE, nil],
definition: ['--definition NAME', 'Specify which definition file to use', STORE_NEW_VALUE, nil],
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false]
},
ci: { batch: ['--batch FILE', 'Run batch of ci tests supplied in a file. One ci command options per line. If FILE is in or stdin it reads from $stdin.',
STORE_NEW_VALUE, nil],
definition: ['--definition NAME', 'Specify which definition file to use', STORE_NEW_VALUE, nil],
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false]
}.merge(shared_offline_options),
clean: {
help: ['-h', '--help', 'Show this message', STORE_NEW_VALUE, false]
},
@@ -237,8 +264,8 @@ module OptionBlocks
end


def initialize(argv)
@options = construct_default_options
def initialize(argv, options = {})
@options = deep_merge construct_default_options, options
@option_parsers = build_option_parsers

@subcommand, *argv_after_global = @option_parsers[:global].order argv
@@ -385,34 +412,90 @@ def deep_merge(a, b)
b
end

BUNDLER_EVAL_ENV = Object.new

def BUNDLER_EVAL_ENV.gem(name, options)
[name, options]
end

def BUNDLER_EVAL_ENV.process(line)
eval line
end

def gemfile_use_path!(gems_path)
gemfile = Bundler.default_gemfile.to_s

new_lines = File.read(gemfile).lines.map do |line|
if line =~ /^( +)gem.*git:/
space = $1
gem_name, options = BUNDLER_EVAL_ENV.process(line)
repo_name = options[:git].split('/').last
repo_match = "#{gems_path}/bundler/gems/#{repo_name}-*"
repo_path = Dir[repo_match].first

["# Overridden by jtr\n",
'# ' + line,
repo_path ?
"gem '#{gem_name}', path: '#{repo_path}'\n" :
"raise \"no repository found on '#{repo_match}'\"\n"
].map { |l| space + l }.join
else
line
end
end

File.write gemfile, new_lines.join
end


def subcommand_setup(rest)
bundle_options = @options[:global][:bundle_options].split(' ')
bundle_path = File.expand_path(@options[:global][:truffle_bundle_path])
execute_all = lambda do |cmd|
execute_cmd([{ 'JRUBY_BIN' => JRUBY_BIN.to_s }, cmd])
end

@options[:setup][:before].each(&execute_all)

real_path = File.join(bundle_path, RUBY_ENGINE)
target_gem_path = File.join(bundle_path, RUBY_ENGINE, '2.3.0')
jruby_truffle_path = File.join(bundle_path, 'jruby+truffle')
mock_path = File.join(bundle_path, @options[:global][:mock_load_path])

bundle_cli([*bundle_options,
'install',
'--standalone',
'--path', bundle_path,
*(['--without', @options[:setup][:without].join(' ')] unless @options[:setup][:without].empty?)])
FileUtils.mkpath real_path
FileUtils.mkpath mock_path

jruby_truffle_path = File.join(bundle_path, 'jruby+truffle')
FileUtils.ln_s File.join(bundle_path, RUBY_ENGINE),
FileUtils.ln_s RUBY_ENGINE,
jruby_truffle_path,
verbose: verbose? unless File.exists? jruby_truffle_path
verbose: verbose?,
force: true

if @options[:setup][:offline]
FileUtils.rmtree target_gem_path
FileUtils.ln_s @options[:setup][:offline_gem_path],
target_gem_path,
verbose: verbose?
else
File.delete target_gem_path if File.symlink?(target_gem_path)
FileUtils.mkpath target_gem_path
end

jruby_truffle_22_path = File.join(bundle_path, 'jruby+truffle', '2.2.0')
FileUtils.ln_s File.join(bundle_path, 'jruby+truffle', '2.3.0'),
jruby_truffle_22_path,
verbose: verbose? unless File.exists? jruby_truffle_22_path
FileUtils.ln_s '2.3.0',
File.join(bundle_path, RUBY_ENGINE, '2.2.0'),
verbose: verbose?,
force: true

mock_path = "#{bundle_path}/#{@options[:global][:mock_load_path]}"
FileUtils.mkpath mock_path
@options[:setup][:before].each(&execute_all)

gemfile_use_path!(target_gem_path) if @options[:setup][:offline]

execute_cmd([JRUBY_BIN.to_s,
"#{Gem.bindir}/bundle",
*bundle_options,
'install',
*(%w(--local --no-prune) if @options[:setup][:offline]),
'--standalone',
'--path', bundle_path,
*(['--without', @options[:setup][:without].join(' ')] unless @options[:setup][:without].empty?)].compact,
print_always: true)

@options[:setup][:file].each do |name, content|
puts "creating file: #{mock_path}/#{name}" if verbose?
@@ -432,11 +515,6 @@ def subcommand_setup(rest)
false
end

def bundle_cli(argv)
ruby = Pathname(RbConfig::CONFIG['bindir']).join('jruby')
execute_cmd [ruby.to_s, "#{Gem.bindir}/bundle", *argv]
end

def subcommand_run(rest)
jruby_path = Pathname("#{@options[:run][:interpreter_path]}/../..").expand_path
raise unless jruby_path.absolute?
@@ -532,13 +610,13 @@ def subcommand_ci(rest)
rest = option_parser.order line.split

gem_name = rest.first
CIEnvironment.new(@options[:global][:dir], gem_name, rest[1..-1], verbose: verbose?).success?
CIEnvironment.new(@options[:global][:dir], gem_name, @options, rest[1..-1]).success?
end

results.all?
else
gem_name = rest.first
ci = CIEnvironment.new @options[:global][:dir], gem_name, rest[1..-1], definition: options[:ci][:definition], verbose: verbose?
ci = CIEnvironment.new @options[:global][:dir], gem_name, @options, rest[1..-1], definition: options[:ci][:definition]

case ci.result
when nil # error, setup failed
@@ -582,11 +660,11 @@ def self.define_dsl_attr(*names, &conversion)
define_dsl_attr(:working_dir) { |v| Pathname(v) }
attr_reader :gem_name, :result

def initialize(working_dir, gem_name, rest, definition: nil, verbose: false)
@options = {}
@gem_name = gem_name
@rest = rest
@verbose = verbose
def initialize(working_dir, gem_name, runner_options, rest, definition: nil)
@runner_options = runner_options
@options = {}
@gem_name = gem_name
@rest = rest

@working_dir = Pathname(working_dir)
@repository_name = gem_name
@@ -678,9 +756,12 @@ def git_tags
tags
end

def setup
# noinspection RubyArgCount
Dir.chdir(testing_dir) { Runner.new([('-v' if @verbose), 'setup'].compact).run }
def setup(*options)
Dir.chdir(testing_dir) do
Runner.new(['setup', *options].compact,
dig_deep(@runner_options, global: :verbose, ci: [:offline, :offline_gem_path]).
tap { |h| h.update setup: h.delete(:ci) }).run
end
end

def cancel_ci!
@@ -693,8 +774,10 @@ def has_to_succeed(result)

def run(options, raise: true)
raise ArgumentError unless options.is_a? Array
# noinspection RubyArgCount
Dir.chdir(testing_dir) { Runner.new([('-v' if @verbose), 'run', *options].compact).run }
Dir.chdir(testing_dir) do
Runner.new(['run', *options].compact,
dig_deep(@runner_options, global: :verbose)).run
end
end

def execute(cmd, dir: testing_dir, raise: true)
Loading