Skip to content

Commit

Permalink
remove internal calls to pp_pushmark()
Browse files Browse the repository at this point in the history
Perl_pp_pushmark is a fairly simple function that does two things:
1. PUSHMARK(PL_stack_sp);
2. It returns PL_op->op_next.

All internal uses ignore the return value and can just use PUSHMARK
directly, without going through a pp_* function.
  • Loading branch information
mauke committed Feb 14, 2025
1 parent 37513d3 commit edd7635
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gv.c
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,7 @@ Perl_amagic_call(pTHX_ SV *left, SV *right, int method, int flags)
PL_op = (OP *) &myop;
if (PERLDB_SUB && PL_curstash != PL_debstash)
PL_op->op_private |= OPpENTERSUB_DB;
Perl_pp_pushmark(aTHX);
PUSHMARK(PL_stack_sp);

EXTEND(SP, notfound + 5);
PUSHs(lr>0? right: left);
Expand Down
2 changes: 1 addition & 1 deletion op.c
Original file line number Diff line number Diff line change
Expand Up @@ -5182,7 +5182,7 @@ S_gen_constant_list(pTHX_ OP *o)
#ifdef PERL_USE_HWM
PL_curstackinfo->si_stack_hwm = 0; /* stop valgrind complaining */
#endif
Perl_pp_pushmark(aTHX);
PUSHMARK(PL_stack_sp);
CALLRUNOPS(aTHX);
PL_op = curop;
assert (!(curop->op_flags & OPf_SPECIAL));
Expand Down
2 changes: 0 additions & 2 deletions pp_hot.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ PP(pp_null)
return NORMAL;
}

/* This is sometimes called directly by pp_coreargs, pp_grepstart and
amagic_call. */
PP(pp_pushmark)
{
PUSHMARK(PL_stack_sp);
Expand Down
2 changes: 1 addition & 1 deletion regen/op_private
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ addbits('coreargs',
#2 reserved for OPpDONT_INIT_GV in rv2gv
#4 reserved for OPpALLOW_FAKE in rv2gv
6 => qw(OPpCOREARGS_SCALARMOD $MOD ), # \$ rather than \[$@%*]
7 => qw(OPpCOREARGS_PUSHMARK MARK ), # Call pp_pushmark
7 => qw(OPpCOREARGS_PUSHMARK MARK ), # Call PUSHMARK
);


Expand Down

0 comments on commit edd7635

Please sign in to comment.