=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/gc/include/gc.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -p -r1.4 -r1.5 --- OpenXM_contrib2/asir2000/gc/include/gc.h 2002/07/24 07:46:31 1.4 +++ OpenXM_contrib2/asir2000/gc/include/gc.h 2002/07/24 08:00:17 1.5 @@ -30,13 +30,9 @@ # define _GC_H -#if defined(_SOLARIS_PTHREADS) && !defined(SOLARIS_THREADS) -# define SOLARIS_THREADS -#endif - /* * Some tests for old macros. These violate our namespace rules and will - * disappear shortly. + * disappear shortly. Use the GC_ names. */ #if defined(SOLARIS_THREADS) || defined(_SOLARIS_THREADS) # define GC_SOLARIS_THREADS @@ -47,6 +43,11 @@ #if defined(IRIX_THREADS) # define GC_IRIX_THREADS #endif +#if defined(DGUX_THREADS) +# if !defined(GC_DGUX386_THREADS) +# define GC_DGUX386_THREADS +# endif +#endif #if defined(HPUX_THREADS) # define GC_HPUX_THREADS #endif @@ -72,6 +73,22 @@ /* depend on this were previously included. */ #endif +#if defined(GC_DGUX386_THREADS) && !defined(_POSIX4A_DRAFT10_SOURCE) +# define _POSIX4A_DRAFT10_SOURCE 1 +#endif + +#if defined(GC_SOLARIS_PTHREADS) && !defined(GC_SOLARIS_THREADS) +# define GC_SOLARIS_THREADS +#endif + +# if defined(GC_SOLARIS_PTHREADS) || defined(GC_FREEBSD_THREADS) || \ + defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \ + defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \ + defined(GC_DGUX386_THREADS) || \ + (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) +# define GC_PTHREADS +# endif + # define __GC # include # ifdef _WIN32_WCE @@ -80,11 +97,7 @@ typedef long ptrdiff_t; /* ptrdiff_t is not defined */ # endif -#if defined(__CYGWIN32__) && defined(GC_USE_DLL) -#include "libgc_globals.h" -#endif - -#if defined(__MINGW32__) && defined(WIN32_THREADS) +#if defined(__MINGW32__) && defined(_DLL) && !defined(GC_NOT_DLL) # ifdef GC_BUILD # define GC_API __declspec(dllexport) # else @@ -92,8 +105,9 @@ # endif #endif -#if defined(_MSC_VER) && (defined(_DLL) && !defined(NOT_GC_DLL) \ - || defined(GC_DLL)) +#if (defined(__DMC__) || defined(_MSC_VER)) \ + && (defined(_DLL) && !defined(GC_NOT_DLL) \ + || defined(GC_DLL)) # ifdef GC_BUILD # define GC_API extern __declspec(dllexport) # else @@ -151,7 +165,7 @@ GC_API int GC_parallel; /* GC is parallelized for perf /* Env variable GC_NPROC is set to > 1, or */ /* GC_NPROC is not set and this is an MP. */ /* If GC_parallel is set, incremental */ - /* collection is aonly partially functional, */ + /* collection is only partially functional, */ /* and may not be desirable. */ @@ -293,7 +307,29 @@ GC_API int GC_dont_precollect; /* Don't collect as pa /* Interferes with blacklisting. */ /* Wizards only. */ +GC_API unsigned long GC_time_limit; + /* If incremental collection is enabled, */ + /* We try to terminate collections */ + /* after this many milliseconds. Not a */ + /* hard time bound. Setting this to */ + /* GC_TIME_UNLIMITED will essentially */ + /* disable incremental collection while */ + /* leaving generational collection */ + /* enabled. */ +# define GC_TIME_UNLIMITED 999999 + /* Setting GC_time_limit to this value */ + /* will disable the "pause time exceeded"*/ + /* tests. */ + /* Public procedures */ + +/* Initialize the collector. This is only required when using thread-local + * allocation, since unlike the regular allocation routines, GC_local_malloc + * is not self-initializing. If you use GC_local_malloc you should arrange + * to call this somehow (e.g. from a constructor) before doing any allocation. + */ +GC_API void GC_init GC_PROTO((void)); + /* * general purpose allocation routines, with roughly malloc calling conv. * The atomic versions promise that no relevant pointers are contained @@ -347,6 +383,10 @@ GC_API void GC_end_stubborn_change GC_PROTO((GC_PTR)); /* Return a pointer to the base (lowest address) of an object given */ /* a pointer to a location within the object. */ +/* I.e. map an interior pointer to the corresponding bas pointer. */ +/* Note that with debugging allocation, this returns a pointer to the */ +/* actual base of the object, i.e. the debug information, not to */ +/* the base of the user object. */ /* Return 0 if displaced_pointer doesn't point to within a valid */ /* object. */ GC_API GC_PTR GC_base GC_PROTO((GC_PTR displaced_pointer)); @@ -445,9 +485,23 @@ GC_API size_t GC_get_total_bytes GC_PROTO((void)); /* Don't use in leak finding mode. */ /* Ignored if GC_dont_gc is true. */ /* Only the generational piece of this is */ -/* functional if GC_parallel is TRUE. */ +/* functional if GC_parallel is TRUE */ +/* or if GC_time_limit is GC_TIME_UNLIMITED. */ +/* Causes GC_local_gcj_malloc() to revert to */ +/* locked allocation. Must be called */ +/* before any GC_local_gcj_malloc() calls. */ GC_API void GC_enable_incremental GC_PROTO((void)); +/* Does incremental mode write-protect pages? Returns zero or */ +/* more of the following, or'ed together: */ +#define GC_PROTECTS_POINTER_HEAP 1 /* May protect non-atomic objs. */ +#define GC_PROTECTS_PTRFREE_HEAP 2 +#define GC_PROTECTS_STATIC_DATA 4 /* Curently never. */ +#define GC_PROTECTS_STACK 8 /* Probably impractical. */ + +#define GC_PROTECTS_NONE 0 +GC_API int GC_incremental_protection_needs GC_PROTO((void)); + /* Perform some garbage collection work, if appropriate. */ /* Return 0 if there is no more work to be done. */ /* Typically performs an amount of work corresponding roughly */ @@ -701,7 +755,7 @@ GC_API GC_warn_proc GC_set_warn_proc GC_PROTO((GC_warn /* Returns old warning procedure. */ /* The following is intended to be used by a higher level */ -/* (e.g. cedar-like) finalization facility. It is expected */ +/* (e.g. Java-like) finalization facility. It is expected */ /* that finalization code will arrange for hidden pointers to */ /* disappear. Otherwise objects can be accessed after they */ /* have been collected. */ @@ -814,16 +868,12 @@ GC_API void (*GC_is_visible_print_proc) /* thread library calls. We do that here by macro defining them. */ #if !defined(GC_USE_LD_WRAP) && \ - (defined(GC_LINUX_THREADS) || defined(GC_HPUX_THREADS) || \ - defined(GC_IRIX_THREADS) || defined(GC_SOLARIS_PTHREADS) || \ - defined(GC_SOLARIS_THREADS) || defined(GC_OSF1_THREADS)) + (defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS)) # include "gc_pthread_redirects.h" #endif # if defined(PCR) || defined(GC_SOLARIS_THREADS) || \ - defined(GC_SOLARIS_PTHREADS) || defined(GC_WIN32_THREADS) || \ - defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) || \ - defined(GC_HPUX_THREADS) + defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) /* Any flavor of threads except SRC_M3. */ /* This returns a list of objects, linked through their first */ /* word. Its use can greatly reduce lock contention problems, since */ @@ -838,10 +888,24 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 * #endif /* THREADS && !SRC_M3 */ -#if defined(WIN32_THREADS) && defined(_WIN32_WCE) +#if defined(GC_WIN32_THREADS) # include +# include /* + * All threads must be created using GC_CreateThread, so that they will be + * recorded in the thread table. For backwards compatibility, this is not + * technically true if the GC is built as a dynamic library, since it can + * and does then use DllMain to keep track of thread creations. But new code + * should be built to call GC_CreateThread. + */ + HANDLE WINAPI GC_CreateThread( + LPSECURITY_ATTRIBUTES lpThreadAttributes, + DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, + LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); + +# if defined(_WIN32_WCE) + /* * win32_threads.c implements the real WinMain, which will start a new thread * to call GC_WinMain after initializing the garbage collector. */ @@ -851,22 +915,14 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 * LPWSTR lpCmdLine, int nCmdShow ); - /* - * All threads must be created using GC_CreateThread, so that they will be - * recorded in the thread table. - */ - HANDLE WINAPI GC_CreateThread( - LPSECURITY_ATTRIBUTES lpThreadAttributes, - DWORD dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, - LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId ); +# ifndef GC_BUILD +# define WinMain GC_WinMain +# define CreateThread GC_CreateThread +# endif +# endif /* defined(_WIN32_WCE) */ -# ifndef GC_BUILD -# define WinMain GC_WinMain -# define CreateThread GC_CreateThread -# endif +#endif /* defined(GC_WIN32_THREADS) */ -#endif - /* * If you are planning on putting * the collector in a SunOS 5 dynamic library, you need to call GC_INIT() @@ -877,9 +933,10 @@ extern void GC_thr_init(); /* Needed for Solaris/X86 * # define GC_INIT() { extern end, etext; \ GC_noop(&end, &etext); } #else -# if defined(__CYGWIN32__) && defined(GC_USE_DLL) +# if defined(__CYGWIN32__) && defined(GC_USE_DLL) || defined (_AIX) /* - * Similarly gnu-win32 DLLs need explicit initialization + * Similarly gnu-win32 DLLs need explicit initialization from + * the main program, as does AIX. */ # define GC_INIT() { GC_add_roots(DATASTART, DATAEND); } # else