From 32c58753afa763c5be64684876ee4e6aed550ad7 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Thu, 25 Jan 2024 10:13:28 -0800 Subject: [PATCH] Fix splatarray false peephole optimization for f(*ary, **kw, &block) This optimization stopped being using when the splatkw VM instruction was added. This change allows the optimization to apply again. This also optimizes the following cases: super(*ary, **kw, &block) f(...) super(...) --- compile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compile.c b/compile.c index b330511b12..05e4091172 100644 --- a/compile.c +++ b/compile.c @@ -3192,6 +3192,10 @@ optimize_args_splat_no_copy(rb_iseq_t *iseq, INSN *insn, LINK_ELEMENT *niobj, unsigned int set_flags, unsigned int unset_flags) { LINK_ELEMENT *iobj = (LINK_ELEMENT *)insn; + if ((set_flags & VM_CALL_ARGS_BLOCKARG) && (set_flags & VM_CALL_KW_SPLAT) && + IS_NEXT_INSN_ID(niobj, splatkw)) { + niobj = niobj->next; + } if (!IS_NEXT_INSN_ID(niobj, send) && !IS_NEXT_INSN_ID(niobj, invokesuper)) { return false; }