aboutsummaryrefslogtreecommitdiffstats
path: root/object.c
diff options
context:
space:
mode:
authorJean Boussier <byroot@ruby-lang.org>2023-11-16 16:28:12 +0100
committerJean Boussier <jean.boussier@gmail.com>2023-11-16 17:49:59 +0100
commit81b35fe7297957d78715a812f6edecec23c6e3b2 (patch)
tree9946b12bb5d817ebf599b512ac89e1798b5aa489 /object.c
parentb92a92a3fff88a3a39bec72bfc48b1b6e936137e (diff)
downloadruby-81b35fe7297957d78715a812f6edecec23c6e3b2.tar.gz
rb_evict_ivars_to_hash: get rid of the sahpe paramater
It's only used to allocate the table with the right size, but in some case we were passing `rb_shape_get_shape_by_id(SHAPE_OBJ_TOO_COMPLEX)` which `next_iv_index` is a bit undefined. So overall we're better to just allocate a table the size of the existing object, it should be close enough in the vast majority of cases, and that's already a de-optimizaton path anyway.
Diffstat (limited to 'object.c')
-rw-r--r--object.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/object.c b/object.c
index 73fbe78edc..f442a562ea 100644
--- a/object.c
+++ b/object.c
@@ -474,7 +474,7 @@ mutable_obj_clone(VALUE obj, VALUE kwfreeze)
if (RB_OBJ_FROZEN(obj)) {
rb_shape_t * next_shape = rb_shape_transition_shape_frozen(clone);
if (!rb_shape_obj_too_complex(clone) && next_shape->type == SHAPE_OBJ_TOO_COMPLEX) {
- rb_evict_ivars_to_hash(clone, rb_shape_get_shape(clone));
+ rb_evict_ivars_to_hash(clone);
}
else {
rb_shape_set_shape(clone, next_shape);
@@ -498,7 +498,7 @@ mutable_obj_clone(VALUE obj, VALUE kwfreeze)
// If we're out of shapes, but we want to freeze, then we need to
// evacuate this clone to a hash
if (!rb_shape_obj_too_complex(clone) && next_shape->type == SHAPE_OBJ_TOO_COMPLEX) {
- rb_evict_ivars_to_hash(clone, rb_shape_get_shape(clone));
+ rb_evict_ivars_to_hash(clone);
}
else {
rb_shape_set_shape(clone, next_shape);