diff options
author | John Hawthorn <[email protected]> | 2025-05-23 10:49:21 -0700 |
---|---|---|
committer | John Hawthorn <[email protected]> | 2025-05-29 16:02:07 -0400 |
commit | 6a62a46c3cd8a0fe3623b5363ff21ead1e755169 () | |
tree | de2f13c708a66ac05db368a5a75c60b715d53450 /vm_insnhelper.c | |
parent | 5b3f1c4c51480cbdbd1ace92b1767f14f9fff280 (diff) |
Read {max_iv,variation}_count from prime classext
MAX_IV_COUNT is a hint which determines the size of variable width allocation we should use for a given class. We don't need to scope this by namespace, if we end up with larger builtin objects on some namespaces that isn't a user-visible problem, just extra memory use. Similarly variation_count is used to track if a given object has had too many branches in shapes it has used, and to use too_complex when that happens. That's also just a hint, so we can use the same value across namespaces without it being visible to users. Previously variation_count was being incremented (written to) on the RCLASS_EXT_READABLE ext, which seems incorrect if we wanted it to be different across namespaces
Notes: Merged: https://.com/ruby/ruby/pull/13434
-rw-r--r-- | vm_insnhelper.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -5912,7 +5912,7 @@ vm_define_method(const rb_execution_context_t *ec, VALUE obj, ID id, VALUE iseqv rb_add_method_iseq(klass, id, (const rb_iseq_t *)iseqval, cref, visi); // Set max_iv_count on klasses based on number of ivar sets that are in the initialize method if (id == idInitialize && klass != rb_cObject && RB_TYPE_P(klass, T_CLASS) && (rb_get_alloc_func(klass) == rb_class_allocate_instance)) { - RCLASS_WRITE_MAX_IV_COUNT(klass, rb_estimate_iv_count(klass, (const rb_iseq_t *)iseqval)); } if (!is_singleton && vm_scope_module_func_check(ec)) { |