summaryrefslogtreecommitdiff
path: root/shape.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-06-13 15:22:28 +0200
committerJean Boussier <[email protected]>2025-06-13 23:50:30 +0200
commitb51078f82ee35d532dfd5b6981733f757d410d79 (patch)
treeb028c5779563fb86ba83ef1c1905d51496da0fc2 /shape.c
parentf2d7c6afee45cd7db86fbe2508556f88518a3bdb (diff)
Enforce consistency between shape_id and FL_EXIVAR
The FL_EXIVAR is a bit redundant with the shape_id. Now that the `shape_id` is embedded in all objects on all archs, we can cheaply check if an object has any fields with a simple bitmask.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13612
Diffstat (limited to 'shape.c')
-rw-r--r--shape.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/shape.c b/shape.c
index 06dcb8d610..44f6cf7193 100644
--- a/shape.c
+++ b/shape.c
@@ -1266,6 +1266,13 @@ rb_shape_verify_consistency(VALUE obj, shape_id_t shape_id)
}
}
+ if (FL_TEST_RAW(obj, FL_EXIVAR)) {
+ RUBY_ASSERT(rb_obj_has_exivar(obj));
+ }
+ else {
+ RUBY_ASSERT(!rb_obj_has_exivar(obj));
+ }
+
return true;
}
#endif