From 1de46b20510708a46033bcb2df4325de544058c7 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 11 Feb 2026 22:00:17 +0900 Subject: [PATCH] cdump.c: use IREP_TT_SSTR for pool strings in mrbc -C output pool strings generated by mrbc -C are C string literals inside static const structs, which reside in ROM. mark them as IREP_TT_SSTR (static) instead of IREP_TT_STR (dynamic) so the VM uses mrb_str_new_static() and mrb_intern_static() instead of mrb_str_new() and mrb_intern(). this avoids unnecessary malloc+memcpy for string literals longer than the embed threshold, especially on embedded platforms where mrb_ro_data_p() returns FALSE. Co-authored-by: Claude --- src/cdump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cdump.c b/src/cdump.c index e706b45aa..530a808fc 100644 --- a/src/cdump.c +++ b/src/cdump.c @@ -63,7 +63,7 @@ cdump_pool(mrb_state *mrb, const mrb_irep_pool *p, FILE *fp) else { /* string */ int i, len = p->tt>>2; const char *s = p->u.str; - fprintf(fp, "{IREP_TT_STR|(%d<<2), {\"", len); + fprintf(fp, "{IREP_TT_SSTR|(%d<<2), {\"", len); for (i=0; i