* misc.c (GC_allocate_ml): Define global variable if SN_TARGET_PS3.
* misc.c (GC_init): Initialize GC_allocate_ml if SN_TARGET_PS3.
* os_dep.c (SIGSEGV): Define to dummy zero if SN_TARGET_PS3.
* os_dep.c (GC_unix_mmap_get_mem): Don't define if SN_TARGET_PS3.
* os_dep.c (GC_default_push_other_roots,
GC_push_thread_structures): Define for SN_TARGET_PS3.
* include/private/gc_locks.h (GC_allocate_ml, LOCK, UNLOCK): Define
for SN_TARGET_PS3.
* include/private/gcconfig.h (SN_TARGET_PS3): Recognize new macro
(Sony PS/3 target).
* include/private/gcconfig.h (THREADS): Define unconditionally if
SN_TARGET_PS3.
* include/private/gcconfig.h (GET_MEM): Define for SN_TARGET_PS3.
+2010-12-26 Ivan Maidanski <ivmai@mail.ru> (mostly really Miguel de Icaza)
+
+ * misc.c (GC_allocate_ml): Define global variable if SN_TARGET_PS3.
+ * misc.c (GC_init): Initialize GC_allocate_ml if SN_TARGET_PS3.
+ * os_dep.c (SIGSEGV): Define to dummy zero if SN_TARGET_PS3.
+ * os_dep.c (GC_unix_mmap_get_mem): Don't define if SN_TARGET_PS3.
+ * os_dep.c (GC_default_push_other_roots,
+ GC_push_thread_structures): Define for SN_TARGET_PS3.
+ * include/private/gc_locks.h (GC_allocate_ml, LOCK, UNLOCK): Define
+ for SN_TARGET_PS3.
+ * include/private/gcconfig.h (SN_TARGET_PS3): Recognize new macro
+ (Sony PS/3 target).
+ * include/private/gcconfig.h (THREADS): Define unconditionally if
+ SN_TARGET_PS3.
+ * include/private/gcconfig.h (GET_MEM): Define for SN_TARGET_PS3.
+
2010-12-26 Ivan Maidanski <ivmai@mail.ru>
* alloc.c (GC_collect_or_expand): Replace NIL with NULL in message.
|| GC_lock_holder == GetCurrentThreadId())
# define I_DONT_HOLD_LOCK() (!GC_need_to_lock \
|| GC_lock_holder != GetCurrentThreadId())
+# elif defined(SN_TARGET_PS3)
+# include <pthread.h>
+ GC_EXTERN pthread_mutex_t GC_allocate_ml;
+# define LOCK() pthread_mutex_lock(&GC_allocate_ml)
+# define UNLOCK() pthread_mutex_unlock(&GC_allocate_ml)
# elif defined(GC_PTHREADS)
# include <pthread.h>
# define DATASTART GC_data_start
# define DYNAMIC_LOADING
# endif
+# ifdef SN_TARGET_PS3
+# define NO_GETENV
+# define CPP_WORDSZ 32
+# define ALIGNMENT 4
+ extern int _end [];
+ extern int __bss_start;
+# define DATAEND (ptr_t)(_end)
+# define DATASTART (ptr_t)(__bss_start)
+# define STACKBOTTOM ((ptr_t)ps3_get_stack_bottom())
+# endif
# ifdef AIX
# define OS_TYPE "AIX"
# undef ALIGNMENT /* in case it's defined */
--> inconsistent configuration
# endif
-# if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS)
+# if defined(PCR) || defined(GC_WIN32_THREADS) || defined(GC_PTHREADS) \
+ || defined(SN_TARGET_PS3)
# define THREADS
# endif
# define GET_MEM(bytes) HBLKPTR((size_t) \
GC_amiga_get_mem((size_t)bytes + GC_page_size) \
+ GC_page_size-1)
+# elif defined(SN_TARGET_PS3)
+ void *ps3_get_mem(size_t size);
+# define GET_MEM(bytes) (struct hblk*)ps3_get_mem(bytes)
# else
ptr_t GC_unix_get_mem(GC_word bytes);
# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes)
# include <floss.h>
#endif
-#if defined(THREADS) && defined(PCR)
-# include "il/PCR_IL.h"
- GC_INNER PCR_Th_ML GC_allocate_ml;
-#endif
-/* For other platforms with threads, the lock and possibly */
-/* GC_lock_holder variables are defined in the thread support code. */
+#ifdef THREADS
+# ifdef PCR
+# include "il/PCR_IL.h"
+ GC_INNER PCR_Th_ML GC_allocate_ml;
+# elif defined(SN_TARGET_PS3)
+# include <pthread.h>
+ GC_INNER pthread_mutex_t GC_allocate_ml;
+# endif
+ /* For other platforms with threads, the lock and possibly */
+ /* GC_lock_holder variables are defined in the thread support code. */
+#endif /* THREADS */
#ifdef DYNAMIC_LOADING
/* We need to register the main data segment. Returns TRUE unless */
# if !defined(THREADS) && defined(GC_ASSERTIONS)
word dummy;
# endif
-
# ifdef GC_INITIAL_HEAP_SIZE
word initial_heap_sz = divHBLKSZ(GC_INITIAL_HEAP_SIZE);
# else
/* in fact safely initialize them here. */
# ifdef THREADS
GC_ASSERT(!GC_need_to_lock);
-# endif
+# ifdef SN_TARGET_PS3
+ {
+ pthread_mutexattr_t mattr;
+ pthread_mutexattr_init(&mattr);
+ pthread_mutex_init(&GC_allocate_ml, &mattr);
+ pthread_mutexattr_destroy(&mattr);
+ }
+# endif
+# endif /* THREADS */
# if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS)
{
# ifndef MSWINCE
#endif
#include <stdio.h>
-#if defined(MSWINCE)
+#if defined(MSWINCE) || defined(SN_TARGET_PS3)
# define SIGSEGV 0 /* value is irrelevant */
#else
# include <signal.h>
* Auxiliary routines for obtaining memory from OS.
*/
-# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) \
- && !defined(MSWIN32) && !defined(MSWINCE) \
- && !defined(MACOS) && !defined(DOS4GW) && !defined(NONSTOP)
+# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MSWIN32) \
+ && !defined(MSWINCE) && !defined(MACOS) && !defined(DOS4GW) \
+ && !defined(NONSTOP) && !defined(SN_TARGET_PS3)
# define SBRK_ARG_T ptrdiff_t
# endif /* GC_WIN32_THREADS || GC_PTHREADS */
+# ifdef SN_TARGET_PS3
+ STATIC void GC_default_push_other_roots(void)
+ {
+ ABORT("GC_default_push_other_roots is not implemented\n");
+ }
+
+ void GC_push_thread_structures(void)
+ {
+ ABORT("GC_push_thread_structures is not implemented\n");
+ }
+# endif /* SN_TARGET_PS3 */
+
GC_INNER void (*GC_push_other_roots)(void) = GC_default_push_other_roots;
#endif /* THREADS */