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.
This commit is contained in:
Jean Boussier 2025-06-13 15:22:28 +02:00
parent f2d7c6afee
commit b51078f82e
Notes: git 2025-06-13 21:50:44 +00:00
4 changed files with 59 additions and 18 deletions

View file

@ -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