diff options
author | Peter Zhu <[email protected]> | 2023-12-06 07:37:57 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2023-12-06 11:34:07 -0500 |
commit | 12e3b07455fea0e99e6aaf1893a7883fb2b0197e (patch) | |
tree | ca60535e2dc5ca4ef37b2884fc29c3dd0ade2183 /object.c | |
parent | f80262b14d01a977ce386a5a377e911a90ce328d (diff) |
Re-embed when removing Object instance variables
Objects with the same shape must always have the same "embeddedness"
(either embedded or heap allocated) because YJIT assumes so. However,
using remove_instance_variable, it's possible that some objects are
embedded and some are heap allocated because it does not re-embed heap
allocated objects.
This commit changes remove_instance_variable to re-embed Object
instance variables when it becomes small enough.
Diffstat (limited to 'object.c')
-rw-r--r-- | object.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -92,6 +92,12 @@ static VALUE rb_cFalseClass_to_s; /*! \endcond */ +size_t +rb_obj_embedded_size(uint32_t numiv) +{ + return offsetof(struct RObject, as.ary) + (sizeof(VALUE) * numiv); +} + VALUE rb_obj_hide(VALUE obj) { |