diff options
author | timcannell <timcannell@unity3d.com> | 2020-02-26 23:38:54 +0300 |
---|---|---|
committer | timcannell <timcannell@unity3d.com> | 2020-02-26 23:38:54 +0300 |
commit | 6a86542bd437ef46d683a3edc17ea078a02ef99e (patch) | |
tree | 6b6e6d2a1d3682c530048fc177b9330fb529869c | |
parent | 78e14e571951fdc228cd0d40e4c0c439004d6eed (diff) |
extract platform defines to seperate values that can be set from the compiler
-rw-r--r-- | allchblk.c | 10 | ||||
-rw-r--r-- | alloc.c | 2 | ||||
-rw-r--r-- | dyn_load.c | 2 | ||||
-rw-r--r-- | include/gc_config_macros.h | 4 | ||||
-rw-r--r-- | include/private/gc_locks.h | 2 | ||||
-rw-r--r-- | include/private/gc_priv.h | 2 | ||||
-rw-r--r-- | include/private/gcconfig.h | 28 | ||||
-rw-r--r-- | mach_dep.c | 2 | ||||
-rw-r--r-- | misc.c | 6 |
9 files changed, 31 insertions, 27 deletions
@@ -411,10 +411,12 @@ GC_INNER void GC_unmap_old(void) * have a virtual paging system, so it does not have a large virtual address * space that a standard x64 platform has. */ -#if defined(SN_TARGET_PS3) || defined(SN_TARGET_PSP2) || defined(SN_TARGET_ORBIS) || defined(_XBOX_ONE) -# define UNMAP_THRESHOLD 2 -#else -# define UNMAP_THRESHOLD 6 +#if !defined(UNMAP_THRESHOLD) + #if defined(SN_TARGET_PS3) || defined(SN_TARGET_PSP2) || defined(_XBOX_ONE) + # define UNMAP_THRESHOLD 2 + #else + # define UNMAP_THRESHOLD 6 + #endif #endif for (i = 0; i <= N_HBLK_FLS; ++i) { @@ -20,7 +20,7 @@ #include <stdio.h> #if !defined(MACOS) && !defined(MSWINCE) # include <signal.h> -# if !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \ +# if !defined(GC_NO_TYPES) && !defined(SN_TARGET_PSP2) \ && !defined(__CC_ARM) # include <sys/types.h> # endif @@ -26,7 +26,7 @@ * But then not much of anything is safe in the presence of dlclose. */ -#if !defined(MACOS) && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \ +#if !defined(MACOS) && !defined(GC_NO_TYPES) && !defined(SN_TARGET_PSP2) \ && !defined(_WIN32_WCE) && !defined(__CC_ARM) # include <sys/types.h> #endif diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index a043db8d..5a05253d 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -77,7 +77,7 @@ || defined(GC_NETBSD_THREADS) || defined(GC_OPENBSD_THREADS) \ || defined(GC_OSF1_THREADS) || defined(GC_SOLARIS_THREADS) \ || defined(GC_WIN32_THREADS) || defined(GC_RTEMS_PTHREADS) \ - || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PSP2) + || defined(SN_TARGET_PSP2) # ifndef GC_THREADS # define GC_THREADS # endif @@ -92,7 +92,7 @@ # elif defined(__OpenBSD__) # define GC_OPENBSD_THREADS # elif defined(__DragonFly__) || defined(__FreeBSD_kernel__) \ - || (defined(__FreeBSD__) && !defined(SN_TARGET_ORBIS)) + || (defined(__FreeBSD__) && !defined(GC_NO_FREEBSD_THREADS)) # define GC_FREEBSD_THREADS # elif defined(__NetBSD__) # define GC_NETBSD_THREADS diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 3c104192..f4d3e3f3 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -48,7 +48,7 @@ # endif # if (!defined(AO_HAVE_test_and_set_acquire) || defined(GC_RTEMS_PTHREADS) \ - || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) \ + || defined(SN_TARGET_PS3) \ || defined(GC_WIN32_THREADS) || defined(LINT2)) && defined(GC_PTHREADS) # define USE_PTHREAD_LOCKS # undef USE_SPIN_LOCK diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 6acaabb4..aaf67d7f 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -835,7 +835,7 @@ EXTERN_C_BEGIN # if defined(LARGE_CONFIG) || !defined(SMALL_CONFIG) # ifdef ALPHA # define CPP_LOG_HBLKSIZE 13 -# elif defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PSP2) +# elif defined(SN_TARGET_PSP2) # define CPP_LOG_HBLKSIZE 16 /* page size is set to 64K */ # else # define CPP_LOG_HBLKSIZE 12 diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 7982ce39..cbe3ae9e 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -130,7 +130,7 @@ EXTERN_C_BEGIN /* And one for FreeBSD: */ # if (defined(__FreeBSD__) || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__)) && !defined(FREEBSD) \ - && !defined(SN_TARGET_ORBIS) /* Orbis compiler defines __FreeBSD__ */ + && !defined(GC_NO_FREEBSD) # define FREEBSD # endif @@ -168,7 +168,7 @@ EXTERN_C_BEGIN && !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \ && !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \ && !defined(NN_BUILD_TARGET_PLATFORM_NX) \ - && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) \ + && !defined(GC_NO_NOSYS) && !defined(SN_TARGET_PSP2) \ && !defined(SYMBIAN) # define NOSYS # define mach_type_known @@ -481,7 +481,7 @@ EXTERN_C_BEGIN # define I386 # define mach_type_known # endif -# if (defined(FREEBSD) || defined(SN_TARGET_ORBIS)) \ +# if (defined(FREEBSD)) \ && (defined(__amd64__) || defined(__x86_64__)) # define X86_64 # define mach_type_known @@ -2565,14 +2565,14 @@ EXTERN_C_BEGIN # ifndef CACHE_LINE_SIZE # define CACHE_LINE_SIZE 64 # endif -# ifdef SN_TARGET_ORBIS +# ifdef PLATFORM_GETMEM # define DATASTART (ptr_t)ALIGNMENT # define DATAEND (ptr_t)ALIGNMENT EXTERN_C_END # include <pthread.h> EXTERN_C_BEGIN - void *ps4_get_stack_bottom(void); -# define STACKBOTTOM ((ptr_t)ps4_get_stack_bottom()) + void *platform_get_stack_bottom(void); +# define STACKBOTTOM ((ptr_t)platform_get_stack_bottom()) # endif # ifdef OPENBSD # define OS_TYPE "OPENBSD" @@ -3082,7 +3082,7 @@ EXTERN_C_BEGIN /* The platform does not have a virtual paging system, so it does not */ /* have a large virtual address space that a standard x64 platform has. */ #if defined(USE_MUNMAP) && !defined(MUNMAP_THRESHOLD) \ - && (defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) \ + && (defined(SN_TARGET_PS3) \ || defined(SN_TARGET_PSP2) || defined(MSWIN_XBOX1)) # define MUNMAP_THRESHOLD 2 #endif @@ -3250,9 +3250,11 @@ EXTERN_C_BEGIN #if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) \ || defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) \ - || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) \ + || defined(SN_TARGET_PS3) \ || defined(SN_TARGET_PSP2) -# define THREADS + #if !defined(THREADS) + # define THREADS + #endif #endif #if defined(PARALLEL_MARK) && !defined(THREADS) && !defined(CPPCHECK) @@ -3339,7 +3341,7 @@ EXTERN_C_BEGIN #endif #if defined(CAN_HANDLE_FORK) && !defined(CAN_CALL_ATFORK) \ - && !defined(HURD) && !defined(SN_TARGET_ORBIS) && !defined(HOST_TIZEN) \ + && !defined(HURD) && !defined(GC_NO_CAN_CALL_ATFORK) && !defined(HOST_TIZEN) \ && (!defined(HOST_ANDROID) || __ANDROID_API__ >= 21) /* Have working pthread_atfork(). */ # define CAN_CALL_ATFORK @@ -3574,9 +3576,9 @@ EXTERN_C_BEGIN SIZET_SAT_ADD(bytes, \ GC_page_size)) \ + GC_page_size-1) -# elif defined(SN_TARGET_ORBIS) - void *ps4_get_mem(size_t bytes); -# define GET_MEM(bytes) (struct hblk*)ps4_get_mem(bytes) +# elif defined(PLATFORM_GETMEM) + void *platform_get_mem(size_t bytes); +# define GET_MEM(bytes) (struct hblk*)platform_get_mem(bytes) # elif defined(SN_TARGET_PS3) void *ps3_get_mem(size_t bytes); # define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes) @@ -14,7 +14,7 @@ #include "private/gc_priv.h" -#if !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2) +#if !defined(PLATFORM_MACH_DEP) && !defined(SN_TARGET_PSP2) #include <stdio.h> @@ -58,7 +58,7 @@ GC_INNER PCR_Th_ML GC_allocate_ml; # elif defined(SN_TARGET_PSP2) GC_INNER WapiMutex GC_allocate_ml_PSP2 = { 0, NULL }; -# elif defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) +# elif defined(GC_PTHREAD_MUTEX) || defined(SN_TARGET_PS3) # include <pthread.h> GC_INNER pthread_mutex_t GC_allocate_ml; # endif @@ -1732,14 +1732,14 @@ GC_API void GC_CALL GC_enable_incremental(void) # define WRITE(level, buf, len) switch_log_write(buf, len) #else -# if !defined(AMIGA) && !defined(MSWIN_XBOX1) && !defined(SN_TARGET_ORBIS) \ +# if !defined(AMIGA) && !defined(MSWIN_XBOX1) && !defined(GC_NO_TYPES) \ && !defined(SN_TARGET_PSP2) && !defined(__CC_ARM) # include <unistd.h> # endif STATIC int GC_write(int fd, const char *buf, size_t len) { -# if defined(ECOS) || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PSP2) \ +# if defined(ECOS) || defined(PLATFORM_WRITE) || defined(SN_TARGET_PSP2) \ || defined(NOSYS) # ifdef ECOS /* FIXME: This seems to be defined nowhere at present. */ |