[Gc] Patches resubmission 5

Boehm, Hans hans.boehm at hp.com
Thu Jun 11 17:34:13 PDT 2009

Thanks.  I committed this patch, with the following minor changes:

1) I changed the comment for GC_mark_mutex_waitcnt.  I believe its value is waiters+1, not waiters-1, i.e. with 1 waiter, it's 2.

2) I made all accesses to this variable atomic.  I believe it can currently be incremented outside a lock.  Thus any access potentially races with it.  I'd like to get rid of all data races (e.g. by using atomic accesses), or at least strongly comment any remaining ones.  This gets us closer to the official Posix and C++0x/C1x rules,
which I think either are, or soon also will be, Microsoft's official rules.

I also ended up changing all the GC_THREADS tests in misc.c so they checked THREADS
instead.  This corrects an issue introduced with the previous patch I noticed when I tested on Windows.  GC_THREADS is the preferred way for the user to specify a threads configurations, but it wasn't intended to be used internally, and not all Makefiles currently set it.


> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Ivan Maidanski
> Sent: Friday, May 29, 2009 7:51 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Patches resubmission 5
> Hi!
> This cumulative patch (resembling diff27, diff30, diff43, 
> diff44, diff66, diff76, diff79, diff83 partly) deals with 
> misc fixes in win32_threads.c only. It doesn't depend on my 
> previous cumulative patches.
> Notes:
> 1. IA64 is still not supported on Win32.
> 2. My explanations for GC_wait_marker() changes is here:
> https://permalink.gmane.org/gmane.comp.programming.garbage-coll
> ection.boehmgc/2500
> ChangeLog entries:
>         * win32_threads.c (MAX_THREADS): Define as 1 if 
> GC_win32_dll_threads
>         is defined as FALSE (otherwise the size of 
> dll_thread_table is near
>         200 KiB for 32-bit).
>         * win32_threads.c (GC_use_DllMain): Optimize for 
>         * win32_threads.c (GC_Thread_Rep): Add backing_store_end and
>         backing_store_ptr fields for IA64 support.
>         * win32_threads.c (GC_register_my_thread_inner): Set
>         backing_store_end field to reg_base value for IA64 (same as in
>         pthread_support.c).
>         * win32_threads.c (SET_PTHREAD_MAP_CACHE): Put 
> parentheses in the
>         "right" places, remove ';'.
>         * win32_threads.c (GC_fault_handler_lock): Declare only
>         if MPROTECT_VDB (and not WinCE).
>         * win32_threads.c (GC_suspend): Acquire and release
>         GC_fault_handler_lock only if MPROTECT_VDB (and not WinCE).
>         * win32_threads.c (GC_suspend): Define as STATIC.
>         * win32_threads.c (GC_push_stack_for): Fix WARN() 
> format specifier
>         (should be word-complient, "%p" is used w/o "0x"), 
> don't cast sp.
>         * win32_threads.c (GC_push_all_stacks): Convert a 
> group of printf()
>         calls into a single one (for output atomicity).
>         * win32_threads.c (GC_get_next_stack): Unprotect 
> thread descriptor
>         before altering its last_stack_min ("thread" variable 
> is added).
>         * win32_threads.c (GC_get_next_stack): Remove 
> unnecessary checks for
>         "s" is non-NULL. 
>         * win32_threads.c (GC_get_next_stack): Don't call 
> GC_may_be_in_stack
>         if WinCE.
>         * win32_threads.c (GC_get_next_stack): Pass 
> current_min value to
>         GC_get_stack_min as-is (without -1).
>         * win32_threads.c (GC_wait_marker): Remove FIXME and 
> use "release"
>         version of AO_fetch_and_sub1().
>         * win32_threads.c (GC_win32_start_inner, 
> GC_win32_start): convert int
>         to pointer (and vice verse) thru word type to 
> suppress warnings.
> PS. Not related to this patch. I found that diff41a and 
> diff41b [Nov 11] don't depend on my other patches and could 
> be easily applied but read the accompanying info:
> https://permalink.gmane.org/gmane.comp.programming.garbage-coll
> ection.boehmgc/2484
> and 
> https://permalink.gmane.org/gmane.comp.programming.garbage-coll
> ection.boehmgc/2485
> Bye.

More information about the Gc mailing list