This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_free_tmps(): don't test for PL_sv_undef
authorDavid Mitchell <davem@iabyn.com>
Sun, 8 Nov 2015 19:19:02 +0000 (19:19 +0000)
committerDavid Mitchell <davem@iabyn.com>
Wed, 3 Feb 2016 09:18:32 +0000 (09:18 +0000)
commit520275ba7f707faa538ca41c5a6af2cab8fb566a
treedc46c8dd31ea79ba2d78ad29f2526a486b94cba7
parent3706fcea6257cb3ac83ac11700364056e0799895
Perl_free_tmps(): don't test for PL_sv_undef

Each sv being popped off the tmps stack is compared against PL_sv_undef,
and if so, the SvTEMP_off(sv); SvREFCNT_dec_NN(sv); is skipped.

This condition was added by 8aacddc1 back in 2001, as part of a commit
to add support for hash placeholders. Initially it used &PL_sv_undef in
HE value slots to indicate a placeholder. In a later commit, that was
changed to &PL_sv_placeholder, but the test in free_tmps() continued
to test against &PL_sv_undef.

Im not sure what the original intent was, but I strongly suspect that
whatever purpose it may have originally served, it no longer served that
after the switch to PL_sv_placeholder.

On a purely pragmatic note, I can't see any harm in untemping PL_sv_undef;
at worst its ref count will occasionally reach 0, and the special code in
sv_free2() will reset its count to SvREFCNT_IMMORTAL. And no tests
fail....
scope.c