diff options
author | Richard Leach <richardleach@users.noreply.github.com> | 2023-02-11 00:26:39 +0000 |
---|---|---|
committer | Richard Leach <richardleach@users.noreply.github.com> | 2023-02-13 21:58:55 +0000 |
commit | c56d7fa9134de66efe85a2fd70b28069c2629e0d (patch) | |
tree | 75213b2452440a30c219f4051a1a554659672408 /pp_hot.c | |
parent | 3249496afe65ad71b051caad311d33c4fdd43d8d (diff) | |
download | perl-c56d7fa9134de66efe85a2fd70b28069c2629e0d.tar.gz |
Perl_leave_adjust_stacks: don't make mortal copies of SvIMMORTAL SVs
SvIMMORTAL SVs cannot be prematurely freed and so there is no need
to create a mortal copy of them. They also will not leak, so there
is no need to add the SV* to the temp stack.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -5041,6 +5041,13 @@ Perl_leave_adjust_stacks(pTHX_ SV **from_sp, SV **to_sp, U8 gimme, int pass) } } } + else if (SvIMMORTAL(sv)){ + /* Since SvIMMORTALs are never freed, even when their + * refcount drops to zero, there's no benefit in + * creating a mortal copy. + */ + *++to_sp = sv; + } else { /* Make a mortal copy of the SV. * The following code is the equivalent of sv_mortalcopy() |