]> granicus.if.org Git - gc/commitdiff
Remove redundant GC_with_callee_saves_pushed call in multi-threaded builds
authorIvan Maidanski <ivmai@mail.ru>
Tue, 24 Sep 2019 07:52:51 +0000 (10:52 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 24 Sep 2019 07:52:51 +0000 (10:52 +0300)
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().

mark_rts.c

index 325a4593a8f6ede2a82a86784d89a8980de34152..90b048033a0a6d742b6023a6fc96fccde107310b 100644 (file)
@@ -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);
 }