diff options
author | Jeremy Evans <code@jeremyevans.net> | 2024-01-25 10:13:28 -0800 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2024-03-01 07:10:25 -0800 |
commit | 32c58753afa763c5be64684876ee4e6aed550ad7 (patch) | |
tree | 0a818b76230bd98bda1ba30540bb42ae6308b17e /compile.c | |
parent | e484ffaf2016ae3261ce5810658f4634b434720e (diff) |
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(...)
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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; } |