diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2023-03-28 15:21:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-28 15:21:19 -0400 |
commit | 39a34694a0e33e18b4ac6e43cb8042e2d818ecd4 (patch) | |
tree | 3d70bdeb6fdf015b95d3306130eb52bbff0802a0 /test/ruby | |
parent | 2f8a598dc598b4faaab5d8fd4740811d52fece96 (diff) | |
download | ruby-39a34694a0e33e18b4ac6e43cb8042e2d818ecd4.tar.gz |
YJIT: Add `--yjit-pause` and `RubyVM::YJIT.resume` (#7609)
* YJIT: Add --yjit-pause and RubyVM::YJIT.resume
This allows booting YJIT in a suspended state. We chose to add a new
command line option as opposed to simply allowing YJIT.resume to work
without any command line option because it allows for combining with
YJIT tuning command line options. It also simpifies implementation.
Paired with Kokubun and Maxime.
* Update yjit.rb
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
---------
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: Takashi Kokubun <takashikkbn@gmail.com>
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_yjit.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_yjit.rb b/test/ruby/test_yjit.rb index 925efdf39f..af7309385f 100644 --- a/test/ruby/test_yjit.rb +++ b/test/ruby/test_yjit.rb @@ -51,6 +51,29 @@ class TestYJIT < Test::Unit::TestCase #assert_in_out_err('--yjit-call-threshold=', '', [], /--yjit-call-threshold needs an argument/) end + def test_starting_paused + program = <<~RUBY + def not_compiled = nil + def will_compile = nil + def compiled_counts = RubyVM::YJIT.runtime_stats[:compiled_iseq_count] + counts = [] + not_compiled + counts << compiled_counts + + RubyVM::YJIT.resume + + will_compile + counts << compiled_counts + + if counts[0] == 0 && counts[1] > 0 + p :ok + end + RUBY + assert_in_out_err(%w[--yjit-pause --yjit-stats --yjit-call-threshold=1], program, success: true) do |stdout, stderr| + assert_equal([":ok"], stdout) + end + end + def test_yjit_stats_and_v_no_error _stdout, stderr, _status = EnvUtil.invoke_ruby(%w(-v --yjit-stats), '', true, true) refute_includes(stderr, "NoMethodError") |