summaryrefslogtreecommitdiff
path: root/shape.h
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-11 14:32:35 +0200
committerJean Boussier <[email protected]>2025-06-11 16:38:38 +0200
commit95201299fd7bf0918dfbd8c127ce2b5b33ffa537 ()
treeb6659cd0932fa3f0cb71c8cf8c2aba382d86cf6b /shape.h
parent4463ac264dc44979ea74bbca3de58ae72d5eea71 (diff)
Refactor the last references to `rb_shape_t`
The type isn't opaque because Ruby isn't often compiled with LTO, so for optimization purpose it's better to allow as much inlining as possible. However ideally only `shape.c` and `shape.h` should deal with the actual struct, and everything else should just deal with opaque `shape_id_t`.
Notes: Merged: https://.com/ruby/ruby/pull/13586
-rw-r--r--shape.h17
1 files changed, 16 insertions, 1 deletions
@@ -158,6 +158,9 @@ shape_id_t rb_shape_get_next_iv_shape(shape_id_t shape_id, ID id);
bool rb_shape_get_iv_index(shape_id_t shape_id, ID id, attr_index_t *value);
bool rb_shape_get_iv_index_with_hint(shape_id_t shape_id, ID id, attr_index_t *value, shape_id_t *shape_id_hint);
shape_id_t rb_shape_transition_frozen(VALUE obj);
shape_id_t rb_shape_transition_complex(VALUE obj);
shape_id_t rb_shape_transition_remove_ivar(VALUE obj, ID id, shape_id_t *removed_shape_id);
@@ -211,10 +214,22 @@ rb_shape_root(size_t heap_id)
return ROOT_SHAPE_ID | ((heap_index + 1) << SHAPE_ID_HEAP_INDEX_OFFSET);
}
static inline bool
RSHAPE_TYPE_P(shape_id_t shape_id, enum shape_type type)
{
- return RSHAPE(shape_id)->type == type;
}
static inline attr_index_t