load.c: consolidate irep allocation for .mrb loading

Pack pool/syms/reps arrays into a single calloc with the irep struct,
reducing 4 allocations per irep to 1. Arrays are ordered by descending
alignment (pool/reps/syms) to eliminate inter-array padding.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-25 15:20:19 +09:00
parent 3c2922a361
commit 74fb046544
3 changed files with 129 additions and 29 deletions
+1
View File
@@ -82,6 +82,7 @@ struct mrb_irep {
#define MRB_ISEQ_NO_FREE 1
#define MRB_IREP_NO_FREE 2
#define MRB_IREP_STATIC (MRB_ISEQ_NO_FREE | MRB_IREP_NO_FREE)
#define MRB_IREP_CONSOLIDATED 4 /* pool/syms/reps packed with irep struct */
MRB_API mrb_irep *mrb_add_irep(mrb_state *mrb);