diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-05 22:59:28 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-05 22:59:28 +0000 |
commit | aecf8a963dc0ba60468bff09784efd1c2ca5518c (patch) | |
tree | 924acdf60cfc891cd65677129239a5efac41e459 | |
parent | f2b0cce78405182ac37776a9f6651ef31c276b8f (diff) | |
parent | ce3e5b80724e7725765c5559e5f4b0058876fc19 (diff) | |
download | perl-aecf8a963dc0ba60468bff09784efd1c2ca5518c.tar.gz |
Integrate perlio:
[ 8001]
Win32 PERL_IMPLICIT_SYS passes all tests with USE_PERLIO
- calloc/free suffer from damage on TerminateThread()
- use PerlMemShared (as originally planned) now fixed
- avoid doing anything important on DLL "detach".
[ 8000]
Fix gross PerlMemShared issue.
p4raw-link: @8001 on //depot/perlio: ce3e5b80724e7725765c5559e5f4b0058876fc19
p4raw-link: @8000 on //depot/perlio: 0a77e2d7f7c1b1af440a8cf545295905853ca727
p4raw-id: //depot/perl@8002
-rw-r--r-- | iperlsys.h | 28 | ||||
-rw-r--r-- | perl.c | 10 | ||||
-rw-r--r-- | perlio.c | 6 | ||||
-rw-r--r-- | win32/perllib.c | 9 |
4 files changed, 28 insertions, 25 deletions
diff --git a/iperlsys.h b/iperlsys.h index 66d2b8ebb0..fe03f5c53b 100644 --- a/iperlsys.h +++ b/iperlsys.h @@ -781,36 +781,36 @@ struct IPerlMemInfo /* Shared memory macros */ #define PerlMemShared_malloc(size) \ - (*PL_MemShared->pMalloc)(PL_Mem, (size)) + (*PL_MemShared->pMalloc)(PL_MemShared, (size)) #define PerlMemShared_realloc(buf, size) \ - (*PL_MemShared->pRealloc)(PL_Mem, (buf), (size)) + (*PL_MemShared->pRealloc)(PL_MemShared, (buf), (size)) #define PerlMemShared_free(buf) \ - (*PL_MemShared->pFree)(PL_Mem, (buf)) + (*PL_MemShared->pFree)(PL_MemShared, (buf)) #define PerlMemShared_calloc(num, size) \ - (*PL_MemShared->pCalloc)(PL_Mem, (num), (size)) + (*PL_MemShared->pCalloc)(PL_MemShared, (num), (size)) #define PerlMemShared_get_lock() \ - (*PL_MemShared->pGetLock)(PL_Mem) + (*PL_MemShared->pGetLock)(PL_MemShared) #define PerlMemShared_free_lock() \ - (*PL_MemShared->pFreeLock)(PL_Mem) + (*PL_MemShared->pFreeLock)(PL_MemShared) #define PerlMemShared_is_locked() \ - (*PL_MemShared->pIsLocked)(PL_Mem) + (*PL_MemShared->pIsLocked)(PL_MemShared) /* Parse tree memory macros */ #define PerlMemParse_malloc(size) \ - (*PL_MemParse->pMalloc)(PL_Mem, (size)) + (*PL_MemParse->pMalloc)(PL_MemParse, (size)) #define PerlMemParse_realloc(buf, size) \ - (*PL_MemParse->pRealloc)(PL_Mem, (buf), (size)) + (*PL_MemParse->pRealloc)(PL_MemParse, (buf), (size)) #define PerlMemParse_free(buf) \ - (*PL_MemParse->pFree)(PL_Mem, (buf)) + (*PL_MemParse->pFree)(PL_MemParse, (buf)) #define PerlMemParse_calloc(num, size) \ - (*PL_MemParse->pCalloc)(PL_Mem, (num), (size)) + (*PL_MemParse->pCalloc)(PL_MemParse, (num), (size)) #define PerlMemParse_get_lock() \ - (*PL_MemParse->pGetLock)(PL_Mem) + (*PL_MemParse->pGetLock)(PL_MemParse) #define PerlMemParse_free_lock() \ - (*PL_MemParse->pFreeLock)(PL_Mem) + (*PL_MemParse->pFreeLock)(PL_MemParse) #define PerlMemParse_is_locked() \ - (*PL_MemParse->pIsLocked)(PL_Mem) + (*PL_MemParse->pIsLocked)(PL_MemParse) #else /* PERL_IMPLICIT_SYS */ @@ -785,12 +785,18 @@ perl_free(pTHXx) #if defined(PERL_OBJECT) PerlMem_free(this); #else -# if defined(PERL_IMPLICIT_SYS) && defined(WIN32) +# if defined(WIN32) +# if defined(PERL_IMPLICIT_SYS) void *host = w32_internal_host; - if (PerlProc_lasthost()) + if (PerlProc_lasthost()) { PerlIO_cleanup(); + } PerlMem_free(aTHXx); win32_delete_internal_host(host); +#else + PerlIO_cleanup(); + PerlMem_free(aTHXx); +#endif # else PerlMem_free(aTHXx); # endif @@ -28,12 +28,6 @@ #define PERL_IN_PERLIO_C #include "perl.h" -#undef PerlMemShared_calloc -#define PerlMemShared_calloc(x,y) calloc(x,y) -#undef PerlMemShared_free -#define PerlMemShared_free(x) free(x) - - #ifndef PERLIO_LAYERS int PerlIO_apply_layers(pTHX_ PerlIO *f, const char *mode, const char *names) diff --git a/win32/perllib.c b/win32/perllib.c index 1a9fa9f438..87b79c031d 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -370,9 +370,12 @@ DllMain(HANDLE hModule, /* DLL module handle */ * process termination or call to FreeLibrary. */ case DLL_PROCESS_DETACH: -#if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO) - PerlIO_cleanup(); -#endif + /* As long as we use TerminateProcess()/TerminateThread() etc. for mimicing kill() + anything here had better be harmless if: + A. Not called at all. + B. Called after memory allocation for Heap has been forcibly removed by OS. + PerlIO_cleanup() was done here but fails (B). + */ EndSockets(); #if defined(USE_THREADS) || defined(USE_ITHREADS) if (PL_curinterp) |