summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2025-05-19 09:58:14 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2025-05-21 10:27:14 -0700
commitef935705cfb1b4493b8b8cf112e435b554b3138a (patch)
tree2d426a7c4549f65143696db1f8a71cd75e4629d7
parent6df6aaa036310a499d293e76fe8da2e3093ecdbc (diff)
Use shape_id for determining "too complex"
Using `rb_shape_obj_too_complex_p` looks up the shape, but we already have the shape id. This avoids looking up the shape twice.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13373
-rw-r--r--variable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/variable.c b/variable.c
index 2f8a606930..62dfe5844e 100644
--- a/variable.c
+++ b/variable.c
@@ -1423,7 +1423,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
shape_id = RCLASS_SHAPE_ID(obj);
#endif
- if (rb_shape_obj_too_complex_p(obj)) {
+ if (rb_shape_id_too_complex_p(shape_id)) {
st_table * iv_table = RCLASS_FIELDS_HASH(obj);
if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {
found = true;
@@ -1464,7 +1464,7 @@ rb_ivar_lookup(VALUE obj, ID id, VALUE undef)
#if !SHAPE_IN_BASIC_FLAGS
shape_id = ROBJECT_SHAPE_ID(obj);
#endif
- if (rb_shape_obj_too_complex_p(obj)) {
+ if (rb_shape_id_too_complex_p(shape_id)) {
st_table * iv_table = ROBJECT_FIELDS_HASH(obj);
VALUE val;
if (rb_st_lookup(iv_table, (st_data_t)id, (st_data_t *)&val)) {