Skip to content

Commit

Permalink
Perl_call_sv move EXTEND into branch that needs it
Browse files Browse the repository at this point in the history
If we aren't manipulating the stack, dont fetch it, check and possibly
extend it. There is a slight chance this EXTEND was covering up missing
EXTENDs somewhere else in Perl core or CPAN C code, if future bisects or
valgrind reports show that this EXTEND by 1 must always be done, this
patch can be reverted. pp_method_named contains a EXTEND/XPUSH* call,
pp_entersub requires 1 arg on stack so, both sides of the
"if (!(flags & G_METHOD_NAMED))" test will in theory make sure there is
1 free slot on the stack on entry to a SUB or XSUB.

See also
http://www.nntp.perl.org/group/perl.perl5.porters/2015/09/msg231329.html
  • Loading branch information
bulk88 authored and tonycoz committed Oct 12, 2015
1 parent 5b434c7 commit 8c9009a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions perl.c
Expand Up @@ -2729,13 +2729,11 @@ Perl_call_sv(pTHX_ SV *sv, VOL I32 flags)
SAVEOP();
PL_op = (OP*)&myop;

{
if (!(flags & G_METHOD_NAMED)) {
dSP;
EXTEND(SP, 1);
if (!(flags & G_METHOD_NAMED)) {
PUSHs(sv);
PUTBACK;
}
PUSHs(sv);
PUTBACK;
}
oldmark = TOPMARK;
oldscope = PL_scopestack_ix;
Expand Down

0 comments on commit 8c9009a

Please sign in to comment.