diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-01-14 22:02:49 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-01-14 22:02:49 +0000 |
commit | 05ec9bb346c404c8906ed1ac374d4bce61c84f5d (patch) | |
tree | c0c3deb21e984b2371d1058155b645467055217d /scope.c | |
parent | e567eb179f8c37fa2e2a16e90180982901849683 (diff) | |
download | perl-05ec9bb346c404c8906ed1ac374d4bce61c84f5d.tar.gz |
Use PerlMemShared for CopSTASHPV and CopFILE. MUCH harder than it sounds!
Need to use CopXXXXX macros everywhere and add CopSTASH_free
Add new scope type and add support for it to scope.c and scope stack
dup-er in sv.c. Add savesharedpv().
Also zealous version of Win32's vmem.h to catch all the abuses.
With this t/op/fork.t passes even with zealous checking and
checker is point a finger at various threads/shared issues.
PL_curcop->cop_io is still an issue.
p4raw-id: //depot/perlio@14259
Diffstat (limited to 'scope.c')
-rw-r--r-- | scope.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -254,6 +254,18 @@ Perl_save_generic_pvref(pTHX_ char **str) SSPUSHINT(SAVEt_GENERIC_PVREF); } +/* Like save_generic_pvref(), but uses PerlMemShared_free() rather than Safefree(). + * Can be used to restore a shared global char* to its prior + * contents, freeing new value. */ +void +Perl_save_shared_pvref(pTHX_ char **str) +{ + SSCHECK(3); + SSPUSHPTR(str); + SSPUSHPTR(*str); + SSPUSHINT(SAVEt_SHARED_PVREF); +} + void Perl_save_gp(pTHX_ GV *gv, I32 empty) { @@ -657,6 +669,14 @@ Perl_leave_scope(pTHX_ I32 base) *(char**)ptr = str; } break; + case SAVEt_SHARED_PVREF: /* shared pv */ + str = (char*)SSPOPPTR; + ptr = SSPOPPTR; + if (*(char**)ptr != str) { + PerlMemShared_free(*(char**)ptr); + *(char**)ptr = str; + } + break; case SAVEt_GENERIC_SVREF: /* generic sv */ value = (SV*)SSPOPPTR; ptr = SSPOPPTR; |