This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make immortal SVs contiguous
authorDavid Mitchell <davem@iabyn.com>
Wed, 12 Jul 2017 13:07:16 +0000 (14:07 +0100)
committerDavid Mitchell <davem@iabyn.com>
Thu, 27 Jul 2017 10:30:22 +0000 (11:30 +0100)
commit7c123f9da96361fa49e1d9227644d5ee5af4cd0d
tree50c618f2b8ff777ee2d919e6970ffa5700a8d931
parent56c6304063762154ca57e85c0fe6f60069dacd77
Make immortal SVs contiguous

Ensure that PL_sv_yes, PL_sv_undef, PL_sv_no and PL_sv_zero are allocated
adjacently in memory.

This allows the SvIMMORTAL() test to be more efficient, and will (in the
next commit) allow SvTRUE() to be more efficient.

In MULTIPLICITY builds the constraint is already met by virtue of them
being adjacent items in the interpreter struct. For non-MULTIPLICITY
builds, they were just 4 global vars with no guarantees of where
they would be allocated. For this case, PL_sv_undef are deleted
as global vars and replaced with a new global var PL_sv_immortals[4],
with

    #define PL_sv_yes   (PL_sv_immortals[0])

etc in their place.
embedvar.h
intrpvar.h
makedef.pl
perl.h
sv.c
sv.h