From 8fbb53983eb2229260edd6527d146ca9056f9b1a Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 18 Jun 2021 21:12:35 +0300 Subject: Always define default_push_other_roots (code refactoring) * os_dep.c [!THREADS] (GC_default_push_other_roots): Define macro as 0. * os_dep.c [THREADS && !PCR && !SN_TARGET_PS3] (GC_default_push_other_roots): Define to call GC_push_all_stacks(). * os_dep.c (GC_push_other_roots): Always initialize to GC_default_push_other_roots. --- os_dep.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'os_dep.c') diff --git a/os_dep.c b/os_dep.c index 60163a6d..1fd82380 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2766,7 +2766,8 @@ GC_INNER void GC_unmap_gap(ptr_t start1, size_t bytes1, ptr_t start2, /* environment, this is also responsible for marking from */ /* thread stacks. */ #ifndef THREADS - GC_push_other_roots_proc GC_push_other_roots = 0; +# define GC_default_push_other_roots 0 + #else /* THREADS */ # ifdef PCR @@ -2809,17 +2810,7 @@ STATIC void GC_CALLBACK GC_default_push_other_roots(void) } } -# endif /* PCR */ - -# if defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) \ - || defined(GC_PTHREADS) || defined(GC_WIN32_THREADS) - STATIC void GC_CALLBACK GC_default_push_other_roots(void) - { - GC_push_all_stacks(); - } -# endif - -# ifdef SN_TARGET_PS3 +# elif defined(SN_TARGET_PS3) STATIC void GC_CALLBACK GC_default_push_other_roots(void) { ABORT("GC_default_push_other_roots is not implemented"); @@ -2829,11 +2820,18 @@ STATIC void GC_CALLBACK GC_default_push_other_roots(void) { ABORT("GC_push_thread_structures is not implemented"); } -# endif /* SN_TARGET_PS3 */ - GC_push_other_roots_proc GC_push_other_roots = GC_default_push_other_roots; +# else /* GC_PTHREADS, or GC_WIN32_THREADS, etc. */ + STATIC void GC_CALLBACK GC_default_push_other_roots(void) + { + GC_push_all_stacks(); + } +# endif + #endif /* THREADS */ +GC_push_other_roots_proc GC_push_other_roots = GC_default_push_other_roots; + GC_API void GC_CALL GC_set_push_other_roots(GC_push_other_roots_proc fn) { GC_push_other_roots = fn; -- cgit v1.2.1