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 /op.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 'op.c')
-rw-r--r-- | op.c | 32 |
1 files changed, 13 insertions, 19 deletions
@@ -878,11 +878,7 @@ clear_pmop: pmop = pmop->op_pmnext; } } -#ifdef USE_ITHREADS - Safefree(PmopSTASHPV(cPMOPo)); -#else - /* NOTE: PMOP.op_pmstash is not refcounted */ -#endif + PmopSTASH_free(cPMOPo); } cPMOPo->op_pmreplroot = Nullop; /* we use the "SAFE" version of the PM_ macros here @@ -913,18 +909,20 @@ clear_pmop: STATIC void S_cop_free(pTHX_ COP* cop) { - Safefree(cop->cop_label); -#ifdef USE_ITHREADS - Safefree(CopFILE(cop)); /* XXX share in a pvtable? */ - Safefree(CopSTASHPV(cop)); /* XXX share in a pvtable? */ -#else - /* NOTE: COP.cop_stash is not refcounted */ - SvREFCNT_dec(CopFILEGV(cop)); -#endif + Safefree(cop->cop_label); /* FIXME: treaddead ??? */ + CopFILE_free(cop); + CopSTASH_free(cop); if (! specialWARN(cop->cop_warnings)) SvREFCNT_dec(cop->cop_warnings); - if (! specialCopIO(cop->cop_io)) + if (! specialCopIO(cop->cop_io)) { +#ifdef USE_ITHREADS + STRLEN len; + char *s = SvPV(cop->cop_io,len); + Perl_warn(aTHX_ "io='%.*s'",(int) len,s); +#else SvREFCNT_dec(cop->cop_io); +#endif + } } void @@ -5171,11 +5169,7 @@ Perl_newCONSTSUB(pTHX_ HV *stash, char *name, SV *sv) SAVESPTR(PL_curstash); SAVECOPSTASH(PL_curcop); PL_curstash = stash; -#ifdef USE_ITHREADS - CopSTASHPV(PL_curcop) = stash ? HvNAME(stash) : Nullch; -#else - CopSTASH(PL_curcop) = stash; -#endif + CopSTASH_set(PL_curcop,stash); } cv = newXS(name, const_sv_xsub, __FILE__); |