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 <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2026-02-10 23:01:03 +09:00
parent c06a11912c
commit 914d64ef0c
-3
View File
@@ -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);
}