summaryrefslogtreecommitdiff
path: root/shape.h
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-07 14:44:13 +0200
committerJean Boussier <[email protected]>2025-06-07 18:30:44 +0200
commit6eb0cd8df703d0a2edf7b11eab3255295e58c888 ()
tree4d3e7e6a860a1ff5ca18b91a807bc5a7eb9236b7 /shape.h
parent1c96aed6eea39a06a4b790ddc7a31a0b35a9330e (diff)
Get rid of SHAPE_T_OBJECT
Now that we have the `heap_index` in shape flags we no longer need `T_OBJECT` shapes.
Notes: Merged: https://.com/ruby/ruby/pull/13556
-rw-r--r--shape.h25
1 files changed, 20 insertions, 5 deletions
@@ -44,7 +44,6 @@ typedef uint32_t redblack_id_t;
#define ROOT_TOO_COMPLEX_SHAPE_ID (ROOT_SHAPE_ID | SHAPE_ID_FL_TOO_COMPLEX)
#define ROOT_TOO_COMPLEX_WITH_OBJ_ID (ROOT_SHAPE_WITH_OBJ_ID | SHAPE_ID_FL_TOO_COMPLEX | SHAPE_ID_FL_HAS_OBJECT_ID)
#define SPECIAL_CONST_SHAPE_ID (ROOT_SHAPE_ID | SHAPE_ID_FL_FROZEN)
-#define FIRST_T_OBJECT_SHAPE_ID 0x2
extern ID ruby_internal_object_id;
@@ -74,7 +73,6 @@ enum shape_type {
SHAPE_ROOT,
SHAPE_IVAR,
SHAPE_OBJ_ID,
- SHAPE_T_OBJECT,
};
enum shape_flags {
@@ -89,6 +87,7 @@ typedef struct {
/* object shapes */
rb_shape_t *shape_list;
rb_shape_t *root_shape;
rb_atomic_t next_shape_id;
redblack_node_t *shape_cache;
@@ -209,8 +208,7 @@ rb_shape_root(size_t heap_id)
{
shape_id_t heap_index = (shape_id_t)heap_id;
- shape_id_t shape_id = (heap_index + FIRST_T_OBJECT_SHAPE_ID);
- return shape_id | ((heap_index + 1) << SHAPE_ID_HEAP_INDEX_OFFSET);
}
static inline bool
@@ -220,9 +218,26 @@ RSHAPE_TYPE_P(shape_id_t shape_id, enum shape_type type)
}
static inline attr_index_t
RSHAPE_CAPACITY(shape_id_t shape_id)
{
- return RSHAPE(shape_id)->capacity;
}
static inline attr_index_t