From: ivmai Date: Sun, 26 Dec 2010 17:12:55 +0000 (+0000) Subject: 2010-12-26 Ivan Maidanski (mostly really Miguel de Icaza) X-Git-Tag: gc7_2alpha5-20110107~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce1f87461b04c05f8502b502e387dd1130e7830c;p=gc 2010-12-26 Ivan Maidanski (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. --- diff --git a/ChangeLog b/ChangeLog index db09a9c0..02817530 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2010-12-26 Ivan Maidanski (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 * alloc.c (GC_collect_or_expand): Replace NIL with NULL in message. diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index dd2838bb..3b0d1c3a 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -73,6 +73,11 @@ || GC_lock_holder == GetCurrentThreadId()) # define I_DONT_HOLD_LOCK() (!GC_need_to_lock \ || GC_lock_holder != GetCurrentThreadId()) +# elif defined(SN_TARGET_PS3) +# include + 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 diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index d85053bd..401d58b7 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -875,6 +875,16 @@ # 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 */ @@ -2422,7 +2432,8 @@ --> 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 @@ -2620,6 +2631,9 @@ # 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) diff --git a/misc.c b/misc.c index e31386ee..edd8f7f0 100644 --- a/misc.c +++ b/misc.c @@ -44,12 +44,17 @@ # include #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 + 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 */ @@ -631,7 +636,6 @@ GC_API void GC_CALL GC_init(void) # if !defined(THREADS) && defined(GC_ASSERTIONS) word dummy; # endif - # ifdef GC_INITIAL_HEAP_SIZE word initial_heap_sz = divHBLKSZ(GC_INITIAL_HEAP_SIZE); # else @@ -650,7 +654,15 @@ GC_API void GC_CALL GC_init(void) /* 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 diff --git a/os_dep.c b/os_dep.c index 9205b9b6..3a66831c 100644 --- a/os_dep.c +++ b/os_dep.c @@ -55,7 +55,7 @@ #endif #include -#if defined(MSWINCE) +#if defined(MSWINCE) || defined(SN_TARGET_PS3) # define SIGSEGV 0 /* value is irrelevant */ #else # include @@ -1993,9 +1993,9 @@ void GC_register_data_segments(void) * 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 @@ -2563,6 +2563,18 @@ STATIC void GC_default_push_other_roots(void) # 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 */