summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-11-25 20:52:17 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-11-25 20:52:17 +0000
commitc3564e5c35b594706ecb001261b86a47fb837059 (patch)
tree924db2bde875fbdf39afd6a16feea1b1c79b944a /scope.c
parentcf829ab07ccc67cf02ca41d6f870136b64d83833 (diff)
downloadperl-c3564e5c35b594706ecb001261b86a47fb837059.tar.gz
C<foreach my $x ...> in pseudo-fork()ed process may diddle
parent's memory; fix it by keeping track of the actual pad offset rather than a raw pointer (this change is probably also relevant to non-ithreads case to avoid fallout from reallocs of the pad array, but is currently only enabled for the ithreads case in the interests of minimal disruption to existing "well tested" code) p4raw-id: //depot/perl@7858
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/scope.c b/scope.c
index 7c904b433f..82cd748274 100644
--- a/scope.c
+++ b/scope.c
@@ -470,6 +470,17 @@ Perl_save_sptr(pTHX_ SV **sptr)
SSPUSHINT(SAVEt_SPTR);
}
+void
+Perl_save_padsv(pTHX_ PADOFFSET off)
+{
+ dTHR;
+ SSCHECK(4);
+ SSPUSHPTR(PL_curpad[off]);
+ SSPUSHPTR(PL_curpad);
+ SSPUSHLONG((long)off);
+ SSPUSHINT(SAVEt_PADSV);
+}
+
SV **
Perl_save_threadsv(pTHX_ PADOFFSET i)
{
@@ -961,6 +972,14 @@ Perl_leave_scope(pTHX_ I32 base)
else
PL_curpad = Null(SV**);
break;
+ case SAVEt_PADSV:
+ {
+ PADOFFSET off = (PADOFFSET)SSPOPLONG;
+ ptr = SSPOPPTR;
+ if (ptr)
+ ((SV**)ptr)[off] = (SV*)SSPOPPTR;
+ }
+ break;
default:
Perl_croak(aTHX_ "panic: leave_scope inconsistency");
}