summaryrefslogtreecommitdiff
path: root/lib/ruby_vm/rjit/compiler.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <[email protected]>2023-03-09 22:14:43 -0800
committerTakashi Kokubun <[email protected]>2023-03-09 22:15:16 -0800
commit4afe9c09a0cd4688198a5f6f147e5896913200df (patch)
tree70c58deb4fefdc2cd927322000f9c3f0e347d28f /lib/ruby_vm/rjit/compiler.rb
parent35fd79ac3713478c8114a498d3536c05ad832063 (diff)
RJIT: Use imemo_type_p instead
which seems safer. It seems like imemo_type can cause SEGV.
Diffstat (limited to 'lib/ruby_vm/rjit/compiler.rb')
-rw-r--r--lib/ruby_vm/rjit/compiler.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ruby_vm/rjit/compiler.rb b/lib/ruby_vm/rjit/compiler.rb
index 9e0454edaa..697e7f62d6 100644
--- a/lib/ruby_vm/rjit/compiler.rb
+++ b/lib/ruby_vm/rjit/compiler.rb
@@ -139,7 +139,7 @@ module RubyVM::RJIT
def invalidate_block(block)
iseq = block.iseq
# Avoid touching GCed ISEQs. We assume it won't be re-entered.
- return if C.imemo_type(iseq) != C.imemo_iseq
+ return unless C.imemo_type_p(iseq, C.imemo_iseq)
# Remove this block from the version array
remove_block(iseq, block)
@@ -296,7 +296,8 @@ module RubyVM::RJIT
def rjit_blocks(iseq)
# Guard against ISEQ GC at random moments
- if C.imemo_type(iseq) != C.imemo_iseq
+
+ unless C.imemo_type_p(iseq, C.imemo_iseq)
return Hash.new { |h, k| h[k] = {} }
end