Box: skip checking the current box is the root box

Because checking the current box is not a cheap process.
This commit is contained in:
Satoshi Tagomori 2025-12-30 22:01:54 +09:00 committed by Satoshi Tagomori
parent 27d6c96658
commit 966dbba8db
Notes: git 2025-12-30 13:32:18 +00:00

View File

@ -820,7 +820,7 @@ class_alloc0(enum ruby_value_type type, VALUE klass, bool boxable)
static VALUE
class_alloc(enum ruby_value_type type, VALUE klass)
{
bool boxable = BOX_ROOT_P(rb_current_box());
bool boxable = rb_box_available() && BOX_ROOT_P(rb_current_box());
return class_alloc0(type, klass, boxable);
}