diff --git a/boehm-gc/ChangeLog b/boehm-gc/ChangeLog index 204d4c924a7..c132c031cf3 100644 --- a/boehm-gc/ChangeLog +++ b/boehm-gc/ChangeLog @@ -1,3 +1,14 @@ +2002-03-12 Adam Megacz + + * dyn_load.c: Renamed GC_win32s to GC_no_win32_dlls. + * misc.c: Renamed GC_is_win32s() to GC_no_win32_dlls + * os_dep.c: Renamed GC_win32s to GC_no_win32_dlls and + statically initialized it to TRUE if compiling with GCC. + * win32_threads.c (thread_start): We no longer use SEH if + compiling with GCC. + * mark.c (GC_mark_some): We no longer use SEH if + compiling with GCC. + 2002-03-09 Bryce McKinlay * include/gc_priv.h: Define ALIGN_DOUBLE on 32 bit targets if GCJ diff --git a/boehm-gc/dyn_load.c b/boehm-gc/dyn_load.c index d80600bb1d7..a2676371037 100644 --- a/boehm-gc/dyn_load.c +++ b/boehm-gc/dyn_load.c @@ -775,7 +775,7 @@ void GC_register_dynamic_libraries() # endif # ifndef MSWINCE - extern GC_bool GC_win32s; + extern GC_bool GC_no_win32_dlls; # endif void GC_register_dynamic_libraries() @@ -788,7 +788,7 @@ void GC_register_dynamic_libraries() char * limit, * new_limit; # ifdef MSWIN32 - if (GC_win32s) return; + if (GC_no_win32_dlls) return; # endif base = limit = p = GC_sysinfo.lpMinimumApplicationAddress; # if defined(MSWINCE) && !defined(_WIN32_WCE_EMULATION) diff --git a/boehm-gc/mark.c b/boehm-gc/mark.c index 70ba135f1ab..170c279b718 100644 --- a/boehm-gc/mark.c +++ b/boehm-gc/mark.c @@ -264,7 +264,7 @@ static void alloc_mark_stack(); GC_bool GC_mark_some(cold_gc_frame) ptr_t cold_gc_frame; { -#ifdef MSWIN32 +#if defined(MSWIN32) && !defined(__GNUC__) /* Windows 98 appears to asynchronously create and remove writable */ /* memory mappings, for reasons we haven't yet understood. Since */ /* we look for writable regions to determine the root set, we may */ @@ -274,7 +274,7 @@ ptr_t cold_gc_frame; /* Note that this code should never generate an incremental GC write */ /* fault. */ __try { -#endif +#endif /* defined(MSWIN32) && !defined(__GNUC__) */ switch(GC_mark_state) { case MS_NONE: return(FALSE); @@ -395,7 +395,7 @@ ptr_t cold_gc_frame; ABORT("GC_mark_some: bad state"); return(FALSE); } -#ifdef MSWIN32 +#if defined(MSWIN32) && !defined(__GNUC__) } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { # ifdef CONDPRINT @@ -410,7 +410,7 @@ ptr_t cold_gc_frame; scan_ptr = 0; return FALSE; } -#endif /* MSWIN32 */ +#endif /* defined(MSWIN32) && !defined(__GNUC__) */ } diff --git a/boehm-gc/misc.c b/boehm-gc/misc.c index 079a037a4ae..a89f04407b4 100644 --- a/boehm-gc/misc.c +++ b/boehm-gc/misc.c @@ -483,9 +483,9 @@ int sig; #endif #ifdef MSWIN32 - extern GC_bool GC_is_win32s(); +extern GC_bool GC_no_win32_dlls; #else -# define GC_is_win32s() FALSE +# define GC_no_win32_dlls FALSE #endif void GC_init_inner() @@ -637,7 +637,7 @@ void GC_init_inner() GC_pcr_install(); # endif # if !defined(SMALL_CONFIG) - if (!GC_is_win32s() && 0 != GETENV("GC_ENABLE_INCREMENTAL")) { + if (!GC_no_win32_dlls && 0 != GETENV("GC_ENABLE_INCREMENTAL")) { GC_ASSERT(!GC_incremental); GC_setpagesize(); # ifndef GC_SOLARIS_THREADS @@ -681,7 +681,7 @@ void GC_enable_incremental GC_PROTO(()) LOCK(); if (GC_incremental) goto out; GC_setpagesize(); - if (GC_is_win32s()) goto out; + if (GC_no_win32_dlls) goto out; # ifndef GC_SOLARIS_THREADS GC_dirty_init(); # endif diff --git a/boehm-gc/os_dep.c b/boehm-gc/os_dep.c index ae1125664e3..b8f4cf84c3c 100644 --- a/boehm-gc/os_dep.c +++ b/boehm-gc/os_dep.c @@ -928,19 +928,17 @@ void GC_register_data_segments() /* all real work is done by GC_register_dynamic_libraries. Under */ /* win32s, we cannot find the data segments associated with dll's. */ /* We rgister the main data segment here. */ - GC_bool GC_win32s = FALSE; /* We're running under win32s. */ - - GC_bool GC_is_win32s() - { - DWORD v = GetVersion(); - - /* Check that this is not NT, and Windows major version <= 3 */ - return ((v & 0x80000000) && (v & 0xff) <= 3); - } +# ifdef __GCC__ + GC_bool GC_no_win32_dlls = TRUE; /* GCC can't do SEH, so we can't use VirtualQuery */ +# else + GC_bool GC_no_win32_dlls = FALSE; +# endif void GC_init_win32() { - GC_win32s = GC_is_win32s(); + /* if we're running under win32s, assume that no DLLs will be loaded */ + DWORD v = GetVersion(); + GC_no_win32_dlls |= ((v & 0x80000000) && (v & 0xff) <= 3); } /* Return the smallest address a such that VirtualQuery */ @@ -1008,7 +1006,7 @@ void GC_register_data_segments() char * base; char * limit, * new_limit; - if (!GC_win32s) return; + if (!GC_no_win32_dlls) return; p = base = limit = GC_least_described_address(static_root); while (p < GC_sysinfo.lpMaximumApplicationAddress) { result = VirtualQuery(p, &buf, sizeof(buf)); @@ -1307,7 +1305,7 @@ SYSTEM_INFO GC_sysinfo; # ifdef USE_GLOBAL_ALLOC # define GLOBAL_ALLOC_TEST 1 # else -# define GLOBAL_ALLOC_TEST GC_win32s +# define GLOBAL_ALLOC_TEST GC_no_win32_dlls # endif word GC_n_heap_bases = 0; @@ -1338,7 +1336,7 @@ word bytes; void GC_win32_free_heap () { - if (GC_win32s) { + if (GC_no_win32_dlls) { while (GC_n_heap_bases > 0) { GlobalFree (GC_heap_bases[--GC_n_heap_bases]); GC_heap_bases[GC_n_heap_bases] = 0; diff --git a/boehm-gc/win32_threads.c b/boehm-gc/win32_threads.c index 980faf34d94..38de099fa87 100644 --- a/boehm-gc/win32_threads.c +++ b/boehm-gc/win32_threads.c @@ -447,16 +447,22 @@ static DWORD WINAPI thread_start(LPVOID arg) /* Clear the thread entry even if we exit with an exception. */ /* This is probably pointless, since an uncaught exception is */ /* supposed to result in the process being killed. */ +#ifndef __GNUC__ __try { +#endif /* __GNUC__ */ ret = args.start (args.param); +#ifndef __GNUC__ } __finally { +#endif /* __GNUC__ */ LOCK(); args.entry->stack = 0; args.entry->in_use = FALSE; /* cast away volatile qualifier */ BZERO((void *) &args.entry->context, sizeof(CONTEXT)); UNLOCK(); +#ifndef __GNUC__ } +#endif /* __GNUC__ */ return ret; }