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.
This commit is contained in:
ivmai
2010-12-26 17:12:55 +00:00
committed by Ivan Maidanski
parent 1c76fc46d5
commit ce1f87461b
5 changed files with 72 additions and 13 deletions
+16
View File
@@ -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.
+5
View File
@@ -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 <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>
+15 -1
View File
@@ -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)
+20 -8
View File
@@ -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
+16 -4
View File
@@ -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 */