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(...)
This commit is contained in:
Jeremy Evans 2024-01-25 10:13:28 -08:00
parent e484ffaf20
commit 32c58753af

View File

@ -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) unsigned int set_flags, unsigned int unset_flags)
{ {
LINK_ELEMENT *iobj = (LINK_ELEMENT *)insn; 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)) { if (!IS_NEXT_INSN_ID(niobj, send) && !IS_NEXT_INSN_ID(niobj, invokesuper)) {
return false; return false;
} }