Add shape_id to RBasic under 32 bit

This makes `RBobject` `4B` larger on 32 bit systems
but simplifies the implementation a lot.

[Feature #21353]

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
This commit is contained in:
John Hawthorn 2025-05-14 11:06:46 -07:00 committed by Jean Boussier
parent 2295384a5a
commit f483befd90
Notes: git 2025-05-26 08:32:06 +00:00
16 changed files with 61 additions and 210 deletions

View file

@ -50,10 +50,6 @@
* The object has its instance variables embedded (the array of
* instance variables directly follow the object, rather than being
* on a separately allocated buffer).
* if !SHAPE_IN_BASIC_FLAGS
* 4-19: SHAPE_FLAG_MASK
* Shape ID for the object.
* endif
*/
/*!
@ -134,8 +130,7 @@ rb_class_allocate_instance(VALUE klass)
RUBY_ASSERT(rb_obj_shape(obj)->type == SHAPE_ROOT);
// Set the shape to the specific T_OBJECT shape.
ROBJECT_SET_SHAPE_ID(obj, rb_shape_root(rb_gc_heap_id_for_size(size)));
RBASIC_SET_SHAPE_ID(obj, rb_shape_root(rb_gc_heap_id_for_size(size)));
#if RUBY_DEBUG
RUBY_ASSERT(!rb_shape_obj_too_complex_p(obj));