summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2022-11-08 14:09:43 -0500
committerPeter Zhu <peter@peterzhu.ca>2022-11-10 10:11:34 -0500
commitc726c48a3dacd9ca1cb0d96fee98890cb74b37d3 (patch)
treef2bbd9f9797ee63e8666fffd18c47e04571b7a6f /vm_insnhelper.c
parent5246f4027ec574e77809845e1b1f7822cc2a5cef (diff)
downloadruby-c726c48a3dacd9ca1cb0d96fee98890cb74b37d3.tar.gz
Remove numiv from RObject
Since object shapes store the capacity of an object, we no longer need the numiv field on RObjects. This gives us one extra slot which we can use to give embedded objects one more instance variable (for a total of 3 ivs). This commit removes the concept of numiv from RObject.
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 7b24392932..a39b6f87cc 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1301,8 +1301,8 @@ vm_setivar_slowpath(VALUE obj, ID id, VALUE val, const rb_iseq_t *iseq, IVC ic,
attr_index_t index;
- uint32_t num_iv = ROBJECT_NUMIV(obj);
rb_shape_t* shape = rb_shape_get_shape(obj);
+ uint32_t num_iv = shape->capacity;
shape_id_t next_shape_id = ROBJECT_SHAPE_ID(obj);
if (!rb_shape_get_iv_index(shape, id, &index)) {
@@ -1446,13 +1446,11 @@ vm_setivar(VALUE obj, ID id, VALUE val, shape_id_t dest_shape_id, attr_index_t i
if (shape_id == source_shape_id && dest_shape->edge_name == id) {
RUBY_ASSERT(dest_shape_id != INVALID_SHAPE_ID && shape_id != INVALID_SHAPE_ID);
- RUBY_ASSERT(ROBJECT_IV_CAPACITY(obj) == ROBJECT_NUMIV(obj));
ROBJECT_SET_SHAPE_ID(obj, dest_shape_id);
RUBY_ASSERT(rb_shape_get_next_iv_shape(rb_shape_get_shape_by_id(source_shape_id), id) == dest_shape);
- RUBY_ASSERT(ROBJECT_IV_CAPACITY(obj) == ROBJECT_NUMIV(obj));
- RUBY_ASSERT(index < ROBJECT_NUMIV(obj));
+ RUBY_ASSERT(index < dest_shape->capacity);
}
else {
break;