summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Cannell <timcannell@unity3d.com>2020-05-14 22:56:58 +0100
committerIvan Maidanski <ivmai@mail.ru>2021-07-14 18:51:32 +0300
commit0b826a70191da9e1ea0012351f4bb2dedbe1ee17 (patch)
tree5e85002c8923e5d48bb83587d5a63f5b184c8c78
parentf1007408a23e4dd97e202b0d7e8fed94bc019a56 (diff)
downloadbdwgc-0b826a70191da9e1ea0012351f4bb2dedbe1ee17.tar.gz
Replace SN_TARGET_ORBIS to PLATFORM_* and GC_NO_* macros
(cherry-pick of 6a86542, 366aaf6, f3b34f4 from Unity-Technologies/bdwgc) SN_TARGET_ORBIS macro is replaced (almost) with GC_NO_CAN_CALL_ATFORK, GC_NO_FREEBSD, GC_NO_NOSYS, GC_NO_TYPES, PLATFORM_GC_REG_STORAGE_SIZE, PLATFORM_GETMEM, PLATFORM_MACH_DEP, PLATFORM_STOP_WORLD, PLATFORM_WRITE ones. * alloc.c [!MACOS && !MSWINCE && !SN_TARGET_PSP2]: Test GC_NO_TYPES macro instead of SN_TARGET_ORBIS. * misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG && !NN_PLATFORM_CTR && !NINTENDO_SWITCH && !SN_TARGET_PSP2 && !AMIGA && !MSWIN32 && !MSWIN_XBOX1 && !__CC_ARM]: Likewise. * dyn_load.c [MACOS && !SN_TARGET_PSP2 && !_WIN32_WCE && !__CC_ARM]: Likewise. * extra/gc.c [PLATFORM_MACH_DEP]: Do not include mach_dep.c file. * extra/gc.c [PLATFORM_STOP_WORLD]: Do not include pthread_stop_world.c file. * include/gc_config_macros.h [__DragonFly__ || __FreeBSD_kernel__ || __FreeBSD__]: Do not define GC_FREEBSD_THREADS if GC_NO_FREEBSD. * include/private/gc_locks.h [GC_PTHREADS]: Do not test SN_TARGET_ORBIS macro. * include/private/gc_priv.h [!HBLKSIZE && (LARGE_CONFIG || !SMALL_CONFIG)]: Likewise. * include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD] (MUNMAP_THRESHOLD): Likewise. * include/private/gcconfig.h [GC_THREADS] (THREADS): Likewise. * include/private/gcconfig.h [(__FreeBSD__ || __DragonFly__ || __FreeBSD_kernel__) && !FREEBSD] (FREEBSD): Test GC_NO_FREEBSD macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [(__arm || __arm__ || __thumb__) && !NACL && !LINUX && !NETBSD && !FREEBSD && !OPENBSD && !DARWIN && !_WIN32 && !__CEGCC__ && !NN_PLATFORM_CTR && !SN_TARGET_PSP2 && !SYMBIAN] (NOSYS): Test GC_NO_NOSYS macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [SN_TARGET_ORBIS && (__amd64__ || __x86_64__)] (X86_64): Do not define. * include/private/gcconfig.h [X86_64]: Test PLATFORM_GETMEM macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM] (OS_TYPE): Update value. * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM]: Include pthread.h. * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM]: Declare platform_get_stack_bottom() instead of ps4_get_stack_bottom(). * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM] (STACKBOTTOM): Use platform_get_stack_bottom(). * include/private/gcconfig.h [CAN_HANDLE_FORK && !CAN_CALL_ATFORK !HOST_TIZEN && !HURD] (CAN_CALL_ATFORK): Test GC_NO_CAN_CALL_ATFORK macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [GC_PRIVATE_H]: Test PLATFORM_GETMEM macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [GC_PRIVATE_H && PLATFORM_GETMEM] (platform_get_mem): Declare (instead of ps4_get_mem). * include/private/gcconfig.h [GC_PRIVATE_H && PLATFORM_GETMEM] (GET_MEM): Use platform_get_mem(). * include/private/pthread_stop_world.h [!GC_OPENBSD_UTHREADS && !NACL && !SN_TARGET_PSP2] (thread_stop_info.last_stop_count): Test PLATFORM_STOP_WORLD macro instead of SN_TARGET_ORBIS. * pthread_stop_world.c [GC_PTHREADS && !GC_WIN32_THREADS && !GC_DARWIN_THREADS]: Likewise. * include/private/pthread_stop_world.h [!NACL]: Test PLATFORM_HAVE_GC_REG_STORAGE_SIZE macro instead of SN_TARGET_ORBIS. * include/private/pthread_stop_world.h [!NACL && PLATFORM_HAVE_GC_REG_STORAGE_SIZE] (ORBIS_GC_REG_STORAGE_SIZE): Do not define. * include/private/pthread_stop_world.h [!NACL && PLATFORM_HAVE_GC_REG_STORAGE_SIZE] (thread_stop_info.registers): Use PLATFORM_GC_REG_STORAGE_SIZE instead of ORBIS_GC_REG_STORAGE_SIZE. * mach_dep.c [!SN_TARGET_PSP2]: Test PLATFORM_MACH_DEP macro instead of SN_TARGET_ORBIS. * misc.c [THREADS && !PCR && !SN_TARGET_PSP2] (GC_allocate_ml): Test GC_DEFN_ALLOCATE_ML macro instead of SN_TARGET_ORBIS. * misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG && !NN_PLATFORM_CTR && !NINTENDO_SWITCH] (GC_write): Test PLATFORM_WRITE macro instead of SN_TARGET_ORBIS.
-rw-r--r--alloc.c2
-rw-r--r--dyn_load.c2
-rw-r--r--extra/gc.c8
-rw-r--r--include/gc_config_macros.h4
-rw-r--r--include/private/gc_locks.h2
-rw-r--r--include/private/gc_priv.h2
-rw-r--r--include/private/gcconfig.h32
-rw-r--r--include/private/pthread_stop_world.h7
-rw-r--r--mach_dep.c4
-rw-r--r--misc.c8
-rw-r--r--pthread_stop_world.c2
11 files changed, 39 insertions, 34 deletions
diff --git a/alloc.c b/alloc.c
index 9e0ebaf7..bcad66d0 100644
--- a/alloc.c
+++ b/alloc.c
@@ -21,7 +21,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
diff --git a/dyn_load.c b/dyn_load.c
index 49b1a679..0dc03be5 100644
--- a/dyn_load.c
+++ b/dyn_load.c
@@ -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/extra/gc.c b/extra/gc.c
index 8e2446a2..4f907a8a 100644
--- a/extra/gc.c
+++ b/extra/gc.c
@@ -67,8 +67,12 @@
#include "../darwin_stop_world.c"
#include "../dyn_load.c"
#include "../gc_dlopen.c"
-#include "../mach_dep.c"
-#include "../pthread_stop_world.c"
+#if !defined(PLATFORM_MACH_DEP)
+# include "../mach_dep.c"
+#endif
+#if !defined(PLATFORM_STOP_WORLD)
+# include "../pthread_stop_world.c"
+#endif
#include "../pthread_support.c"
#include "../specific.c"
#include "../win32_threads.c"
diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h
index 2e03f1a2..129daecd 100644
--- a/include/gc_config_macros.h
+++ b/include/gc_config_macros.h
@@ -91,8 +91,8 @@
# define GC_HPUX_THREADS
# elif defined(__HAIKU__)
# define GC_HAIKU_THREADS
-# elif defined(__DragonFly__) || defined(__FreeBSD_kernel__) \
- || (defined(__FreeBSD__) && !defined(SN_TARGET_ORBIS))
+# elif (defined(__DragonFly__) || defined(__FreeBSD_kernel__) \
+ || defined(__FreeBSD__)) && !defined(GC_NO_FREEBSD)
# 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 4e2a920d..38a5b099 100644
--- a/include/private/gc_locks.h
+++ b/include/private/gc_locks.h
@@ -53,7 +53,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(BASE_ATOMIC_OPS_EMULATED) \
|| defined(LINT2)) && defined(GC_PTHREADS)
# define USE_PTHREAD_LOCKS
diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h
index eddf46cf..544a8fe1 100644
--- a/include/private/gc_priv.h
+++ b/include/private/gc_priv.h
@@ -920,7 +920,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 64 KB */
# else
# define CPP_LOG_HBLKSIZE 12
diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h
index 9088982f..f6da9382 100644
--- a/include/private/gcconfig.h
+++ b/include/private/gcconfig.h
@@ -122,7 +122,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) /* Orbis compiler defines __FreeBSD__ */
# define FREEBSD
# endif
@@ -160,7 +160,7 @@ EXTERN_C_BEGIN
# elif !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \
&& !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \
&& !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \
- && !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,8 +481,7 @@ EXTERN_C_BEGIN
# define I386
# define mach_type_known
# endif
-# if (defined(FREEBSD) || defined(SN_TARGET_ORBIS)) \
- && (defined(__amd64__) || defined(__x86_64__))
+# if defined(FREEBSD) && (defined(__amd64__) || defined(__x86_64__))
# define X86_64
# define mach_type_known
# endif
@@ -2589,12 +2588,15 @@ EXTERN_C_BEGIN
# ifndef CACHE_LINE_SIZE
# define CACHE_LINE_SIZE 64
# endif
-# ifdef SN_TARGET_ORBIS
-# define OS_TYPE "SN_TARGET_ORBIS"
+# ifdef PLATFORM_GETMEM
+# define OS_TYPE "PLATFORM_GETMEM"
# define DATASTART (ptr_t)ALIGNMENT
# define DATAEND (ptr_t)ALIGNMENT
- void *ps4_get_stack_bottom(void);
-# define STACKBOTTOM ((ptr_t)ps4_get_stack_bottom())
+ EXTERN_C_END
+# include <pthread.h>
+ EXTERN_C_BEGIN
+ void *platform_get_stack_bottom(void);
+# define STACKBOTTOM ((ptr_t)platform_get_stack_bottom())
# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
@@ -3146,7 +3148,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
@@ -3334,7 +3336,7 @@ 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)) && defined(GC_THREADS))
# define THREADS
#endif
@@ -3427,8 +3429,8 @@ EXTERN_C_BEGIN
#endif
#if defined(CAN_HANDLE_FORK) && !defined(CAN_CALL_ATFORK) \
- && !defined(HURD) && !defined(SN_TARGET_ORBIS) && !defined(HOST_TIZEN) \
- && (!defined(HOST_ANDROID) || __ANDROID_API__ >= 21)
+ && !defined(GC_NO_CAN_CALL_ATFORK) && !defined(HOST_TIZEN) \
+ && !defined(HURD) && (!defined(HOST_ANDROID) || __ANDROID_API__ >= 21)
/* Have working pthread_atfork(). */
# define CAN_CALL_ATFORK
#endif
@@ -3664,9 +3666,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)
diff --git a/include/private/pthread_stop_world.h b/include/private/pthread_stop_world.h
index 4192737e..3229bc44 100644
--- a/include/private/pthread_stop_world.h
+++ b/include/private/pthread_stop_world.h
@@ -22,7 +22,7 @@ EXTERN_C_BEGIN
struct thread_stop_info {
# if !defined(GC_OPENBSD_UTHREADS) && !defined(NACL) \
- && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2)
+ && !defined(PLATFORM_STOP_WORLD) && !defined(SN_TARGET_PSP2)
volatile AO_t last_stop_count;
/* The value of GC_stop_count when the thread */
/* last successfully handled a suspend signal. */
@@ -44,9 +44,8 @@ struct thread_stop_info {
# define NACL_GC_REG_STORAGE_SIZE 20
# endif
ptr_t reg_storage[NACL_GC_REG_STORAGE_SIZE];
-# elif defined(SN_TARGET_ORBIS)
-# define ORBIS_GC_REG_STORAGE_SIZE 27
- word registers[ORBIS_GC_REG_STORAGE_SIZE]; /* used externally */
+# elif defined(PLATFORM_HAVE_GC_REG_STORAGE_SIZE)
+ word registers[PLATFORM_GC_REG_STORAGE_SIZE]; /* used externally */
# endif
};
diff --git a/mach_dep.c b/mach_dep.c
index 0e221d64..18750f5d 100644
--- a/mach_dep.c
+++ b/mach_dep.c
@@ -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>
@@ -339,4 +339,4 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *),
GC_noop1(COVERT_DATAFLOW(&dummy));
}
-#endif /* !SN_TARGET_ORBIS && !SN_TARGET_PSP2 */
+#endif /* !PLATFORM_MACH_DEP && !SN_TARGET_PSP2 */
diff --git a/misc.c b/misc.c
index b14293f8..cc8c306b 100644
--- a/misc.c
+++ b/misc.c
@@ -49,7 +49,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_DEFN_ALLOCATE_ML) || defined(SN_TARGET_PS3)
# include <pthread.h>
GC_INNER pthread_mutex_t GC_allocate_ml;
# endif
@@ -1729,7 +1729,7 @@ GC_API void GC_CALL GC_enable_incremental(void)
#else
-# if !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PSP2)
+# if !defined(GC_NO_TYPES) && !defined(SN_TARGET_PSP2)
# if !defined(AMIGA) && !defined(MSWIN32) && !defined(MSWIN_XBOX1) \
&& !defined(__CC_ARM)
# include <unistd.h>
@@ -1737,11 +1737,11 @@ GC_API void GC_CALL GC_enable_incremental(void)
# if !defined(ECOS) && !defined(NOSYS)
# include <errno.h>
# endif
-# endif /* !SN_TARGET_ORBIS && !SN_TARGET_PSP2 */
+# endif /* !GC_NO_TYPES && !SN_TARGET_PSP2 */
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. */
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 1cee6a0b..420ae97d 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -19,7 +19,7 @@
#include "private/pthread_support.h"
#if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \
- !defined(GC_DARWIN_THREADS) && !defined(SN_TARGET_ORBIS) \
+ !defined(GC_DARWIN_THREADS) && !defined(PLATFORM_STOP_WORLD) \
&& !defined(SN_TARGET_PSP2)
#ifdef NACL