ruby-changes:70201
From: Takashi <ko1@a...>
Date: Tue, 14 Dec 2021 16:07:55 +0900 (JST)
Subject: [ruby-changes:70201] 1a63468831 (master): Prepare for removing RubyVM::JIT (#5262)
https://git.ruby-lang.org/ruby.git/commit/?id=1a63468831 From 1a63468831524f68e73cbb068071652c6486cfc6 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Mon, 13 Dec 2021 23:07:46 -0800 Subject: Prepare for removing RubyVM::JIT (#5262) --- NEWS.md | 2 -- benchmark/lib/benchmark_driver/runner/mjit.rb | 8 ++++---- benchmark/lib/benchmark_driver/runner/mjit_exec.rb | 6 +++--- bootstraptest/runner.rb | 2 +- spec/ruby/core/io/flush_spec.rb | 2 +- spec/ruby/core/io/shared/write.rb | 2 +- template/fake.rb.in | 2 +- test/-ext-/bug_reporter/test_bug_reporter.rb | 2 +- test/csv/parse/test_general.rb | 2 +- test/drb/drbtest.rb | 2 +- test/lib/jit_support.rb | 2 +- test/net/http/test_httpresponse.rb | 2 +- test/reline/test_within_pipe.rb | 2 +- test/rinda/test_rinda.rb | 4 ++-- test/ruby/test_fiber.rb | 2 +- test/ruby/test_io.rb | 6 +++--- test/ruby/test_jit.rb | 2 +- test/ruby/test_optimization.rb | 2 +- test/ruby/test_process.rb | 2 +- test/ruby/test_rubyoptions.rb | 8 ++++---- test/ruby/test_rubyvm_jit.rb | 24 +++++++++++----------- test/ruby/test_settracefunc.rb | 2 +- test/ruby/test_thread.rb | 4 ++-- test/rubygems/test_gem_stream_ui.rb | 2 +- test/socket/test_socket.rb | 2 +- tool/lib/core_assertions.rb | 2 +- tool/lib/test/unit.rb | 2 +- tool/test/testunit/test_hideskip.rb | 2 +- tool/test/testunit/test_parallel.rb | 2 +- tool/test/webrick/test_httpserver.rb | 2 +- tool/test/webrick/test_server.rb | 2 +- vm.c | 23 ++++++++++----------- 32 files changed, 64 insertions(+), 67 deletions(-) diff --git a/NEWS.md b/NEWS.md index c031add9266..7da190b2152 100644 --- a/NEWS.md +++ b/NEWS.md @@ -437,8 +437,6 @@ Excluding feature bug fixes. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L437 * `--mjit-verbose` and `--mjit-warning` output "JIT cancel" when JIT-ed code is disabled because TracePoint or GC.compact is used. -* `RubyVM::MJIT` is renamed to `RubyVM::JIT`. [[Feature #17490]] - ### YJIT: New experimental in-process JIT compiler New JIT compiler available as an experimental feature. [[Feature #18229]] diff --git a/benchmark/lib/benchmark_driver/runner/mjit.rb b/benchmark/lib/benchmark_driver/runner/mjit.rb index abefa463b30..1d4693e8be2 100644 --- a/benchmark/lib/benchmark_driver/runner/mjit.rb +++ b/benchmark/lib/benchmark_driver/runner/mjit.rb @@ -14,17 +14,17 @@ class BenchmarkDriver::Runner::Mjit < BenchmarkDriver::Runner::Ips https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit.rb#L14 jobs.map do |job| job = job.dup job.prelude = "#{job.prelude}\n#{<<~EOS}" - if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? __bmdv_ruby_i = 0 while __bmdv_ruby_i < 10000 # jit_min_calls #{job.script} __bmdv_ruby_i += 1 end - RubyVM::JIT.pause # compile + RubyVM::MJIT.pause # compile #{job.script} - RubyVM::JIT.resume; RubyVM::JIT.pause # recompile + RubyVM::MJIT.resume; RubyVM::MJIT.pause # recompile #{job.script} - RubyVM::JIT.resume; RubyVM::JIT.pause # recompile 2 + RubyVM::MJIT.resume; RubyVM::MJIT.pause # recompile 2 end EOS job diff --git a/benchmark/lib/benchmark_driver/runner/mjit_exec.rb b/benchmark/lib/benchmark_driver/runner/mjit_exec.rb index 46e662bc7c6..eac3dfba848 100644 --- a/benchmark/lib/benchmark_driver/runner/mjit_exec.rb +++ b/benchmark/lib/benchmark_driver/runner/mjit_exec.rb @@ -135,7 +135,7 @@ class BenchmarkDriver::Runner::MjitExec https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L135 nil end % end - RubyVM::JIT.pause if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? + RubyVM::MJIT.pause if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? def vm t = Process.clock_gettime(Process::CLOCK_MONOTONIC) @@ -172,7 +172,7 @@ class BenchmarkDriver::Runner::MjitExec https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L172 a<%= i %> a<%= i %> # --jit-min-calls=2 % end - RubyVM::JIT.pause if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? + RubyVM::MJIT.pause if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? def vm t = Process.clock_gettime(Process::CLOCK_MONOTONIC) @@ -228,7 +228,7 @@ class BenchmarkDriver::Runner::MjitExec https://github.com/ruby/ruby/blob/trunk/benchmark/lib/benchmark_driver/runner/mjit_exec.rb#L228 jit jit - RubyVM::JIT.pause if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? + RubyVM::MJIT.pause if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? File.write(<%= result.dump %>, jit) EOS end diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 11d5a6c17ef..2cd91ffd07b 100755 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -383,7 +383,7 @@ def assert_normal_exit(testsrc, *rest, timeout: nil, **opt) https://github.com/ruby/ruby/blob/trunk/bootstraptest/runner.rb#L383 end def assert_finish(timeout_seconds, testsrc, message = '') - if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? # for --jit-wait + if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? # for --jit-wait timeout_seconds *= 3 end newtest diff --git a/spec/ruby/core/io/flush_spec.rb b/spec/ruby/core/io/flush_spec.rb index 8de373a0bd5..34cf42c425a 100644 --- a/spec/ruby/core/io/flush_spec.rb +++ b/spec/ruby/core/io/flush_spec.rb @@ -23,7 +23,7 @@ describe "IO#flush" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/io/flush_spec.rb#L23 # For instance, MJIT creates a worker before @r.close with fork(), @r.close happens, # and the MJIT worker keeps the pipe open until the worker execve(). # TODO: consider acquiring GVL from MJIT worker. - guard_not -> { defined?(RubyVM::JIT) && RubyVM::JIT.enabled? } do + guard_not -> { defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? } do it "raises Errno::EPIPE if sync=false and the read end is closed" do @w.sync = false @w.write "foo" diff --git a/spec/ruby/core/io/shared/write.rb b/spec/ruby/core/io/shared/write.rb index 5e53d981c5c..270b84ac398 100644 --- a/spec/ruby/core/io/shared/write.rb +++ b/spec/ruby/core/io/shared/write.rb @@ -99,7 +99,7 @@ describe :io_write, shared: true do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/io/shared/write.rb#L99 # For instance, MJIT creates a worker before @r.close with fork(), @r.close happens, # and the MJIT worker keeps the pipe open until the worker execve(). # TODO: consider acquiring GVL from MJIT worker. - guard_not -> { defined?(RubyVM::JIT) && RubyVM::JIT.enabled? } do + guard_not -> { defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? } do it "raises Errno::EPIPE if the read end is closed and does not die from SIGPIPE" do @r.close -> { @w.send(@method, "foo") }.should raise_error(Errno::EPIPE, /Broken pipe/) diff --git a/template/fake.rb.in b/template/fake.rb.in index 63ddad3e987..2280a4d8e79 100644 --- a/template/fake.rb.in +++ b/template/fake.rb.in @@ -32,7 +32,7 @@ class Object https://github.com/ruby/ruby/blob/trunk/template/fake.rb.in#L32 CROSS_COMPILING = RUBY_PLATFORM constants.grep(/^RUBY_/) {|n| remove_const n} % arg['versions'].each {|n, v| - <%=n%> = <%if n=='RUBY_DESCRIPTION' %>RubyVM.const_defined?(:JIT) && RubyVM::JIT.enabled? ? + <%=n%> = <%if n=='RUBY_DESCRIPTION' %>RubyVM.const_defined?(:JIT) && RubyVM::MJIT.enabled? ? <%=arg['RUBY_DESCRIPTION_WITH_JIT'].inspect%> : <%end%><%=v.inspect%> % } diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb index 6aa294bc5e3..569172d42cb 100644 --- a/test/-ext-/bug_reporter/test_bug_reporter.rb +++ b/test/-ext-/bug_reporter/test_bug_reporter.rb @@ -7,7 +7,7 @@ class TestBugReporter < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/-ext-/bug_reporter/test_bug_reporter.rb#L7 skip if ENV['RUBY_ON_BUG'] description = RUBY_DESCRIPTION - description = description.sub(/\+MJIT /, '') if defined?(RubyVM::JIT) && RubyVM::JIT.enabled? + description = description.sub(/\+MJIT /, '') if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled? description = description.sub(/\+YJIT /, '') if defined?(RubyVM::YJIT.enabled?) && RubyVM::YJIT.enabled? expected_stderr = [ :*, diff --git a/test/csv/parse/test_general.rb b/test/csv/parse/test_general.rb index 14903d462cb..52b0cab000f 100644 --- a/test/csv/parse/test_general.rb +++ b/test/csv/parse/test_general.rb @@ -247,7 +247,7 @@ line,5,jkl https://github.com/ruby/ruby/blob/trunk/test/csv/parse/test_general.rb#L247 def assert_parse_errors_out(data, **options) assert_raise(CSV::MalformedCSVError) do timeout = 0.2 - if defined?(RubyVM::JIT.enabled?) and RubyVM::JIT.enabled? + if defined?(RubyVM::MJIT.enabled?) and RubyVM::MJIT.enabled? timeout = 5 # for --jit-wait end Timeout.timeout(timeout) do diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index f3d20201bc9.. (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/