diff options
author | ivmai <ivmai> | 2010-10-22 05:47:47 +0000 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-07-26 21:06:55 +0400 |
commit | 174c1de6e93ac6308dca45063564e175f280d16a (patch) | |
tree | a279bdda159aca36eea58c7b431699f7600383e5 /darwin_stop_world.c | |
parent | 51e969ce8077d27fd0492e7220c2838747a3f3a5 (diff) | |
download | bdwgc-174c1de6e93ac6308dca45063564e175f280d16a.tar.gz |
2010-10-22 Ivan Maidanski <ivmai@mail.ru>
* CMakeLists.txt: Check enable_parallel_mark on Darwin.
* configure.ac: Ditto.
* darwin_stop_world.c (DARWIN_SUSPEND_GC_THREADS,
DARWIN_QUERY_TASK_THREADS): Rename to GC_NO_THREADS_DISCOVERY and
GC_DISCOVER_TASK_THREADS, respectively.
* os_dep.c (DARWIN_SUSPEND_GC_THREADS): Ditto.
* pthread_support.c (DARWIN_SUSPEND_GC_THREADS): Ditto.
* darwin_stop_world.c (DARWIN_QUERY_TASK_THREADS): Don't define
(and remove FIXME).
* darwin_stop_world.c (GC_use_threads_discovery): Add GC_API;
comment; remove FIXME.
* win32_threads.c (GC_NO_DLLMAIN): Rename to
GC_NO_THREADS_DISCOVERY.
* tests/test.c (GC_NO_DLLMAIN): Ditto.
* doc/README.macros (GC_NO_DLLMAIN): Ditto.
* doc/README.win32 (GC_NO_DLLMAIN): Ditto.
* doc/README.macros (GC_NO_THREADS_DISCOVERY): Update the comment.
* win32_threads.c (GC_win32_dll_threads): Define as macro to true
if GC_DISCOVER_TASK_THREADS (and not GC_NO_THREADS_DISCOVERY);
update the comment.
* win32_threads.c (GC_use_DllMain): Rename to
GC_use_threads_discovery; do not set GC_win32_dll_threads if
GC_DISCOVER_TASK_THREADS.
* win32_threads.c (GC_started_thread_while_stopped,
GC_lookup_thread_inner, UNPROTECT_THREAD, GC_lookup_pthread,
GC_thr_init, GC_pthread_create, DllMain): Rewrite some expressions
which use GC_win32_dll_threads to minimize the possibility of
an "unreachable code" compiler warning when GC_win32_dll_threads
is defined as a macro.
* win32_threads.c (GC_unregister_my_thread): Don't call
GC_delete_thread() if GC_win32_dll_threads and THREAD_LOCAL_ALLOC
(since can't happen); use "t" local variable only if not
GC_win32_dll_threads.
* win32_threads.c (GC_register_my_thread_inner): Reformat the
comment.
* doc/README.macros (GC_DISCOVER_TASK_THREADS): Document.
* include/gc.h (GC_use_DllMain): Rename to
GC_use_threads_discovery but keep old name as a macro definition.
* include/gc.h (GC_use_threads_discovery): Declare also for
Darwin; update the comment.
* tests/test.c (main): Call GC_use_threads_discovery for Darwin
(to test the mode if possible).
* configure: Regenerate.
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r-- | darwin_stop_world.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 3e14b635..5f152688 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -87,26 +87,26 @@ GC_INNER ptr_t GC_FindTopOfStack(unsigned long stack_start) #endif /* !DARWIN_DONT_PARSE_STACK */ -#define DARWIN_QUERY_TASK_THREADS 1 /* FIXME: Remove this. */ - /* GC_query_task_threads controls whether to obtain the list of */ /* the threads from the kernel or to use GC_threads table. */ -#ifdef DARWIN_SUSPEND_GC_THREADS +#ifdef GC_NO_THREADS_DISCOVERY # define GC_query_task_threads FALSE -#elif defined(DARWIN_QUERY_TASK_THREADS) +#elif defined(GC_DISCOVER_TASK_THREADS) # define GC_query_task_threads TRUE #else STATIC GC_bool GC_query_task_threads = FALSE; -#endif /* !DARWIN_SUSPEND_GC_THREADS */ +#endif /* !GC_NO_THREADS_DISCOVERY */ -/* FIXME: add GC_API and declare in gc.h; add comment; document macros */ -void GC_CALL GC_use_threads_discovery(void) +/* Use implicit threads registration (all task threads excluding the GC */ +/* special ones are stoped and scanned). Should be called before */ +/* GC_INIT() (or, at least, before going multi-threaded). Deprecated. */ +GC_API void GC_CALL GC_use_threads_discovery(void) { -# if defined(DARWIN_SUSPEND_GC_THREADS) || defined(DARWIN_DONT_PARSE_STACK) +# if defined(GC_NO_THREADS_DISCOVERY) || defined(DARWIN_DONT_PARSE_STACK) ABORT("Darwin task-threads-based stop and push unsupported"); # else GC_ASSERT(!GC_need_to_lock); -# ifndef DARWIN_QUERY_TASK_THREADS +# ifndef GC_DISCOVER_TASK_THREADS GC_query_task_threads = TRUE; # endif GC_init_parallel(); /* just to be consistent with Win32 one */ @@ -326,7 +326,7 @@ GC_INNER void GC_push_all_stacks(void) GC_total_stacksize = total_size; } -#ifndef DARWIN_SUSPEND_GC_THREADS +#ifndef GC_NO_THREADS_DISCOVERY STATIC mach_port_t GC_mach_handler_thread = 0; STATIC GC_bool GC_use_mach_handler_thread = FALSE; @@ -453,7 +453,7 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count, return changed; } -#endif /* !DARWIN_SUSPEND_GC_THREADS */ +#endif /* !GC_NO_THREADS_DISCOVERY */ #ifdef MPROTECT_VDB GC_INNER void GC_mprotect_stop(void); @@ -490,7 +490,7 @@ GC_INNER void GC_stop_world(void) # endif /* PARALLEL_MARK */ if (GC_query_task_threads) { -# ifndef DARWIN_SUSPEND_GC_THREADS +# ifndef GC_NO_THREADS_DISCOVERY GC_bool changed; thread_act_array_t act_list, prev_list; mach_msg_type_number_t listcount, prevcount; @@ -530,7 +530,7 @@ GC_INNER void GC_stop_world(void) mach_port_deallocate(my_task, prev_list[i]); vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount); -# endif /* !DARWIN_SUSPEND_GC_THREADS */ +# endif /* !GC_NO_THREADS_DISCOVERY */ } else { for (i = 0; i < THREAD_TABLE_SZ; i++) { @@ -601,7 +601,7 @@ GC_INNER void GC_start_world(void) # endif if (GC_query_task_threads) { -# ifndef DARWIN_SUSPEND_GC_THREADS +# ifndef GC_NO_THREADS_DISCOVERY int j = GC_mach_threads_count; kern_return_t kern_result; thread_act_array_t act_list; @@ -646,7 +646,7 @@ GC_INNER void GC_start_world(void) } vm_deallocate(my_task, (vm_address_t)act_list, sizeof(thread_t) * listcount); -# endif /* !DARWIN_SUSPEND_GC_THREADS */ +# endif /* !GC_NO_THREADS_DISCOVERY */ } else { mach_port_t my_thread = mach_thread_self(); |