summaryrefslogtreecommitdiff
path: root/mark_rts.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2019-09-24 10:52:51 +0300
committerIvan Maidanski <ivmai@mail.ru>2019-09-24 10:52:51 +0300
commit94efaa381a0cf85848f3bdda97cd6f19106c73dd (patch)
treedd551b3c930a18096c4a0daddd48fa6940204038 /mark_rts.c
parent7df9541add6af01c57d91eff6fb34a6eb9d529d6 (diff)
downloadbdwgc-94efaa381a0cf85848f3bdda97cd6f19106c73dd.tar.gz
Remove redundant GC_with_callee_saves_pushed call in multi-threaded builds
In GC_push_regs_and_stack, if cold_gc_frame is null and threads support is on then there is no need to call GC_with_callee_saves_pushed(GC_push_current_stack) as GC_push_current_stack is no-op in this case. * mark_rts.c (GC_push_current_stack): Reformat title comment. * mark_rts.c [THREADS] (GC_push_current_stack): Do not check that cold_gc_frame is non-zero; add comment about it. * mark_rts.c [THREADS] (GC_push_regs_and_stack): If cold_gc_frame is null then do not call GC_with_callee_saves_pushed().
Diffstat (limited to 'mark_rts.c')
-rw-r--r--mark_rts.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/mark_rts.c b/mark_rts.c
index 325a4593..90b04803 100644
--- a/mark_rts.c
+++ b/mark_rts.c
@@ -773,27 +773,19 @@ STATIC void GC_push_all_stack_part_eager_sections(ptr_t lo, ptr_t hi,
#endif /* !THREADS */
- /* Push enough of the current stack eagerly to */
- /* ensure that callee-save registers saved in */
- /* GC frames are scanned. */
- /* In the non-threads case, schedule entire */
- /* stack for scanning. */
- /* The second argument is a pointer to the */
- /* (possibly null) thread context, for */
- /* (currently hypothetical) more precise */
- /* stack scanning. */
-/*
- * In the absence of threads, push the stack contents.
- * In the presence of threads, push enough of the current stack
- * to ensure that callee-save registers saved in collector frames have been
- * seen.
- * TODO: Merge it with per-thread stuff.
- */
+/* Push enough of the current stack eagerly to ensure that callee-save */
+/* registers saved in GC frames are scanned. In the non-threads case, */
+/* schedule entire stack for scanning. The 2nd argument is a pointer */
+/* to the (possibly null) thread context, for (currently hypothetical) */
+/* more precise stack scanning. In the presence of threads, push */
+/* enough of the current stack to ensure that callee-save registers */
+/* saved in collector frames have been seen. */
+/* TODO: Merge it with per-thread stuff. */
STATIC void GC_push_current_stack(ptr_t cold_gc_frame,
void * context GC_ATTR_UNUSED)
{
# if defined(THREADS)
- if (0 == cold_gc_frame) return;
+ /* cold_gc_frame is non-NULL. */
# ifdef STACK_GROWS_DOWN
GC_push_all_eager(GC_approx_sp(), cold_gc_frame);
/* For IA64, the register stack backing store is handled */
@@ -873,6 +865,10 @@ GC_INNER void GC_cond_register_dynamic_libraries(void)
STATIC void GC_push_regs_and_stack(ptr_t cold_gc_frame)
{
+# ifdef THREADS
+ if (NULL == cold_gc_frame)
+ return; /* GC_push_all_stacks should push registers and stack */
+# endif
GC_with_callee_saves_pushed(GC_push_current_stack, cold_gc_frame);
}