summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorivmai <ivmai>2010-12-26 18:12:55 +0100
committerIvan Maidanski <ivmai@mail.ru>2011-07-26 19:06:55 +0200
commitce1f87461b04c05f8502b502e387dd1130e7830c (patch)
tree7f18a439cd406c71b312658d3432627746bb507f /misc.c
parent1c76fc46d5d0894a34a8c31dced57087cca90611 (diff)
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.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/misc.c b/misc.c
index e31386e..edd8f7f 100644
--- a/misc.c
+++ b/misc.c
@@ -44,12 +44,17 @@
# 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 */
@@ -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