From 914d64ef0cc408155abf777d745e0fddf1bb3266 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 10 Feb 2026 23:01:03 +0900 Subject: [PATCH] vm.c: skip keyword argument hash duplication in OP_ENTER The keyword argument hash passed to a method is always freshly constructed at the call site - either by hash_new_from_regs() in OP_SEND for inline keyword pairs, or by OP_HASH/OP_HASHCAT for compiler-generated keyword arguments (including the **h splat case which creates OP_HASH(0)+OP_HASHCAT). Since no caller retains a reference to this hash, the mrb_hash_dup() was redundant. Co-authored-by: Claude --- src/vm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/vm.c b/src/vm.c index 63a5be5de..c9c8fbd40 100644 --- a/src/vm.c +++ b/src/vm.c @@ -2583,9 +2583,6 @@ RETRY_TRY_BLOCK: kdict = mrb_nil_value(); ci->nk = 0; } - else if (MRB_ASPEC_KEY(a) > 0 && !mrb_nil_p(kdict)) { - kdict = mrb_hash_dup(mrb, kdict); - } else if (!mrb_nil_p(kdict)) { mrb_gc_protect(mrb, kdict); }