(part of commit
9379c66 from Unity-Technologies/bdwgc)
Issue #173 (bdwgc).
* alloc.c [!MACOS && !MSWINCE && !__CC_ARM]: Do not include
sys/types.h if SN_TARGET_ORBIS.
* dyn_load.c [!MACOS && !_WIN32_WCE && !__CC_ARM]: Likewise.
* include/gc_config_macros.h [SN_TARGET_ORBIS] (GC_THREADS): Define.
* include/gc_config_macros.h [__FreeBSD__] (GC_FREEBSD_THREADS): Do
not define if SN_TARGET_ORBIS.
* include/private/gcconfig.h [__FreeBSD__ || __DragonFly__
|| __FreeBSD_kernel__] (FREEBSD): Likewise.
* include/private/gcconfig.h [!LINUX && !NETBSD && !FREEBSD
&& !OPENBSD && !DARWIN && !_WIN32 && !__CEGCC__ && !NN_PLATFORM_CTR
!NN_BUILD_TARGET_PLATFORM_NX && !SYMBIAN] (NOSYS): Likewise.
* include/private/gc_locks.h [THREADS && GC_PTHREADS
&& !GC_WIN32_THREADS]: Do not include gc_atomic_ops.h if
SN_TARGET_ORBIS.
* include/private/gc_locks.h [SN_TARGET_ORBIS && GC_PTHREADS]
(USE_PTHREAD_LOCKS): Define.
* include/private/gc_priv.h [SN_TARGET_ORBIS] (CPP_LOG_HBLKSIZE):
Define to 16 (instead of 12).
* include/private/gcconfig.h [SN_TARGET_ORBIS && (__amd64__
|| __x86_64__)] (X86_64): Define.
* include/private/gcconfig.h [X86_64] (CACHE_LINE_SIZE): Do not define
if already defined.
* include/private/gcconfig.h [X86_64 && SN_TARGET_ORBIS] (DATASTART,
DATAEND, STACKBOTTOM): Define.
* include/private/gcconfig.h [X86_64 && SN_TARGET_ORBIS]: Include
pthread.h.
* include/private/gcconfig.h [X86_64 && SN_TARGET_ORBIS]
(ps4_get_stack_bottom): Declare.
* include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD
&& SN_TARGET_ORBIS] (MUNMAP_THRESHOLD): Define to 2.
* include/private/gcconfig.h [SN_TARGET_ORBIS] (THREADS): Define.
* pthread_support.c: Do not include sys/mman.h, sys/time.h,
sys/types.h, fcntl.h if SN_TARGET_ORBIS.
* pthread_support.c (GC_pthread_join, GC_pthread_detach,
GC_pthread_create): Do not define if SN_TARGET_ORBIS.
#include <stdio.h>
#if !defined(MACOS) && !defined(MSWINCE)
# include <signal.h>
-# if !defined(__CC_ARM)
+# if !defined(__CC_ARM) && !defined(SN_TARGET_ORBIS)
# include <sys/types.h>
# endif
#endif
* But then not much of anything is safe in the presence of dlclose.
*/
-#if !defined(MACOS) && !defined(_WIN32_WCE) && !defined(__CC_ARM)
+#if !defined(MACOS) && !defined(SN_TARGET_ORBIS) && !defined(_WIN32_WCE) \
+ && !defined(__CC_ARM)
# include <sys/types.h>
#endif
|| defined(GC_IRIX_THREADS) || defined(GC_LINUX_THREADS) \
|| 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(GC_WIN32_THREADS) || defined(GC_RTEMS_PTHREADS) \
+ || defined(SN_TARGET_ORBIS)
# ifndef GC_THREADS
# define GC_THREADS
# endif
# define GC_HAIKU_THREADS
# elif defined(__OpenBSD__)
# define GC_OPENBSD_THREADS
-# elif defined(__FreeBSD__) || defined(__DragonFly__)
+# elif (defined(__FreeBSD__) && !defined(SN_TARGET_ORBIS)) \
+ || defined(__DragonFly__)
# define GC_FREEBSD_THREADS
# elif defined(__NetBSD__)
# define GC_NETBSD_THREADS
*/
# ifdef THREADS
-# if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS)
+# if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) \
+ && !defined(SN_TARGET_ORBIS)
# include "gc_atomic_ops.h"
# endif
# endif
# if (!defined(AO_HAVE_test_and_set_acquire) || defined(GC_RTEMS_PTHREADS) \
- || defined(SN_TARGET_PS3) || defined(GC_WIN32_THREADS) \
- || defined(LINT2)) && defined(GC_PTHREADS)
+ || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3) \
+ || defined(GC_WIN32_THREADS) || defined(LINT2)) && defined(GC_PTHREADS)
# define USE_PTHREAD_LOCKS
# undef USE_SPIN_LOCK
# endif
# if defined(LARGE_CONFIG) || !defined(SMALL_CONFIG)
# ifdef ALPHA
# define CPP_LOG_HBLKSIZE 13
+# elif defined(SN_TARGET_ORBIS)
+# define CPP_LOG_HBLKSIZE 16 /* page size is set to 64K */
# else
# define CPP_LOG_HBLKSIZE 12
# endif
/* And one for FreeBSD: */
# if (defined(__FreeBSD__) || defined(__DragonFly__) \
- || defined(__FreeBSD_kernel__)) && !defined(FREEBSD)
-# define FREEBSD
+ || defined(__FreeBSD_kernel__)) && !defined(FREEBSD) \
+ && !defined(SN_TARGET_ORBIS) /* Orbis compiler defines __FreeBSD__ */
+# define FREEBSD
# endif
/* And one for Darwin: */
# elif !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \
&& !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \
&& !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \
- && !defined(NN_BUILD_TARGET_PLATFORM_NX) && !defined(SYMBIAN)
+ && !defined(NN_BUILD_TARGET_PLATFORM_NX) \
+ && !defined(SN_TARGET_ORBIS) && !defined(SYMBIAN)
# define NOSYS
# define mach_type_known
# endif
# define I386
# define mach_type_known
# endif
-# if defined(FREEBSD) && (defined(__amd64__) || defined(__x86_64__))
+# if (defined(FREEBSD) || defined(SN_TARGET_ORBIS)) \
+ && (defined(__amd64__) || defined(__x86_64__))
# define X86_64
# define mach_type_known
# endif
# ifndef HBLKSIZE
# define HBLKSIZE 4096
# endif
-# define CACHE_LINE_SIZE 64
+# ifndef CACHE_LINE_SIZE
+# define CACHE_LINE_SIZE 64
+# endif
+# ifdef SN_TARGET_ORBIS
+# define DATASTART (ptr_t)ALIGNMENT
+# define DATAEND (ptr_t)ALIGNMENT
+# include <pthread.h>
+ void *ps4_get_stack_bottom(void);
+# define STACKBOTTOM ((ptr_t)ps4_get_stack_bottom())
+# endif
# ifdef OPENBSD
# define OS_TYPE "OPENBSD"
# define ELF_CLASS ELFCLASS64
/* 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_PS3)
+ && (defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3))
# define MUNMAP_THRESHOLD 2
#endif
#if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) \
|| defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) \
- || defined(SN_TARGET_PS3)
+ || defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3)
# define THREADS
#endif
#endif
#if defined(CAN_HANDLE_FORK) && !defined(CAN_CALL_ATFORK) \
- && !defined(HURD) && !defined(HOST_TIZEN) \
+ && !defined(HURD) && !defined(SN_TARGET_ORBIS) && !defined(HOST_TIZEN) \
&& (!defined(HOST_ANDROID) || __ANDROID_API__ >= 21)
/* Have working pthread_atfork(). */
# define CAN_CALL_ATFORK
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(SN_TARGET_PS3)
void *ps3_get_mem(size_t bytes);
# define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes)
#include "private/gc_priv.h"
+#if !defined(SN_TARGET_ORBIS)
+
#include <stdio.h>
#ifdef AMIGA
/* contents before we get a chance to look at them. */
GC_noop1((word)(&dummy));
}
+
+#endif /* !SN_TARGET_ORBIS */
# ifdef PCR
# include "il/PCR_IL.h"
GC_INNER PCR_Th_ML GC_allocate_ml;
-# elif defined(SN_TARGET_PS3)
+# elif defined(SN_TARGET_ORBIS) || defined(SN_TARGET_PS3)
# include <pthread.h>
GC_INNER pthread_mutex_t GC_allocate_ml;
# endif
# define WRITE(level, buf, len) switch_log_write(buf, len)
#else
-# if !defined(AMIGA) && !defined(__CC_ARM)
+# if !defined(AMIGA) && !defined(SN_TARGET_ORBIS) && !defined(__CC_ARM)
# include <unistd.h>
# endif
STATIC int GC_write(int fd, const char *buf, size_t len)
{
-# if defined(ECOS) || defined(NOSYS)
+# if defined(ECOS) || defined(SN_TARGET_ORBIS) || defined(NOSYS)
# ifdef ECOS
/* FIXME: This seems to be defined nowhere at present. */
/* _Jv_diag_write(buf, len); */
#include "private/gc_priv.h"
#if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS) \
- && !defined(MSWINCE) && !defined(__CC_ARM)
+ && !defined(MSWINCE) && !defined(SN_TARGET_ORBIS) && !defined(__CC_ARM)
# include <sys/types.h>
# if !defined(MSWIN32)
# include <unistd.h>
# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) \
&& !defined(USE_WINALLOC) && !defined(MACOS) && !defined(DOS4GW) \
&& !defined(NINTENDO_SWITCH) && !defined(NONSTOP) \
- && !defined(SN_TARGET_PS3) && !defined(RTEMS) && !defined(__CC_ARM)
+ && !defined(SN_TARGET_ORBIS) && !defined(SN_TARGET_PS3) \
+ && !defined(RTEMS) && !defined(__CC_ARM)
# define SBRK_ARG_T ptrdiff_t
#include "private/pthread_support.h"
#if defined(GC_PTHREADS) && !defined(GC_WIN32_THREADS) && \
- !defined(GC_DARWIN_THREADS)
+ !defined(GC_DARWIN_THREADS) && !defined(SN_TARGET_ORBIS)
#ifdef NACL
# include <time.h>
# include <errno.h>
# include <unistd.h>
-# if !defined(GC_RTEMS_PTHREADS)
-# include <sys/mman.h>
+# if !defined(SN_TARGET_ORBIS)
+# if !defined(GC_RTEMS_PTHREADS)
+# include <sys/mman.h>
+# endif
+# include <sys/time.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
# endif
-# include <sys/time.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <fcntl.h>
# include <signal.h>
# include "gc_inline.h"
UNLOCK();
}
-GC_API int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval)
-{
+#if !defined(SN_TARGET_ORBIS)
+ GC_API int WRAP_FUNC(pthread_join)(pthread_t thread, void **retval)
+ {
int result;
GC_thread t;
DCL_LOCK_STATE;
UNLOCK();
}
return result;
-}
+ }
-GC_API int WRAP_FUNC(pthread_detach)(pthread_t thread)
-{
+ GC_API int WRAP_FUNC(pthread_detach)(pthread_t thread)
+ {
int result;
GC_thread t;
DCL_LOCK_STATE;
UNLOCK();
}
return result;
-}
+ }
+#endif /* !SN_TARGET_ORBIS */
#ifndef GC_NO_PTHREAD_CANCEL
/* We should deal with the fact that apparently on Solaris and, */
# endif
}
-GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread,
- GC_PTHREAD_CREATE_CONST pthread_attr_t *attr,
- void *(*start_routine)(void *), void *arg)
-{
+#if !defined(SN_TARGET_ORBIS)
+ GC_API int WRAP_FUNC(pthread_create)(pthread_t *new_thread,
+ GC_PTHREAD_CREATE_CONST pthread_attr_t *attr,
+ void *(*start_routine)(void *), void *arg)
+ {
int result;
int detachstate;
word my_flags = 0;
UNLOCK();
return(result);
-}
+ }
+#endif /* !SN_TARGET_ORBIS */
#if defined(USE_SPIN_LOCK) || !defined(NO_PTHREAD_TRYLOCK)
/* Spend a few cycles in a way that can't introduce contention with */