summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-01-14 22:02:49 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-01-14 22:02:49 +0000
commit05ec9bb346c404c8906ed1ac374d4bce61c84f5d (patch)
treec0c3deb21e984b2371d1058155b645467055217d /sv.c
parente567eb179f8c37fa2e2a16e90180982901849683 (diff)
downloadperl-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 'sv.c')
-rw-r--r--sv.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/sv.c b/sv.c
index 3de686f40e..0cd86d6e39 100644
--- a/sv.c
+++ b/sv.c
@@ -9361,8 +9361,9 @@ Perl_any_dup(pTHX_ void *v, PerlInterpreter *proto_perl)
/* see if it is part of the interpreter structure */
if (v >= (void*)proto_perl && v < (void*)(proto_perl+1))
ret = (void*)(((char*)aTHX) + (((char*)v) - (char*)proto_perl));
- else
+ else {
ret = v;
+ }
return ret;
}
@@ -9415,6 +9416,12 @@ Perl_ss_dup(pTHX_ PerlInterpreter *proto_perl, CLONE_PARAMS* param)
ptr = POPPTR(ss,ix);
TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
break;
+ case SAVEt_SHARED_PVREF: /* char* in shared space */
+ c = (char*)POPPTR(ss,ix);
+ TOPPTR(nss,ix) = savesharedpv(c);
+ ptr = POPPTR(ss,ix);
+ TOPPTR(nss,ix) = any_dup(ptr, proto_perl);
+ break;
case SAVEt_GENERIC_SVREF: /* generic sv */
case SAVEt_SVREF: /* scalar reference */
sv = (SV*)POPPTR(ss,ix);
@@ -9784,15 +9791,21 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
SvNVX(&PL_sv_yes) = 1;
ptr_table_store(PL_ptr_table, &proto_perl->Isv_yes, &PL_sv_yes);
- /* create shared string table */
+ /* create (a non-shared!) shared string table */
PL_strtab = newHV();
HvSHAREKEYS_off(PL_strtab);
hv_ksplit(PL_strtab, 512);
ptr_table_store(PL_ptr_table, proto_perl->Istrtab, PL_strtab);
- PL_compiling = proto_perl->Icompiling;
- PL_compiling.cop_stashpv = SAVEPV(PL_compiling.cop_stashpv);
- PL_compiling.cop_file = SAVEPV(PL_compiling.cop_file);
+ PL_compiling = proto_perl->Icompiling;
+
+ /* These two PVs will be free'd special way so must set them same way op.c does */
+ PL_compiling.cop_stashpv = savesharedpv(PL_compiling.cop_stashpv);
+ ptr_table_store(PL_ptr_table, proto_perl->Icompiling.cop_stashpv, PL_compiling.cop_stashpv);
+
+ PL_compiling.cop_file = savesharedpv(PL_compiling.cop_file);
+ ptr_table_store(PL_ptr_table, proto_perl->Icompiling.cop_file, PL_compiling.cop_file);
+
ptr_table_store(PL_ptr_table, &proto_perl->Icompiling, &PL_compiling);
if (!specialWARN(PL_compiling.cop_warnings))
PL_compiling.cop_warnings = sv_dup_inc(PL_compiling.cop_warnings, param);