summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2015-06-20 22:22:07 +0300
committerIvan Maidanski <ivmai@mail.ru>2015-06-20 22:22:07 +0300
commitda3c476ec9dfd1961d99d0066b226c62233bd37d (patch)
treefc054df2ffb1938b5d0ab02a43d945e9e9a50f5d /darwin_stop_world.c
parentc86b629133f6c7dac1fc5a4cf2f3317f163dd70c (diff)
downloadbdwgc-da3c476ec9dfd1961d99d0066b226c62233bd37d.tar.gz
Adjust places where profiling callbacks invoked (to match Mono GC)
* alloc.c (GC_try_to_collect_inner): Move sending of GC_EVENT_START to the beginning of function (i.e. send right after GC_dont_gc check); move sending of GC_EVENT_END from GC_finish_collection to the end of this function (send it only if collection completed successfully); add TODO note about GC_EVENT_ABANDON notification. * alloc.c (start_world_inner): Remove. * alloc.c (GC_stopped_mark): Send GC_EVENT_PRE_STOP_WORLD, GC_EVENT_POST_STOP_WORLD, GC_EVENT_PRE_START_WORLD, GC_EVENT_POST_START_WORLD only if THREADS. * alloc.c (GC_stopped_mark): Send GC_EVENT_MARK_START before minimizing junk left in registers/stack (instead of after). * alloc.c (GC_stopped_mark): Do not send GC_EVENT_MARK_END in case of abandoned collection (add TODO note about GC_EVENT_MARK_ABANDON). * alloc.c (GC_stopped_mark): Send GC_EVENT_MARK_END after checking debugged objects for consistency (instead of before it). * darwin_stop_world.c (GC_suspend_thread_list): Send GC_EVENT_THREAD_SUSPENDED (in addition to that in GC_stop_world). * darwin_stop_world.c (GC_thread_resume): Move sending of GC_EVENT_THREAD_UNSUSPENDED from GC_start_world(). * pthread_stop_world.c (GC_suspend_all, GC_start_world): Do not send GC_EVENT_THREAD_SUSPENDED if pthread_kill/android_thread_kill failed. * pthread_stop_world.c (GC_start_world): Send GC_EVENT_THREAD_UNSUSPENDED after pthread_resume_np (in case of GC_OPENBSD_UTHREADS). * win32_threads.c (GC_stop_world): Move sending of GC_EVENT_THREAD_SUSPENDED to GC_suspend(). * win32_threads.c (GC_suspend, GC_start_world): Remove redundant cast to void* of THREAD_HANDLE().
Diffstat (limited to 'darwin_stop_world.c')
-rw-r--r--darwin_stop_world.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index aa58993e..1b6d0072 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -495,6 +495,8 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
}
if (!found)
GC_mach_threads_count++;
+ if (GC_on_collection_event)
+ GC_on_collection_event(GC_EVENT_THREAD_SUSPENDED, (void *)thread);
}
return changed;
}
@@ -626,6 +628,8 @@ GC_INLINE void GC_thread_resume(thread_act_t thread)
kern_result = thread_resume(thread);
if (kern_result != KERN_SUCCESS)
ABORT("thread_resume failed");
+ if (GC_on_collection_event)
+ GC_on_collection_event(GC_EVENT_THREAD_UNSUSPENDED, (void *)thread);
}
/* Caller holds allocation lock, and has held it continuously since */
@@ -700,9 +704,6 @@ GC_INNER void GC_start_world(void)
if ((p->flags & FINISHED) == 0 && !p->thread_blocked &&
p->stop_info.mach_thread != my_thread)
GC_thread_resume(p->stop_info.mach_thread);
- if (GC_on_collection_event)
- GC_on_collection_event(GC_EVENT_THREAD_UNSUSPENDED,
- (void *)p->stop_info.mach_thread);
}
}