-
Notifications
You must be signed in to change notification settings - Fork 575
Dedicated SV cloning code in place of Perl_sv_setsv_flags #23202
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
base: blead
Are you sure you want to change the base?
Changes from all commits
68c014c
3a2cf3b
27bfb77
dfaf1f0
dcab4dd
d7e2159
b3b192b
24b40aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5357,8 +5357,7 @@ PP(pp_subst) | |
if (dstr) { | ||
/* replacement needing upgrading? */ | ||
if (DO_UTF8(TARG) && !doutf8) { | ||
nsv = sv_newmortal(); | ||
SvSetSV(nsv, dstr); | ||
nsv = sv_mortalcopy_flags(dstr, SV_GMAGIC|SV_DO_COW_SVSETSV); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-think this chunk, macro There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That shortcut/bypass:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@tonycoz you are correct, That macro's optimization branch is impossible to execute at this particular line. |
||
sv_utf8_upgrade(nsv); | ||
c = SvPV_const(nsv, clen); | ||
doutf8 = TRUE; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe cache
*MARK
to a auto and skip the 2nd -O1/2 deref insv = newSVsv_flags(*MARK, SV_DO_COW_SVSETSV);
? fn call containing macroSvGETMAGIC(*MARK);
won't overwrite the SV* on the PL stack with a new SV*.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just calling
newSVsv_flags(*MARK, SV_DO_COW_SVSETSV|SV_GMAGIC)
should be betterdoes (MARK is %rbx), %rdi is the first function argument:
Perl_newSVsv_flags() already has the GMAGIC test and mg_get() call, saving space and a duplicate test here, and the source SV goes into a register and stays there.