summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorivmai <ivmai>2009-11-05 13:35:44 +0100
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:51 +0200
commit185d8819702c5f2a917da60d21d0ee52b0d3043a (patch)
tree152e441c50cde56824ba17ea55a34670d9ac5638 /pthread_stop_world.c
parent0ae010d8da6e1d5116786987bbc95f1843f52254 (diff)
2009-11-05 Ivan Maidanski <ivmai@mail.ru>
* include/private/gc_priv.h (GC_total_stacksize): New variable declaration (only if THREADS). * alloc.c (GC_total_stacksize): New variable (only if THREADS). * alloc.c (min_bytes_allocd): Calculate stack_size using GC_stackbottom only in the single-threaded case; otherwise use GC_total_stacksize; print GC_total_stacksize value if DEBUG_THREADS. * darwin_stop_world.c (GC_push_all_stacks): Use "%p" printf type specifier for lo/hi values (instead of "%lx"). * darwin_stop_world.c (GC_push_all_stacks): Use GC_push_all_stack_frames() instead of GC_push_all_stack(). * darwin_stop_world.c (GC_push_all_stacks): Recalculate GC_total_stacksize value. * pthread_stop_world.c (GC_push_all_stacks): Ditto. * win32_threads.c (GC_push_all_stacks): Ditto. * win32_threads.c (GC_push_stack_for): Pass "me" argument; return stack size; don't check for non-zero value of thread->stack_base. * win32_threads.c (GC_push_all_stacks): Don't call GC_push_stack_for() and don't check for "t->id == me" if thread->stack_base is zero.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 7c0a6bf..d799eab 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -289,6 +289,7 @@ GC_INNER void GC_push_all_stacks(void)
/* On IA64, we also need to scan the register backing store. */
IF_IA64(ptr_t bs_lo; ptr_t bs_hi;)
pthread_t me = pthread_self();
+ word total_size = 0;
if (!GC_thr_initialized) GC_thr_init();
# ifdef DEBUG_THREADS
@@ -325,6 +326,11 @@ GC_INNER void GC_push_all_stacks(void)
# endif
if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n");
GC_push_all_stack_frames(lo, hi, p -> activation_frame);
+# ifdef STACK_GROWS_UP
+ total_size += lo - hi;
+# else
+ total_size += hi - lo; /* lo <= hi */
+# endif
# ifdef IA64
# ifdef DEBUG_THREADS
GC_printf("Reg stack for thread 0x%x = [%p,%p)\n",
@@ -334,6 +340,7 @@ GC_INNER void GC_push_all_stacks(void)
/* entries, and hence overflow the mark stack, which is bad. */
GC_push_all_register_frames(bs_lo, bs_hi,
THREAD_EQUAL(p -> id, me), p -> activation_frame);
+ total_size += bs_hi - bs_lo; /* bs_lo <= bs_hi */
# endif
}
}
@@ -342,6 +349,7 @@ GC_INNER void GC_push_all_stacks(void)
}
if (!found_me && !GC_in_thread_creation)
ABORT("Collecting from unknown thread.");
+ GC_total_stacksize = total_size;
}
/* There seems to be a very rare thread stopping problem. To help us */