gc.c: extract mrb_obj_alloc_core() for internal allocation

split mrb_obj_alloc() into type-validation wrapper and allocation
core (mrb_obj_alloc_core). internal callers (mrb_proc_new,
mrb_env_new) use the core directly, skipping 15+ lines of type
validation per allocation.

most impactful for workloads with heavy Proc/Env allocation
(lambda calculus, block-intensive code).

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-03-20 17:44:23 +09:00
parent f7d7bbef43
commit 49dff412b5
3 changed files with 40 additions and 30 deletions
+3
View File
@@ -279,4 +279,7 @@ mrb_value mrb_bint_abs(mrb_state *mrb, mrb_value x);
void mrb_task_mark_all(mrb_state *mrb);
#endif
/* Internal object allocation without type validation (gc.c) */
struct RBasic* mrb_obj_alloc_core(mrb_state*, enum mrb_vtype, struct RClass*);
#endif /* MRUBY_INTERNAL_H */