]> granicus.if.org Git - gc/commitdiff
2010-12-26 Ivan Maidanski <ivmai@mail.ru> (mostly really Miguel de Icaza)
authorivmai <ivmai>
Sun, 26 Dec 2010 17:12:55 +0000 (17:12 +0000)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 26 Jul 2011 17:06:55 +0000 (21:06 +0400)
* 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.

ChangeLog
include/private/gc_locks.h
include/private/gcconfig.h
misc.c
os_dep.c

index db09a9c01f775c0ad6a27940729161e4a07b9cd6..028175301729869b9f8b64686a081d9ed24f0fbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+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.
index dd2838bbee7dacd363392533508fe6bdc113134e..3b0d1c3a2627111efd6a7fad75080b8f86ee83ac 100644 (file)
                            || 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>
 
index d85053bd535d27208b70d3d34cf0e9b8da87f9b2..401d58b782c92c784230f53f7b7ce50a9968e7fc 100644 (file)
 #     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)
diff --git a/misc.c b/misc.c
index e31386ee8a58c5ee37308774cdbb0c77e3e6677c..edd8f7f0e842a63f659552e4c114a08e043cd148 100644 (file)
--- a/misc.c
+++ b/misc.c
 # 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
index 9205b9b64f5bb9e353f1d2d9fe94cb4ad3113a67..3a66831c5b74f7cad1298c72105e88bb7b58f205 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -55,7 +55,7 @@
 #endif
 
 #include <stdio.h>
-#if defined(MSWINCE)
+#if defined(MSWINCE) || defined(SN_TARGET_PS3)
 # define SIGSEGV 0 /* value is irrelevant */
 #else
 # include <signal.h>
@@ -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 */