summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorJean Boussier <jean.boussier@gmail.com>2025-08-26 09:19:07 +0200
committerJean Boussier <jean.boussier@gmail.com>2025-08-26 13:44:59 +0200
commit14bdf4b57dcd3169a8717dc893fd1e1be897deeb (patch)
treecf7e21a3c2f7d6bd9fa53788b3bbecd2c2a3ea80 /shape.c
parent59c996797e16f45a3b91baa04083c2da3a1edfcb (diff)
Ensure T_OBJECT and T_IMEMO/fields have identical layout
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/shape.c b/shape.c
index 4345654f84..05aea7905c 100644
--- a/shape.c
+++ b/shape.c
@@ -1270,6 +1270,11 @@ rb_shape_verify_consistency(VALUE obj, shape_id_t shape_id)
// Make sure SHAPE_ID_HAS_IVAR_MASK is valid.
if (rb_shape_too_complex_p(shape_id)) {
RUBY_ASSERT(shape_id & SHAPE_ID_HAS_IVAR_MASK);
+
+ // Ensure complex object don't appear as embedded
+ if (RB_TYPE_P(obj, T_OBJECT) || IMEMO_TYPE_P(obj, imemo_fields)) {
+ RUBY_ASSERT(!FL_TEST_RAW(obj, ROBJECT_EMBED));
+ }
}
else {
attr_index_t ivar_count = RSHAPE_LEN(shape_id);