summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorivmai <ivmai>2011-01-07 09:51:40 +0000
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 21:06:55 +0400
commitb8246c8e27304fdb00a8ef5461d2e40dc21f70c3 (patch)
treefafcaf7afdd6fdb3064c832b1e4bdc0cda6bb4a9 /darwin_stop_world.c
parentbddc75fb8c2e9f59797c9f6fd25aaed3b1778fd8 (diff)
downloadbdwgc-b8246c8e27304fdb00a8ef5461d2e40dc21f70c3.tar.gz
2011-01-07 Ivan Maidanski <ivmai@mail.ru>
* .cvsignore: Add more auto-generated files. * include/private/.cvsignore: Ditto. * darwin_stop_world.c (GC_mach_handler_thread, GC_use_mach_handler_thread, GC_darwin_register_mach_handler_thread): Define only if MPROTECT_VDB. * darwin_stop_world.c (GC_suspend_thread_list): Use GC_mach_handler_thread and GC_use_mach_handler_thread only if MPROTECT_VDB. * darwin_stop_world.c (GC_stop_world): Reset GC_mach_threads_count only if defined (i.e. unless GC_NO_THREADS_DISCOVERY). * misc.c (GC_init): Fix comment for GWW_VDB. * os_dep.c (GC_mprotect_state_t): Reformat the code. * os_dep.c (DARWIN_EXC_STATE, DARWIN_EXC_STATE_COUNT, DARWIN_EXC_STATE_T, DARWIN_EXC_STATE_DAR): New macros. * os_dep.c (catch_exception_raise): Use DARWIN_EXC_STATE, DARWIN_EXC_STATE_COUNT, DARWIN_EXC_STATE_T, DARWIN_EXC_STATE_DAR; reformat the comment. * pthread_support.c (GC_thr_init): Define "dummy" local variable only unless GC_DARWIN_THREADS; reformat the code. * include/private/gcconfig.h (MPROTECT_VDB): Define for Darwin even in the single-threaded mode; define for iPhone/iPad. * include/private/gcconfig.h (IA64): Remove unnecessary "ifdef" around "undef". * include/private/gcconfig.h (HEURISTIC1): Remove unused for Cygwin. * include/private/gcconfig.h (STACKBOTTOM): Use fixed address for Darwin/arm (instead of HEURISTIC1). * include/private/gcconfig.h (GET_MEM): Reformat the code.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 5f152688..6af69184 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -328,14 +328,16 @@ GC_INNER void GC_push_all_stacks(void)
#ifndef GC_NO_THREADS_DISCOVERY
- STATIC mach_port_t GC_mach_handler_thread = 0;
- STATIC GC_bool GC_use_mach_handler_thread = FALSE;
+# ifdef MPROTECT_VDB
+ STATIC mach_port_t GC_mach_handler_thread = 0;
+ STATIC GC_bool GC_use_mach_handler_thread = FALSE;
- GC_INNER void GC_darwin_register_mach_handler_thread(mach_port_t thread)
- {
- GC_mach_handler_thread = thread;
- GC_use_mach_handler_thread = TRUE;
- }
+ GC_INNER void GC_darwin_register_mach_handler_thread(mach_port_t thread)
+ {
+ GC_mach_handler_thread = thread;
+ GC_use_mach_handler_thread = TRUE;
+ }
+# endif /* MPROTECT_VDB */
# ifndef GC_MAX_MACH_THREADS
# define GC_MAX_MACH_THREADS THREAD_TABLE_SZ
@@ -370,8 +372,11 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
mach_msg_type_number_t outCount;
kern_return_t kern_result;
- if (thread == my_thread || (GC_mach_handler_thread == thread
- && GC_use_mach_handler_thread)) {
+ if (thread == my_thread
+# ifdef MPROTECT_VDB
+ || (GC_mach_handler_thread == thread && GC_use_mach_handler_thread)
+# endif
+ ) {
/* Don't add our and the handler threads. */
continue;
}
@@ -472,11 +477,6 @@ GC_INNER void GC_stop_world(void)
GC_printf("Stopping the world from thread 0x%lx\n",
(unsigned long)my_thread);
# endif
- /* Clear out the mach threads list table. We do not need to really */
- /* clear GC_mach_threads[] as it is used only in the range from 0 to */
- /* GC_mach_threads_count-1, inclusive. */
- GC_mach_threads_count = 0;
-
# ifdef PARALLEL_MARK
if (GC_parallel) {
/* Make sure all free list construction has stopped before we */
@@ -495,6 +495,11 @@ GC_INNER void GC_stop_world(void)
thread_act_array_t act_list, prev_list;
mach_msg_type_number_t listcount, prevcount;
+ /* Clear out the mach threads list table. We do not need to */
+ /* really clear GC_mach_threads[] as it is used only in the range */
+ /* from 0 to GC_mach_threads_count-1, inclusive. */
+ GC_mach_threads_count = 0;
+
/* Loop stopping threads until you have gone over the whole list */
/* twice without a new one appearing. thread_create() won't */
/* return (and thus the thread stop) until the new thread exists, */