diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2025-05-27 15:53:45 +0200 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2025-06-04 07:59:20 +0200 |
| commit | 625d6a9cbb0ed617b28115e4e3cb063e52481635 (patch) | |
| tree | 610cfd170759de7e0b65369dfe4e3421a2f699bf /variable.c | |
| parent | 6b7e3395a4ab69f5eaefb983243a8e4cad7f8abf (diff) | |
Get rid of frozen shapes.
Instead `shape_id_t` higher bits contain flags, and the first one
tells whether the shape is frozen.
This has multiple benefits:
- Can check if a shape is frozen with a single bit check instead of
dereferencing a pointer.
- Guarantees it is always possible to transition to frozen.
- This allow reclaiming `FL_FREEZE` (not done yet).
The downside is you have to be careful to preserve these flags
when transitioning.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13289
Diffstat (limited to 'variable.c')
| -rw-r--r-- | variable.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/variable.c b/variable.c index f7ba33e089..bef25c147f 100644 --- a/variable.c +++ b/variable.c @@ -2057,12 +2057,6 @@ void rb_obj_freeze_inline(VALUE x) } shape_id_t next_shape_id = rb_shape_transition_frozen(x); - - // If we're transitioning from "not complex" to "too complex" - // then evict ivars. This can happen if we run out of shapes - if (rb_shape_too_complex_p(next_shape_id) && !rb_shape_obj_too_complex_p(x)) { - rb_evict_fields_to_hash(x); - } rb_obj_set_shape_id(x, next_shape_id); if (RBASIC_CLASS(x)) { @@ -2227,8 +2221,6 @@ iterate_over_shapes_with_callback(rb_shape_t *shape, rb_ivar_foreach_callback_fu } } return false; - case SHAPE_FROZEN: - return iterate_over_shapes_with_callback(RSHAPE(shape->parent_id), callback, itr_data); case SHAPE_OBJ_TOO_COMPLEX: default: rb_bug("Unreachable"); |
