summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatoshi Tagomori <s-tagomori@sakura.ad.jp>2025-12-30 22:01:54 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2026-01-05 13:00:14 -0800
commit9b2ff68f17d225aed2ae9e72a51014cbfcaaaff1 (patch)
tree3fb04f3dc5bc7ae99325a2a12bf6dd047d80a6e0
parentb3371c6ae5dd6fcecd12128f7b3e1e18e219bd3d (diff)
Box: skip checking the current box is the root box
Because checking the current box is not a cheap process.
-rw-r--r--class.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/class.c b/class.c
index 8c773125e1..9c1bd86dc3 100644
--- a/class.c
+++ b/class.c
@@ -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);
}