From: Josh Peterson Date: Wed, 1 Aug 2018 20:53:06 +0000 (+0300) Subject: Fix the build for N3DS X-Git-Tag: v8.0.0~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6c7ee31d9dd76c8387bb7dbbc8796ccf9f8f5e5;p=platform%2Fupstream%2Flibgc.git Fix the build for N3DS (part of commit 0f9ef2d from Unity-Technologies/bdwgc) Issue #173 (bdwgc). * include/gc.h [GC_BUILD && NN_PLATFORM_CTR] (GC_on_thread_event_proc): Define type. * include/private/gc_locks.h [NN_PLATFORM_CTR || NINTENDO_SWITCH] (GC_lock, GC_unlock): Declare function. * include/private/gc_locks.h [NN_PLATFORM_CTR || NINTENDO_SWITCH] (UNCOND_LOCK, UNCOND_UNLOCK): Define macro. * include/private/gc_priv.h [THREADS && !SN_TARGET_ORBIS && !SN_TARGET_PSP2]: Do not include gc_atomic_ops.h if NN_PLATFORM_CTR. * pthread_support.c [USE_SPIN_LOCK || !NO_PTHREAD_TRYLOCK] (GC_pause): Call GC_noop1 instead of AO_compiler_barrier unless AO_CLEAR defined. --- diff --git a/include/gc.h b/include/gc.h index b8b0692..d043942 100644 --- a/include/gc.h +++ b/include/gc.h @@ -161,7 +161,7 @@ GC_API GC_on_collection_event_proc GC_CALL GC_get_on_collection_event(void); /* Both the supplied setter and the getter */ /* acquire the GC lock (to avoid data races). */ -#ifdef GC_THREADS +#if defined(GC_THREADS) || (defined(GC_BUILD) && defined(NN_PLATFORM_CTR)) typedef void (GC_CALLBACK * GC_on_thread_event_proc)(GC_EventType, void * /* thread_id */); /* Invoked when a thread is suspended or */ diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 59f5bf4..f6e45d5 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -45,6 +45,11 @@ # endif # define UNCOND_LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml) # define UNCOND_UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml) +# elif defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) + extern void GC_lock(void); + extern void GC_unlock(void); +# define UNCOND_LOCK() GC_lock() +# define UNCOND_UNLOCK() GC_unlock() # endif # if (!defined(AO_HAVE_test_and_set_acquire) || defined(GC_RTEMS_PTHREADS) \ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index e7fc871..43f4698 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -250,7 +250,8 @@ typedef char * ptr_t; /* A generic pointer to which we can add */ # define GC_API_PRIV GC_API #endif -#if defined(THREADS) && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) +#if defined(THREADS) && !defined(NN_PLATFORM_CTR) \ + && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) # include "gc_atomic_ops.h" #endif diff --git a/pthread_support.c b/pthread_support.c index 475bcc2..071e27c 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1937,7 +1937,11 @@ STATIC void GC_pause(void) for (i = 0; i < GC_PAUSE_SPIN_CYCLES; ++i) { /* Something that's unlikely to be optimized away. */ +# ifdef AO_CLEAR AO_compiler_barrier(); +# else + GC_noop1(i); +# endif } } #endif