This avoids the stack moving underneath anything that directly or indirectly
calls Perl_load_module().
[Committer’s note:
This fixes bug #119993.
Furthermore, under STRESS_REALLOC, t/io/layers.t was crashing like this:
$ ./perl -Ilib -e ' open(UTF, "<:raw:encoding(utf8)", 'tmp75851B') or die $!; ref #blahblahblahblahblahblahblahblahblah'
Segmentation fault: 11
(The comment seems to be necessary to make it crash.)
It was happening because open() was causing a module to be loaded
while the arguments to open() were still on the stack.
]
if (*name == 'B') {
if (strEQ(name, "BEGIN")) {
const I32 oldscope = PL_scopestack_ix;
+ dSP;
if (floor) LEAVE_SCOPE(floor);
ENTER;
+ PUSHSTACKi(PERLSI_REQUIRE);
SAVECOPFILE(&PL_compiling);
SAVECOPLINE(&PL_compiling);
SAVEVPTR(PL_curcop);
GvCV_set(gv,0); /* cv has been hijacked */
call_list(oldscope, PL_beginav);
+ POPSTACK;
LEAVE;
}
else