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 Takashi Kokubun
parent b3371c6ae5
commit 9b2ff68f17

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);
}