summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
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 /vm_insnhelper.c
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--vm_insnhelper.c9
1 files changed, 3 insertions, 6 deletions
@@ -1455,9 +1455,7 @@ vm_setivar_default(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_i
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);
}
else if (dest_shape_id != INVALID_SHAPE_ID) {
- rb_shape_t *dest_shape = RSHAPE(dest_shape_id);
-
- if (shape_id == dest_shape->parent_id && dest_shape->edge_name == id && RSHAPE_CAPACITY(shape_id) == RSHAPE_CAPACITY(dest_shape_id)) {
RUBY_ASSERT(index < RSHAPE_CAPACITY(dest_shape_id));
}
else {
@@ -1498,10 +1496,9 @@ vm_setivar(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_index_t i
VM_ASSERT(!rb_ractor_shareable_p(obj));
}
else if (dest_shape_id != INVALID_SHAPE_ID) {
- rb_shape_t *dest_shape = RSHAPE(dest_shape_id);
- shape_id_t source_shape_id = dest_shape->parent_id;
- if (shape_id == source_shape_id && dest_shape->edge_name == id && RSHAPE_CAPACITY(shape_id) == RSHAPE_CAPACITY(dest_shape_id)) {
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);
RBASIC_SET_SHAPE_ID(obj, dest_shape_id);