diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-05-05 21:08:10 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-05-05 21:08:10 +0300 |
commit | dd8c0233df47a3c0bd4f7a174f73cf5201c57cfc (patch) | |
tree | 6ede83912a07740f75c8d35c2d5de14a2bf33b28 /alloc.c | |
parent | 000f4575cec2b8614fe254bc8e3dd2bbc1e7c6a9 (diff) | |
download | bdwgc-dd8c0233df47a3c0bd4f7a174f73cf5201c57cfc.tar.gz |
Do not invoke GC_approx_sp() repeatedly in GC_stopped_mark
(refactoring)
* alloc.c (GC_stopped_mark): Reformat comment; define cold_gc_frame
local variable; pass cold_gc_frame to GC_mark_some() instead of
GC_approx_sp().
Diffstat (limited to 'alloc.c')
-rw-r--r-- | alloc.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -788,14 +788,13 @@ GC_API int GC_CALL GC_collect_a_little(void) # define COMMA_IF_USE_MUNMAP(x) /* empty */ #endif -/* - * We stop the world and mark from all roots. - * If stop_func() ever returns TRUE, we may fail and return FALSE. - * Increment GC_gc_no if we succeed. - */ +/* We stop the world and mark from all roots. If stop_func() ever */ +/* returns TRUE, we may fail and return FALSE. Increment GC_gc_no if */ +/* we succeed. */ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func) { int i; + ptr_t cold_gc_frame = GC_approx_sp(); # ifndef NO_CLOCK CLOCK_TYPE start_time = CLOCK_TYPE_INITIALIZER; # endif @@ -853,7 +852,7 @@ STATIC GC_bool GC_stopped_mark(GC_stop_func stop_func) GC_parallel_mark_disabled = TRUE; # endif for (i = 0; !(*stop_func)(); i++) { - if (GC_mark_some(GC_approx_sp())) { + if (GC_mark_some(cold_gc_frame)) { # ifdef PARALLEL_MARK if (GC_parallel && GC_parallel_mark_disabled) { GC_COND_LOG_PRINTF("Stopped marking done after %d iterations" |