Skip to content

Commit 3e851ea

Browse files
committed
Avoid box st_lookup in rb_class_real
1 parent 7687c4d commit 3e851ea

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

object.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,14 @@ static inline VALUE
264264
class_real(VALUE cl)
265265
{
266266
RUBY_ASSERT(cl);
267+
268+
// TODO: In the future we should only call this with T_CLASS
269+
RUBY_ASSERT(RB_TYPE_P(cl, T_CLASS) || RB_TYPE_P(cl, T_ICLASS) || RB_TYPE_P(cl, T_MODULE));
270+
267271
while (RB_UNLIKELY(fake_class_p(cl))) {
268-
cl = RCLASS_SUPER(cl);
272+
// All paths through super in any box will eventually result in the
273+
// same class.
274+
cl = RCLASSEXT_SUPER(RCLASS_EXT_PRIME(cl));
269275
}
270276
return cl;
271277
}

0 commit comments

Comments
 (0)