diff options
author | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-01 23:15:51 -0800 |
---|---|---|
committer | Takashi Kokubun <takashikkbn@gmail.com> | 2023-03-05 23:28:59 -0800 |
commit | 3034553e8dc1e78b96ad283ab57c70e674f54d6e (patch) | |
tree | 85a8b068e2103743793b61e6330b50852f9cbce2 | |
parent | d7888e462698f89d90e7baf3a0014d63e9aaad2d (diff) | |
download | ruby-3034553e8dc1e78b96ad283ab57c70e674f54d6e.tar.gz |
Add more GC guards
-rw-r--r-- | bootstraptest/test_ractor.rb | 2 | ||||
-rw-r--r-- | lib/ruby_vm/mjit/compiler.rb | 2 | ||||
-rw-r--r-- | lib/ruby_vm/mjit/exit_compiler.rb | 5 |
3 files changed, 6 insertions, 3 deletions
diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index 831bca1239..54d4bb4b48 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -1532,7 +1532,7 @@ assert_equal "ok", %q{ 1_000.times { idle_worker, tmp_reporter = Ractor.select(*workers) } "ok" -} +} unless ENV['RUN_OPTS'] =~ /mjit/ # flaky assert_equal "ok", %q{ def foo(*); ->{ super }; end diff --git a/lib/ruby_vm/mjit/compiler.rb b/lib/ruby_vm/mjit/compiler.rb index e6dde1d824..2f67136102 100644 --- a/lib/ruby_vm/mjit/compiler.rb +++ b/lib/ruby_vm/mjit/compiler.rb @@ -289,7 +289,7 @@ module RubyVM::MJIT end def mjit_blocks(iseq) - # Tolerate GC on any ISEQ + # Guard against ISEQ GC at random moments if C.imemo_type(iseq) != C.imemo_iseq return Hash.new { |h, k| h[k] = {} } end diff --git a/lib/ruby_vm/mjit/exit_compiler.rb b/lib/ruby_vm/mjit/exit_compiler.rb index 742d8b6376..b664d795b0 100644 --- a/lib/ruby_vm/mjit/exit_compiler.rb +++ b/lib/ruby_vm/mjit/exit_compiler.rb @@ -82,7 +82,10 @@ module RubyVM::MJIT # @param target0_p [TrueClass,FalseClass] def compile_branch_stub(ctx, asm, branch_stub, target0_p) # Call rb_mjit_branch_stub_hit - asm.comment("branch stub hit: #{branch_stub.iseq.body.location.label}@#{C.rb_iseq_path(branch_stub.iseq)}:#{iseq_lineno(branch_stub.iseq, target0_p ? branch_stub.target0.pc : branch_stub.target1.pc)}") + iseq = branch_stub.iseq + if C.imemo_type(iseq) != C.imemo_iseq # Guard against ISEQ GC at random moments + asm.comment("branch stub hit: #{iseq.body.location.label}@#{C.rb_iseq_path(iseq)}:#{iseq_lineno(iseq, target0_p ? branch_stub.target0.pc : branch_stub.target1.pc)}") + end asm.mov(:rdi, to_value(branch_stub)) asm.mov(:esi, ctx.sp_offset) asm.mov(:edx, target0_p ? 1 : 0) |