summaryrefslogtreecommitdiff
path: root/mjit_c.rb
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2022-12-06 14:52:11 -0500
committerAaron Patterson <aaron.patterson@gmail.com>2022-12-06 13:43:42 -0800
commit40a9964b893fee5680b455d0e905155be3360685 (patch)
tree69b6fbc7355cbef1cf311d50fbc496773b94bda7 /mjit_c.rb
parent64cdf8bae7cd85bc2911b39074d5710616c7ec73 (diff)
Set max_iv_count (used for object shapes) based on inline caches
With this change, we're storing the iv name on an inline cache on setinstancevariable instructions. This allows us to check the inline cache to count instance variables set in initialize and give us an estimate of iv capacity for an object. For the purpose of estimating the number of instance variables required for an object, we're assuming that all initialize methods will call `super`. This change allows us to estimate the number of instance variables required without disassembling instruction sequences. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6870
Diffstat (limited to 'mjit_c.rb')
-rw-r--r--mjit_c.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/mjit_c.rb b/mjit_c.rb
index e4933c3458..39ca89a0ea 100644
--- a/mjit_c.rb
+++ b/mjit_c.rb
@@ -310,6 +310,7 @@ module RubyVM::MJIT
@iseq_inline_iv_cache_entry ||= CType::Struct.new(
"iseq_inline_iv_cache_entry", Primitive.cexpr!("SIZEOF(struct iseq_inline_iv_cache_entry)"),
value: [CType::Immediate.parse("uintptr_t"), Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_iv_cache_entry *)NULL)), value)")],
+ iv_set_name: [self.ID, Primitive.cexpr!("OFFSETOF((*((struct iseq_inline_iv_cache_entry *)NULL)), iv_set_name)")],
)
end