summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--av.c20
-rw-r--r--doio.c4
-rw-r--r--doop.c2
-rw-r--r--ext/DB_File/DB_File.xs10
-rw-r--r--ext/DynaLoader/dl_dld.xs2
-rw-r--r--ext/Opcode/Opcode.xs2
-rw-r--r--ext/POSIX/POSIX.xs14
-rw-r--r--ext/Socket/Socket.xs2
-rw-r--r--ext/Thread/Thread.xs14
-rw-r--r--gv.c2
-rw-r--r--mg.c12
-rw-r--r--op.c4
-rw-r--r--os2/OS2/REXX/REXX.xs6
-rw-r--r--perl.c12
-rw-r--r--pod/perlcall.pod53
-rw-r--r--pod/perlembed.pod4
-rw-r--r--pod/perlguts.pod10
-rw-r--r--pod/perlxs.pod4
-rw-r--r--pp.c8
-rw-r--r--pp_ctl.c40
-rw-r--r--pp_hot.c26
-rw-r--r--pp_sys.c16
-rw-r--r--util.c6
23 files changed, 137 insertions, 136 deletions
diff --git a/av.c b/av.c
index ae5ffab472..fad0b2ebdd 100644
--- a/av.c
+++ b/av.c
@@ -53,8 +53,8 @@ av_extend(AV *av, I32 key)
dSP;
ENTER;
SAVETMPS;
- PUSHMARK(sp);
- EXTEND(sp,2);
+ PUSHMARK(SP);
+ EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(sv_2mortal(newSViv(key+1)));
PUTBACK;
@@ -388,8 +388,8 @@ av_push(register AV *av, SV *val)
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHMARK(sp);
- EXTEND(sp,2);
+ PUSHMARK(SP);
+ EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(val);
PUTBACK;
@@ -413,7 +413,7 @@ av_pop(register AV *av)
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
ENTER;
@@ -446,8 +446,8 @@ av_unshift(register AV *av, register I32 num)
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHMARK(sp);
- EXTEND(sp,1+num);
+ PUSHMARK(SP);
+ EXTEND(SP,1+num);
PUSHs(mg->mg_obj);
while (num-- > 0) {
PUSHs(&sv_undef);
@@ -495,7 +495,7 @@ av_shift(register AV *av)
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
ENTER;
@@ -536,8 +536,8 @@ av_fill(register AV *av, I32 fill)
dSP;
ENTER;
SAVETMPS;
- PUSHMARK(sp);
- EXTEND(sp,2);
+ PUSHMARK(SP);
+ EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(sv_2mortal(newSViv(fill+1)));
PUTBACK;
diff --git a/doio.c b/doio.c
index af65e6eb79..d8ce25d186 100644
--- a/doio.c
+++ b/doio.c
@@ -816,7 +816,7 @@ my_stat(ARGSproto)
GV* tmpgv;
if (op->op_flags & OPf_REF) {
- EXTEND(sp,1);
+ EXTEND(SP,1);
tmpgv = cGVOP->op_gv;
do_fstat:
io = GvIO(tmpgv);
@@ -867,7 +867,7 @@ my_lstat(ARGSproto)
djSP;
SV *sv;
if (op->op_flags & OPf_REF) {
- EXTEND(sp,1);
+ EXTEND(SP,1);
if (cGVOP->op_gv == defgv) {
if (laststype != OP_LSTAT)
croak("The stat preceding -l _ wasn't an lstat");
diff --git a/doop.c b/doop.c
index 4b10dde91e..2de93762d3 100644
--- a/doop.c
+++ b/doop.c
@@ -502,7 +502,7 @@ do_kv(ARGSproto)
}
/* Guess how much room we need. hv_max may be a few too many. Oh well. */
- EXTEND(sp, HvMAX(hv) * (dokeys + dovalues));
+ EXTEND(SP, HvMAX(hv) * (dokeys + dovalues));
PUTBACK; /* hv_iternext and hv_iterval might clobber stack_sp */
while (entry = realhv ? hv_iternext(hv) : avhv_iternext((AV*)hv)) {
diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs
index 91b4dc2ad5..4f70a2df73 100644
--- a/ext/DB_File/DB_File.xs
+++ b/ext/DB_File/DB_File.xs
@@ -356,8 +356,8 @@ const DBT * key2 ;
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
- EXTEND(sp,2) ;
+ PUSHMARK(SP) ;
+ EXTEND(SP,2) ;
PUSHs(sv_2mortal(newSVpv(data1,key1->size)));
PUSHs(sv_2mortal(newSVpv(data2,key2->size)));
PUTBACK ;
@@ -403,8 +403,8 @@ const DBT * key2 ;
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
- EXTEND(sp,2) ;
+ PUSHMARK(SP) ;
+ EXTEND(SP,2) ;
PUSHs(sv_2mortal(newSVpv(data1,key1->size)));
PUSHs(sv_2mortal(newSVpv(data2,key2->size)));
PUTBACK ;
@@ -441,7 +441,7 @@ size_t size ;
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSVpv((char*)data,size)));
PUTBACK ;
diff --git a/ext/DynaLoader/dl_dld.xs b/ext/DynaLoader/dl_dld.xs
index 44933ec92c..a0bdcc8de1 100644
--- a/ext/DynaLoader/dl_dld.xs
+++ b/ext/DynaLoader/dl_dld.xs
@@ -144,7 +144,7 @@ dl_undef_symbols()
if (dld_undefined_sym_count) {
int x;
char **undef_syms = dld_list_undefined_sym();
- EXTEND(sp, dld_undefined_sym_count);
+ EXTEND(SP, dld_undefined_sym_count);
for (x=0; x < dld_undefined_sym_count; x++)
PUSHs(sv_2mortal(newSVpv(undef_syms[x]+1, 0)));
free(undef_syms);
diff --git a/ext/Opcode/Opcode.xs b/ext/Opcode/Opcode.xs
index cf5c859395..b9e4c87200 100644
--- a/ext/Opcode/Opcode.xs
+++ b/ext/Opcode/Opcode.xs
@@ -252,7 +252,7 @@ _safe_call_sv(package, mask, codesv)
sv_free((SV*)GvHV(gv));
GvHV(gv) = (HV*)SvREFCNT_inc(defstash);
- PUSHMARK(sp);
+ PUSHMARK(SP);
perl_call_sv(codesv, GIMME|G_EVAL|G_KEEPERR); /* use callers context */
SPAGAIN; /* for the PUTBACK added by xsubpp */
LEAVE;
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 31439b2365..8807d68189 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -3213,7 +3213,7 @@ pipe()
PPCODE:
int fds[2];
if (pipe(fds) != -1) {
- EXTEND(sp,2);
+ EXTEND(SP,2);
PUSHs(sv_2mortal(newSViv(fds[0])));
PUSHs(sv_2mortal(newSViv(fds[1])));
}
@@ -3257,7 +3257,7 @@ uname()
#ifdef HAS_UNAME
struct utsname buf;
if (uname(&buf) >= 0) {
- EXTEND(sp, 5);
+ EXTEND(SP, 5);
PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
@@ -3325,7 +3325,7 @@ strtod(str)
num = strtod(str, &unparsed);
PUSHs(sv_2mortal(newSVnv(num)));
if (GIMME == G_ARRAY) {
- EXTEND(sp, 1);
+ EXTEND(SP, 1);
if (unparsed)
PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
else
@@ -3346,7 +3346,7 @@ strtol(str, base = 0)
else
PUSHs(sv_2mortal(newSVnv((double)num)));
if (GIMME == G_ARRAY) {
- EXTEND(sp, 1);
+ EXTEND(SP, 1);
if (unparsed)
PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
else
@@ -3367,7 +3367,7 @@ strtoul(str, base = 0)
else
PUSHs(sv_2mortal(newSVnv((double)num)));
if (GIMME == G_ARRAY) {
- EXTEND(sp, 1);
+ EXTEND(SP, 1);
if (unparsed)
PUSHs(sv_2mortal(newSViv(strlen(unparsed))));
else
@@ -3468,7 +3468,7 @@ times()
struct tms tms;
clock_t realtime;
realtime = times( &tms );
- EXTEND(sp,5);
+ EXTEND(SP,5);
PUSHs( sv_2mortal( newSViv( (IV) realtime ) ) );
PUSHs( sv_2mortal( newSViv( (IV) tms.tms_utime ) ) );
PUSHs( sv_2mortal( newSViv( (IV) tms.tms_stime ) ) );
@@ -3546,7 +3546,7 @@ tzset()
void
tzname()
PPCODE:
- EXTEND(sp,2);
+ EXTEND(SP,2);
PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
diff --git a/ext/Socket/Socket.xs b/ext/Socket/Socket.xs
index d2f3d9e10d..3664368cab 100644
--- a/ext/Socket/Socket.xs
+++ b/ext/Socket/Socket.xs
@@ -828,7 +828,7 @@ unpack_sockaddr_in(sin_sv)
port = ntohs(addr.sin_port);
ip_address = addr.sin_addr;
- EXTEND(sp, 2);
+ EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv((IV) port)));
PUSHs(sv_2mortal(newSVpv((char *)&ip_address,sizeof ip_address)));
}
diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs
index 3b49dbecb2..aea72f4a46 100644
--- a/ext/Thread/Thread.xs
+++ b/ext/Thread/Thread.xs
@@ -117,8 +117,8 @@ threadstart(void *arg)
PUTBACK;
perl_call_sv(sv, G_ARRAY|G_EVAL);
SPAGAIN;
- retval = sp - (stack_base + oldmark);
- sp = stack_base + oldmark + 1;
+ retval = SP - (stack_base + oldmark);
+ SP = stack_base + oldmark + 1;
if (SvCUR(thr->errsv)) {
MUTEX_LOCK(&thr->mutex);
thr->flags |= THRf_DID_DIE;
@@ -131,12 +131,12 @@ threadstart(void *arg)
DEBUG_L(STMT_START {
for (i = 1; i <= retval; i++) {
PerlIO_printf(PerlIO_stderr(), "%p return[%d] = %s\n",
- thr, i, SvPEEK(sp[i - 1]));
+ thr, i, SvPEEK(SP[i - 1]));
}
} STMT_END);
av_store(av, 0, &sv_yes);
- for (i = 1; i <= retval; i++, sp++)
- sv_setsv(*av_fetch(av, i, TRUE), SvREFCNT_inc(*sp));
+ for (i = 1; i <= retval; i++, SP++)
+ sv_setsv(*av_fetch(av, i, TRUE), SvREFCNT_inc(*SP));
}
finishoff:
@@ -219,7 +219,7 @@ newthread (SV *startsv, AV *initargs, char *classname)
"%p: newthread (%p), tid is %u, preparing stack\n",
savethread, thr, thr->tid));
/* The following pushes the arg list and startsv onto the *new* stack */
- PUSHMARK(sp);
+ PUSHMARK(SP);
/* Could easily speed up the following greatly */
for (i = 0; i <= AvFILL(initargs); i++)
XPUSHs(SvREFCNT_inc(*av_fetch(initargs, i, FALSE)));
@@ -543,7 +543,7 @@ list(classname)
/* Truncate any unneeded slots in av */
av_fill(av, n - 1);
/* Finally, push all the new objects onto the stack and drop av */
- EXTEND(sp, n);
+ EXTEND(SP, n);
for (svp = AvARRAY(av); n > 0; n--, svp++)
PUSHs(*svp);
(void)sv_2mortal((SV*)av);
diff --git a/gv.c b/gv.c
index 128d790492..9948b126fd 100644
--- a/gv.c
+++ b/gv.c
@@ -1319,7 +1319,7 @@ amagic_call(SV *left, SV *right, int method, int flags)
PUTBACK;
pp_pushmark(ARGS);
- EXTEND(sp, notfound + 5);
+ EXTEND(SP, notfound + 5);
PUSHs(lr>0? right: left);
PUSHs(lr>0? left: right);
PUSHs( lr > 0 ? &sv_yes : ( assign ? &sv_undef : &sv_no ));
diff --git a/mg.c b/mg.c
index 4f5f06f77a..71cfa36329 100644
--- a/mg.c
+++ b/mg.c
@@ -959,8 +959,8 @@ magic_methcall(MAGIC *mg, char *meth, I32 flags, int n, SV *val)
{
dSP;
- PUSHMARK(sp);
- EXTEND(sp, n);
+ PUSHMARK(SP);
+ EXTEND(SP, n);
PUSHs(mg->mg_obj);
if (n > 1) {
if (mg->mg_ptr) {
@@ -1044,7 +1044,7 @@ int magic_wipepack(SV *sv, MAGIC *mg)
{
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
ENTER;
@@ -1061,8 +1061,8 @@ magic_nextpack(SV *sv, MAGIC *mg, SV *key)
ENTER;
SAVETMPS;
- PUSHMARK(sp);
- EXTEND(sp, 2);
+ PUSHMARK(SP);
+ EXTEND(SP, 2);
PUSHs(mg->mg_obj);
if (SvOK(key))
PUSHs(key);
@@ -1874,7 +1874,7 @@ sighandler(int sig)
sv = sv_newmortal();
sv_setpv(sv,sig_name[sig]);
}
- PUSHMARK(sp);
+ PUSHMARK(SP);
PUSHs(sv);
PUTBACK;
diff --git a/op.c b/op.c
index 11c17d7b9a..5666b04d22 100644
--- a/op.c
+++ b/op.c
@@ -1573,7 +1573,7 @@ newPROG(OP *o)
CV *cv = perl_get_cv("DB::postponed", FALSE);
if (cv) {
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs((SV*)compiling.cop_filegv);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
@@ -3466,7 +3466,7 @@ newSUB(I32 floor, OP *o, OP *proto, OP *block)
if (HvFILL(hv) > 0 && hv_exists(hv, SvPVX(tmpstr), SvCUR(tmpstr))
&& (cv = GvCV(db_postponed))) {
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(tmpstr);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
diff --git a/os2/OS2/REXX/REXX.xs b/os2/OS2/REXX/REXX.xs
index 43c92c8b46..14489f965d 100644
--- a/os2/OS2/REXX/REXX.xs
+++ b/os2/OS2/REXX/REXX.xs
@@ -133,7 +133,7 @@ PERLCALL(PSZ name, ULONG argc, PRXSTRING argv, PSZ queue, PRXSTRING ret)
ENTER;
SAVETMPS;
- PUSHMARK(sp);
+ PUSHMARK(SP);
#if 0
if (!my_perl) {
@@ -339,7 +339,7 @@ _fetch(name, ...)
{
int i;
ULONG rc;
- EXTEND(sp, items);
+ EXTEND(SP, items);
needvars(items);
if (trace)
fprintf(stderr, "REXXCALL::_fetch");
@@ -410,7 +410,7 @@ _next(stem)
rc = RexxVariablePool(&sv);
} while (!rc && memcmp(stem, sv.shvname.strptr, len) != 0);
if (!rc) {
- EXTEND(sp, 2);
+ EXTEND(SP, 2);
/* returned lengths appear to be swapped */
/* but beware of "future bug fixes" */
namelen = sv.shvname.strlength; /* should be */
diff --git a/perl.c b/perl.c
index 6d222cecae..90f641c94d 100644
--- a/perl.c
+++ b/perl.c
@@ -1092,7 +1092,7 @@ perl_call_argv(char *sub_name, I32 flags, register char **argv)
{
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
if (argv) {
while (*argv) {
XPUSHs(sv_2mortal(newSVpv(*argv,0)));
@@ -1132,9 +1132,8 @@ perl_call_sv(SV *sv, I32 flags)
/* See G_* flags in cop.h */
{
- dTHR;
+ dSP;
LOGOP myop; /* fake syntax tree node */
- SV** sp = stack_sp;
I32 oldmark;
I32 retval;
I32 oldscope;
@@ -1276,10 +1275,9 @@ perl_eval_sv(SV *sv, I32 flags)
/* See G_* flags in cop.h */
{
- dTHR;
+ dSP;
UNOP myop; /* fake syntax tree node */
- SV** sp = stack_sp;
- I32 oldmark = sp - stack_base;
+ I32 oldmark = SP - stack_base;
I32 retval;
I32 oldscope;
dJMPENV;
@@ -1366,7 +1364,7 @@ perl_eval_pv(char *p, I32 croak_on_error)
dSP;
SV* sv = newSVpv(p, 0);
- PUSHMARK(sp);
+ PUSHMARK(SP);
perl_eval_sv(sv, G_SCALAR);
SvREFCNT_dec(sv);
diff --git a/pod/perlcall.pod b/pod/perlcall.pod
index f90e09f238..ae1030c8d3 100644
--- a/pod/perlcall.pod
+++ b/pod/perlcall.pod
@@ -404,7 +404,7 @@ via this XSUB
void
Call_fred()
CODE:
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_pv("fred", G_DISCARD|G_NOARGS) ;
fprintf(stderr, "back in Call_fred\n") ;
@@ -421,7 +421,7 @@ higher, or use the G_EVAL flag with I<perl_call_*> as shown below
void
Call_fred()
CODE:
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_pv("fred", G_EVAL|G_DISCARD|G_NOARGS) ;
fprintf(stderr, "back in Call_fred\n") ;
@@ -462,7 +462,7 @@ and here is a C function to call it
{
dSP ;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_pv("PrintUID", G_DISCARD|G_NOARGS) ;
}
@@ -474,7 +474,7 @@ A few points to note about this example.
=item 1.
-Ignore C<dSP> and C<PUSHMARK(sp)> for now. They will be discussed in
+Ignore C<dSP> and C<PUSHMARK(SP)> for now. They will be discussed in
the next example.
=item 2.
@@ -526,7 +526,7 @@ The C function required to call I<LeftString> would look like this.
{
dSP ;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSVpv(a, 0)));
XPUSHs(sv_2mortal(newSViv(b)));
PUTBACK ;
@@ -542,8 +542,9 @@ Here are a few notes on the C function I<call_LeftString>.
Parameters are passed to the Perl subroutine using the Perl stack.
This is the purpose of the code beginning with the line C<dSP> and
-ending with the line C<PUTBACK>.
-
+ending with the line C<PUTBACK>. The <dSP> declares a local copy
+of the stack pointer. This local copy should B<always> be accessed
+as C<SP>.
=item 2.
@@ -630,7 +631,7 @@ function required to call it is now a bit more complex.
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSViv(a)));
XPUSHs(sv_2mortal(newSViv(b)));
PUTBACK ;
@@ -766,7 +767,7 @@ and this is the C function
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSViv(a)));
XPUSHs(sv_2mortal(newSViv(b)));
PUTBACK ;
@@ -829,7 +830,7 @@ context, like this
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSViv(a)));
XPUSHs(sv_2mortal(newSViv(b)));
PUTBACK ;
@@ -897,7 +898,7 @@ and here is a C function to call it.
sva = sv_2mortal(newSViv(a)) ;
svb = sv_2mortal(newSViv(b)) ;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sva);
XPUSHs(svb);
PUTBACK ;
@@ -954,7 +955,7 @@ and some C to call it
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSViv(a)));
XPUSHs(sv_2mortal(newSViv(b)));
PUTBACK ;
@@ -1087,7 +1088,7 @@ Here is a snippet of XSUB which defines I<CallSubPV>.
CallSubPV(name)
char * name
CODE:
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_pv(name, G_DISCARD|G_NOARGS) ;
That is fine as far as it goes. The thing is, the Perl subroutine
@@ -1103,7 +1104,7 @@ I<perl_call_sv> instead of I<perl_call_pv>.
CallSubSV(name)
SV * name
CODE:
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_sv(name, G_DISCARD|G_NOARGS) ;
Because we are using an SV to call I<fred> the following can all be used
@@ -1133,7 +1134,7 @@ pointer to the SV. Say the code above had been like this
void
CallSavedSub1()
CODE:
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_sv(rememberSub, G_DISCARD|G_NOARGS) ;
The reason this is wrong is that by the time you come to use the
@@ -1209,7 +1210,7 @@ SV. The code below shows C<SaveSub2> modified to do that
void
CallSavedSub2()
CODE:
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
perl_call_sv(keepSub, G_DISCARD|G_NOARGS) ;
To avoid creating a new SV every time C<SaveSub2> is called,
@@ -1318,7 +1319,7 @@ the C<PrintID> and C<Display> methods from C.
char * method
int index
CODE:
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(ref);
XPUSHs(sv_2mortal(newSViv(index))) ;
PUTBACK;
@@ -1330,7 +1331,7 @@ the C<PrintID> and C<Display> methods from C.
char * class
char * method
CODE:
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(sv_2mortal(newSVpv(class, 0))) ;
PUTBACK;
@@ -1522,7 +1523,7 @@ Now change that to call a Perl subroutine instead
{
dSP ;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
/* Call the Perl sub to process the callback */
perl_call_sv(callback, G_DISCARD) ;
@@ -1625,7 +1626,7 @@ and C<asynch_read_if> could look like this
if (sv == (SV**)NULL)
croak("Internal error...\n") ;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSViv(fh))) ;
XPUSHs(sv_2mortal(newSVpv(buffer, 0))) ;
PUTBACK ;
@@ -1709,7 +1710,7 @@ series of C functions to act as the interface to Perl, thus
{
dSP ;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSVpv(buffer, 0))) ;
PUTBACK ;
@@ -1863,7 +1864,7 @@ of values> recoded to use C<ST> instead of C<POP*>.
ENTER ;
SAVETMPS;
- PUSHMARK(sp) ;
+ PUSHMARK(SP) ;
XPUSHs(sv_2mortal(newSViv(a)));
XPUSHs(sv_2mortal(newSViv(b)));
PUTBACK ;
@@ -1871,8 +1872,8 @@ of values> recoded to use C<ST> instead of C<POP*>.
count = perl_call_pv("AddSubtract", G_ARRAY);
SPAGAIN ;
- sp -= count ;
- ax = (sp - stack_base) + 1 ;
+ SP -= count ;
+ ax = (SP - stack_base) + 1 ;
if (count != 2)
croak("Big trouble\n") ;
@@ -1901,8 +1902,8 @@ you.
The code
SPAGAIN ;
- sp -= count ;
- ax = (sp - stack_base) + 1 ;
+ SP -= count ;
+ ax = (SP - stack_base) + 1 ;
sets the stack up so that we can use the C<ST> macro.
diff --git a/pod/perlembed.pod b/pod/perlembed.pod
index e7164b58f9..32096789ec 100644
--- a/pod/perlembed.pod
+++ b/pod/perlembed.pod
@@ -370,7 +370,7 @@ been wrapped here):
dSP;
SV* retval;
- PUSHMARK(sp);
+ PUSHMARK(SP);
perl_eval_sv(sv, G_SCALAR);
SPAGAIN;
@@ -563,7 +563,7 @@ deep breath...
dSP; /* initialize stack pointer */
ENTER; /* everything created after here */
SAVETMPS; /* ...is a temporary variable. */
- PUSHMARK(sp); /* remember the stack pointer */
+ PUSHMARK(SP); /* remember the stack pointer */
XPUSHs(sv_2mortal(newSViv(a))); /* push the base onto the stack */
XPUSHs(sv_2mortal(newSViv(b))); /* push the exponent onto stack */
PUTBACK; /* make local stack pointer global */
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 0fa74458a7..c6ba0115e2 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -1088,10 +1088,10 @@ two, the local time zone's standard and summer time abbreviations.
To handle this situation, the PPCODE directive is used and the stack is
extended using the macro:
- EXTEND(sp, num);
+ EXTEND(SP, num);
-where C<sp> is the stack pointer, and C<num> is the number of elements the
-stack should be extended by.
+where C<SP> is the macro that represents the local copy of the stack pointer,
+and C<num> is the number of elements the stack should be extended by.
Now that there is room on the stack, values can be pushed on it using the
macros to push IVs, doubles, strings, and SV pointers respectively:
@@ -1144,6 +1144,7 @@ must manipulate the Perl stack. These include the following macros and
functions:
dSP
+ SP
PUSHMARK()
PUTBACK
SPAGAIN
@@ -1575,7 +1576,8 @@ The C variable which corresponds to Perl's $^W warning variable.
=item dSP
-Declares a stack pointer variable, C<sp>, for the XSUB. See C<SP>.
+Declares a local copy of perl's stack pointer for the XSUB, available via
+the C<SP> macro. See C<SP>.
=item dXSARGS
diff --git a/pod/perlxs.pod b/pod/perlxs.pod
index 07abd10564..d065b94425 100644
--- a/pod/perlxs.pod
+++ b/pod/perlxs.pod
@@ -558,7 +558,7 @@ Perl as a single list.
bool_t status;
PPCODE:
status = rpcb_gettime( host, &timep );
- EXTEND(sp, 2);
+ EXTEND(SP, 2);
PUSHs(sv_2mortal(newSViv(status)));
PUSHs(sv_2mortal(newSViv(timep)));
@@ -573,7 +573,7 @@ directive.
The EXTEND() macro is used to make room on the argument
stack for 2 return values. The PPCODE: directive causes the
-B<xsubpp> compiler to create a stack pointer called C<sp>, and it
+B<xsubpp> compiler to create a stack pointer available as C<SP>, and it
is this pointer which is being used in the EXTEND() macro.
The values are then pushed onto the stack with the PUSHs()
macro.
diff --git a/pp.c b/pp.c
index ac297eefa6..4a94b372bc 100644
--- a/pp.c
+++ b/pp.c
@@ -2216,7 +2216,7 @@ PP(pp_aslice)
if (SvTYPE(av) == SVt_PVAV) {
if (lval && op->op_private & OPpLVAL_INTRO) {
I32 max = -1;
- for (svp = mark + 1; svp <= sp; svp++) {
+ for (svp = MARK + 1; svp <= SP; svp++) {
elem = SvIVx(*svp);
if (elem > max)
max = elem;
@@ -2858,7 +2858,7 @@ PP(pp_unpack)
{
djSP;
dPOPPOPssrl;
- SV **oldsp = sp;
+ SV **oldsp = SP;
I32 gimme = GIMME_V;
SV *sv;
STRLEN llen;
@@ -3542,7 +3542,7 @@ PP(pp_unpack)
checksum = 0;
}
}
- if (sp == oldsp && gimme == G_SCALAR)
+ if (SP == oldsp && gimme == G_SCALAR)
PUSHs(&sv_undef);
RETURN;
}
@@ -4436,7 +4436,7 @@ PP(pp_threadsv)
{
djSP;
#ifdef USE_THREADS
- EXTEND(sp, 1);
+ EXTEND(SP, 1);
if (op->op_private & OPpLVAL_INTRO)
PUSHs(*save_threadsv(op->op_targ));
else
diff --git a/pp_ctl.c b/pp_ctl.c
index 1cda481dbf..8ed3bfbcff 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -535,7 +535,7 @@ PP(pp_grepstart)
djSP;
SV *src;
- if (stack_base + *markstack_ptr == sp) {
+ if (stack_base + *markstack_ptr == SP) {
(void)POPMARK;
if (GIMME_V == G_SCALAR)
XPUSHs(&sv_no);
@@ -574,7 +574,7 @@ PP(pp_mapstart)
PP(pp_mapwhile)
{
djSP;
- I32 diff = (sp - stack_base) - *markstack_ptr;
+ I32 diff = (SP - stack_base) - *markstack_ptr;
I32 count;
I32 shift;
SV** src;
@@ -584,11 +584,11 @@ PP(pp_mapwhile)
if (diff) {
if (diff > markstack_ptr[-1] - markstack_ptr[-2]) {
shift = diff - (markstack_ptr[-1] - markstack_ptr[-2]);
- count = (sp - stack_base) - markstack_ptr[-1] + 2;
+ count = (SP - stack_base) - markstack_ptr[-1] + 2;
- EXTEND(sp,shift);
- src = sp;
- dst = (sp += shift);
+ EXTEND(SP,shift);
+ src = SP;
+ dst = (SP += shift);
markstack_ptr[-1] += shift;
*markstack_ptr += shift;
while (--count)
@@ -791,7 +791,7 @@ PP(pp_flip)
}
else {
sv_setiv(targ, 0);
- sp--;
+ SP--;
RETURNOP(((CONDOP*)cUNOP->op_first)->op_false);
}
}
@@ -1285,7 +1285,7 @@ PP(pp_dbstate)
if (op->op_private || SvIV(DBsingle) || SvIV(DBsignal) || SvIV(DBtrace))
{
- SV **sp;
+ djSP;
register CV *cv;
register PERL_CONTEXT *cx;
I32 gimme = G_ARRAY;
@@ -1307,10 +1307,10 @@ PP(pp_dbstate)
SAVESTACK_POS();
debug = 0;
hasargs = 0;
- sp = stack_sp;
+ SPAGAIN;
push_return(op->op_next);
- PUSHBLOCK(cx, CXt_SUB, sp);
+ PUSHBLOCK(cx, CXt_SUB, SP);
PUSHSUB(cx);
CvDEPTH(cv)++;
(void)SvREFCNT_inc(cv);
@@ -1360,7 +1360,7 @@ PP(pp_enteriter)
cx->blk_loop.iterary = (AV*)SvREFCNT_inc(POPs);
else {
cx->blk_loop.iterary = curstack;
- AvFILLp(curstack) = sp - stack_base;
+ AvFILLp(curstack) = SP - stack_base;
cx->blk_loop.iterix = MARK - stack_base;
}
@@ -1752,15 +1752,15 @@ PP(pp_goto)
if (CvXSUB(cv)) {
if (CvOLDSTYLE(cv)) {
I32 (*fp3)_((int,int,int));
- while (sp > mark) {
- sp[1] = sp[0];
- sp--;
+ while (SP > mark) {
+ SP[1] = SP[0];
+ SP--;
}
fp3 = (I32(*)_((int,int,int)))CvXSUB(cv);
items = (*fp3)(CvXSUBANY(cv).any_i32,
mark - stack_base + 1,
items);
- sp = stack_base + items;
+ SP = stack_base + items;
}
else {
stack_sp--; /* There is no cv arg. */
@@ -1834,9 +1834,9 @@ PP(pp_goto)
items = AvFILLp(av) + 1;
if (items) {
/* Mark is at the end of the stack. */
- EXTEND(sp, items);
- Copy(AvARRAY(av), sp + 1, items, SV*);
- sp += items;
+ EXTEND(SP, items);
+ Copy(AvARRAY(av), SP + 1, items, SV*);
+ SP += items;
PUTBACK ;
}
}
@@ -2337,7 +2337,7 @@ doeval(int gimme, OP** startop)
CV *cv = perl_get_cv("DB::postponed", FALSE);
if (cv) {
dSP;
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs((SV*)compiling.cop_filegv);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
@@ -2650,7 +2650,7 @@ PP(pp_leaveeval)
lex_end();
if (optype == OP_REQUIRE &&
- !(gimme == G_SCALAR ? SvTRUE(*sp) : sp > newsp))
+ !(gimme == G_SCALAR ? SvTRUE(*SP) : SP > newsp))
{
/* Unassume the success we assumed earlier. */
char *name = cx->blk_eval.old_name;
diff --git a/pp_hot.c b/pp_hot.c
index 4529f8e8bc..7ff4cab9f0 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -65,7 +65,7 @@ PP(pp_nextstate)
PP(pp_gvsv)
{
djSP;
- EXTEND(sp,1);
+ EXTEND(SP,1);
if (op->op_private & OPpLVAL_INTRO)
PUSHs(save_scalar(cGVOP->op_gv));
else
@@ -1265,7 +1265,7 @@ PP(pp_enter)
ENTER;
SAVETMPS;
- PUSHBLOCK(cx, CXt_BLOCK, sp);
+ PUSHBLOCK(cx, CXt_BLOCK, SP);
RETURN;
}
@@ -1382,7 +1382,7 @@ PP(pp_iter)
SV* sv;
AV* av;
- EXTEND(sp, 1);
+ EXTEND(SP, 1);
cx = &cxstack[cxstack_ix];
if (cx->cx_type != CXt_LOOP)
DIE("panic: pp_iter");
@@ -1714,7 +1714,7 @@ PP(pp_grepwhile)
LEAVE; /* exit inner scope */
/* All done yet? */
- if (stack_base + *markstack_ptr > sp) {
+ if (stack_base + *markstack_ptr > SP) {
I32 items;
I32 gimme = GIMME_V;
@@ -2038,9 +2038,9 @@ PP(pp_entersub)
dMARK;
register I32 items = SP - MARK;
/* We dont worry to copy from @_. */
- while (sp > mark) {
- sp[1] = sp[0];
- sp--;
+ while (SP > mark) {
+ SP[1] = SP[0];
+ SP--;
}
stack_sp = mark + 1;
fp3 = (I32(*)_((int,int,int)))CvXSUB(cv);
@@ -2069,9 +2069,9 @@ PP(pp_entersub)
if (items) {
/* Mark is at the end of the stack. */
- EXTEND(sp, items);
- Copy(AvARRAY(av), sp + 1, items, SV*);
- sp += items;
+ EXTEND(SP, items);
+ Copy(AvARRAY(av), SP + 1, items, SV*);
+ SP += items;
PUTBACK ;
}
}
@@ -2157,9 +2157,9 @@ PP(pp_entersub)
items = AvFILLp(av) + 1;
if (items) {
/* Mark is at the end of the stack. */
- EXTEND(sp, items);
- Copy(AvARRAY(av), sp + 1, items, SV*);
- sp += items;
+ EXTEND(SP, items);
+ Copy(AvARRAY(av), SP + 1, items, SV*);
+ SP += items;
PUTBACK ;
}
}
diff --git a/pp_sys.c b/pp_sys.c
index 8058fb2656..ccb64ab47f 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -648,9 +648,9 @@ PP(pp_dbmopen)
}
ENTER;
- PUSHMARK(sp);
+ PUSHMARK(SP);
- EXTEND(sp, 5);
+ EXTEND(SP, 5);
PUSHs(sv);
PUSHs(left);
if (SvIV(right))
@@ -663,8 +663,8 @@ PP(pp_dbmopen)
SPAGAIN;
if (!sv_isobject(TOPs)) {
- sp--;
- PUSHMARK(sp);
+ SP--;
+ PUSHMARK(SP);
PUSHs(sv);
PUSHs(left);
PUSHs(sv_2mortal(newSViv(O_RDONLY)));
@@ -3978,7 +3978,7 @@ PP(pp_ehostent)
djSP;
#ifdef HAS_ENDHOSTENT
endhostent();
- EXTEND(sp,1);
+ EXTEND(SP,1);
RETPUSHYES;
#else
DIE(no_sock_func, "endhostent");
@@ -3990,7 +3990,7 @@ PP(pp_enetent)
djSP;
#ifdef HAS_ENDNETENT
endnetent();
- EXTEND(sp,1);
+ EXTEND(SP,1);
RETPUSHYES;
#else
DIE(no_sock_func, "endnetent");
@@ -4002,7 +4002,7 @@ PP(pp_eprotoent)
djSP;
#ifdef HAS_ENDPROTOENT
endprotoent();
- EXTEND(sp,1);
+ EXTEND(SP,1);
RETPUSHYES;
#else
DIE(no_sock_func, "endprotoent");
@@ -4014,7 +4014,7 @@ PP(pp_eservent)
djSP;
#ifdef HAS_ENDSERVENT
endservent();
- EXTEND(sp,1);
+ EXTEND(SP,1);
RETPUSHYES;
#else
DIE(no_sock_func, "endservent");
diff --git a/util.c b/util.c
index 6cb8e6930b..e27f8c8290 100644
--- a/util.c
+++ b/util.c
@@ -1311,7 +1311,7 @@ die(pat, va_alist)
SvREADONLY_on(msg);
SAVEFREESV(msg);
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
@@ -1376,7 +1376,7 @@ croak(pat, va_alist)
SvREADONLY_on(msg);
SAVEFREESV(msg);
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);
@@ -1435,7 +1435,7 @@ warn(pat,va_alist)
SvREADONLY_on(msg);
SAVEFREESV(msg);
- PUSHMARK(sp);
+ PUSHMARK(SP);
XPUSHs(msg);
PUTBACK;
perl_call_sv((SV*)cv, G_DISCARD);