summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-04-03 06:59:37 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-04-03 06:59:37 +0000
commite336de0d01f30cc4061b6d6a00d11df30fc67cd3 (patch)
tree47af4eae88807f461d216a10701a0502a2373226 /av.c
parentdfb1c8b93631b1cf8c1d0d2295ffff2bf0f098a7 (diff)
downloadperl-e336de0d01f30cc4061b6d6a00d11df30fc67cd3.tar.gz
[win32] implement stack-of-stacks so that magic invocations don't
invalidate local stack pointer p4raw-id: //depot/win32/perl@864
Diffstat (limited to 'av.c')
-rw-r--r--av.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/av.c b/av.c
index f4a9883442..daba15b148 100644
--- a/av.c
+++ b/av.c
@@ -53,12 +53,14 @@ av_extend(AV *av, I32 key)
dSP;
ENTER;
SAVETMPS;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(sv_2mortal(newSViv(key+1)));
PUTBACK;
perl_call_method("EXTEND", G_SCALAR|G_DISCARD);
+ POPSTACK();
FREETMPS;
LEAVE;
return;
@@ -388,6 +390,7 @@ av_push(register AV *av, SV *val)
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
PUSHs(mg->mg_obj);
@@ -396,6 +399,7 @@ av_push(register AV *av, SV *val)
ENTER;
perl_call_method("PUSH", G_SCALAR|G_DISCARD);
LEAVE;
+ POPSTACK();
return;
}
av_store(av,AvFILLp(av)+1,val);
@@ -413,6 +417,7 @@ av_pop(register AV *av)
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
@@ -423,6 +428,7 @@ av_pop(register AV *av)
retval = &sv_undef;
}
LEAVE;
+ POPSTACK();
return retval;
}
retval = AvARRAY(av)[AvFILLp(av)];
@@ -446,6 +452,7 @@ av_unshift(register AV *av, register I32 num)
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,1+num);
PUSHs(mg->mg_obj);
@@ -456,6 +463,7 @@ av_unshift(register AV *av, register I32 num)
ENTER;
perl_call_method("UNSHIFT", G_SCALAR|G_DISCARD);
LEAVE;
+ POPSTACK();
return;
}
@@ -495,6 +503,7 @@ av_shift(register AV *av)
croak(no_modify);
if (SvRMAGICAL(av) && (mg = mg_find((SV*)av,'P'))) {
dSP;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
XPUSHs(mg->mg_obj);
PUTBACK;
@@ -505,6 +514,7 @@ av_shift(register AV *av)
retval = &sv_undef;
}
LEAVE;
+ POPSTACK();
return retval;
}
retval = *AvARRAY(av);
@@ -536,12 +546,14 @@ av_fill(register AV *av, I32 fill)
dSP;
ENTER;
SAVETMPS;
+ PUSHSTACK(SI_MAGIC);
PUSHMARK(SP);
EXTEND(SP,2);
PUSHs(mg->mg_obj);
PUSHs(sv_2mortal(newSViv(fill+1)));
PUTBACK;
perl_call_method("STORESIZE", G_SCALAR|G_DISCARD);
+ POPSTACK();
FREETMPS;
LEAVE;
return;