diff options
author | Aaron Patterson <[email protected]> | 2024-06-06 17:38:25 -0700 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2024-07-31 16:23:28 -0700 |
commit | bbeebc9258f11db188c34a9a24e64f03448667c3 (patch) | |
tree | 6f3b6219adc7c3335cf54f1bd77308609a764a3d /vm_callinfo.h | |
parent | 16b0242808b5a2dc7c1c80dc9ace547f64280a1b (diff) |
Only set shape id for CCs on attr_set + ivar
Only ivar reader and writer methods should need the shape ID set on the
inline cache. We shouldn't accidentally overwrite parts of the CC union
when it's not necessary.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/11291
Diffstat (limited to 'vm_callinfo.h')
-rw-r--r-- | vm_callinfo.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_callinfo.h b/vm_callinfo.h index bb4e46e758..d85261aaf9 100644 --- a/vm_callinfo.h +++ b/vm_callinfo.h @@ -348,7 +348,10 @@ vm_cc_new(VALUE klass, break; } - vm_cc_attr_index_initialize(cc, INVALID_SHAPE_ID); + if (cme->def->type == VM_METHOD_TYPE_ATTRSET || cme->def->type == VM_METHOD_TYPE_IVAR) { + vm_cc_attr_index_initialize(cc, INVALID_SHAPE_ID); + } + RB_DEBUG_COUNTER_INC(cc_new); return cc; } |