Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl_op_convert_list: Avoid unnecessary processing of CONST OPs #22116

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions op.c
Original file line number Diff line number Diff line change
Expand Up @@ -5531,6 +5531,16 @@ Perl_op_convert_list(pTHX_ I32 type, I32 flags, OP *o)
if (FEATURE_MODULE_TRUE_IS_ENABLED)
flags |= OPf_SPECIAL;
}
if (type == OP_STRINGIFY && OP_TYPE_IS(o, OP_CONST) &&
!(flags & OPf_FOLDED) ) {
assert(!OpSIBLING(o));
/* Don't wrap a single CONST in a list, process that list,
* then constant fold the list back to the starting OP.
* Note: Folded CONSTs do not seem to occur frequently
* enough for it to be worth the code bloat of also
* providing a fast path for them. */
return o;
}
if (!o || o->op_type != OP_LIST)
o = force_list(o, FALSE);
else
Expand Down
Loading