[Gc] Back to "GC Stack problem on Win32" - refinement

Ivan Maidanski ivmai at mail.ru
Sat Nov 1 10:19:34 PST 2008


Hi!

One refinement for GC_push_stack_for() implementation (and to my previous patch): if we are in the current thread then it's always safe to use "sp" value, so we may use it (if lesser) instead of last known stack_min for probing stack memory page.

The attached patch does this.

PS. With this post (diff37) I feel now I've changed/fixed all (in general) what I'd wanted to (before sending diff1). But I'm still continuing testing GC (and reviewing CVS changes)...

Bye.

-------------- next part --------------
diff -ru bdwgc/win32_threads.c updated/bdwgc/win32_threads.c
--- bdwgc/win32_threads.c	2008-11-01 15:06:12.000000000 +0300
+++ updated/bdwgc/win32_threads.c	2008-11-01 20:26:40.000000000 +0300
@@ -948,7 +948,10 @@
 #       ifdef MSWINCE
 	  stack_min = GC_get_stack_min(thread -> stack_base);
 #       else
-          if (GC_may_be_in_stack(thread -> last_stack_min)) {
+	  /* In the current thread it is always safe to use sp value.	*/
+          if (GC_may_be_in_stack(thread -> id == me &&
+				 sp < thread -> last_stack_min ?
+				 sp : thread -> last_stack_min)) {
 	    stack_min = last_info.BaseAddress;
 	    /* Do not probe rest of the stack if sp is correct. */
 	    if (sp < stack_min || sp >= thread->stack_base)


More information about the Gc mailing list