class.c: store aspec in ROM method table entries

Restore MRB_ARGS_* argument specs and ISO section comments to all
709 ROM method table entries. The aspec is encoded in bits 4-27 of
the flags field; MRB_MT_NOARG is now auto-derived from aspec==0.

Add MRB_MT_ENTRY_PRIVATE() macro for private methods (53 entries)
and MRB_MT_ASPEC() accessor for extracting aspec from flags.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-20 11:44:28 +09:00
parent 20b9002214
commit 483c155a41
34 changed files with 758 additions and 744 deletions
+8 -3
View File
@@ -55,9 +55,14 @@ typedef struct mrb_mt_tbl {
#define MRB_MT_PUBLIC 0 /* MRB_METHOD_PUBLIC_FL */
#define MRB_MT_PRIVATE 1 /* MRB_METHOD_PRIVATE_FL */
/* ROM table entry: MRB_MT_FUNC is set automatically */
#define MRB_MT_ENTRY(fn, sym, flags) \
{ { .func = (fn) }, (sym), (flags) | MRB_MT_FUNC }
/* ROM table entry: MRB_MT_FUNC auto-set, MRB_MT_NOARG auto-derived from aspec==0 */
#define MRB_MT_ENTRY(fn, sym, aspec) \
{ { .func = (fn) }, (sym), \
((aspec) << 4) | MRB_MT_FUNC | (((aspec)==0)?MRB_MT_NOARG:0) }
#define MRB_MT_ENTRY_PRIVATE(fn, sym, aspec) \
{ { .func = (fn) }, (sym), \
((aspec) << 4) | MRB_MT_FUNC | MRB_MT_PRIVATE | (((aspec)==0)?MRB_MT_NOARG:0) }
#define MRB_MT_ASPEC(flags) ((mrb_aspec)((flags) >> 4))
/* ROM table initializer from const entries array (auto-computes size).
Casts away const because mrb_mt_tbl.ptr is shared with mutable layers;