X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=libgc%2Fmisc.c;h=5b2868d808b691d90fd521f01e6b28757f5c86f9;hb=8e1b1dc60931c2cb309cf446c98f9ab7451ea7d9;hp=5b10feeb961faa9badb793eae3b4659ed24cab5c;hpb=234225d112c4b018b8d1796f4c06a15812137500;p=mono.git diff --git a/libgc/misc.c b/libgc/misc.c index 5b10feeb961..5b2868d808b 100644 --- a/libgc/misc.c +++ b/libgc/misc.c @@ -64,7 +64,10 @@ /* Used only for assertions, and to prevent */ /* recursive reentry in the system call wrapper. */ # endif -# else +# elif defined(SN_TARGET_PS3) + #include + pthread_mutex_t GC_allocate_ml; +# else --> declare allocator lock here # endif # endif @@ -81,6 +84,8 @@ /* dyn_load.c isn't linked in. */ #ifdef DYNAMIC_LOADING # define GC_REGISTER_MAIN_STATIC_DATA() GC_register_main_static_data() +#elif defined(GC_DONT_REGISTER_MAIN_STATIC_DATA) +# define GC_REGISTER_MAIN_STATIC_DATA() FALSE #else # define GC_REGISTER_MAIN_STATIC_DATA() TRUE #endif @@ -246,7 +251,7 @@ void *arg2; byte_sz = WORDS_TO_BYTES(word_sz); if (GC_all_interior_pointers) { /* We need one extra byte; don't fill in GC_size_map[byte_sz] */ - byte_sz--; + byte_sz -= EXTRA_BYTES; } for (j = low_limit; j <= byte_sz; j++) GC_size_map[j] = word_sz; @@ -466,10 +471,23 @@ size_t GC_get_total_bytes GC_PROTO(()) return ((size_t) WORDS_TO_BYTES(GC_words_allocd+GC_words_allocd_before_gc)); } +int GC_get_suspend_signal GC_PROTO(()) +{ +#if defined(SIG_SUSPEND) && defined(GC_PTHREADS) && !defined(GC_MACOSX_THREADS) && !defined(GC_OPENBSD_THREADS) + return SIG_SUSPEND; +#else + return -1; +#endif +} + GC_bool GC_is_initialized = FALSE; void GC_init() { +#if defined(SN_TARGET_PS3) + pthread_mutexattr_t mattr; +#endif + DCL_LOCK_STATE; DISABLE_SIGNALS(); @@ -477,9 +495,9 @@ void GC_init() #if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) if (!GC_is_initialized) { BOOL (WINAPI *pfn) (LPCRITICAL_SECTION, DWORD) = NULL; - HMODULE hK32 = GetModuleHandle("kernel32.dll"); + HMODULE hK32 = GetModuleHandle(_T("kernel32.dll")); if (hK32) - (FARPROC) pfn = GetProcAddress(hK32, + pfn = GetProcAddress(hK32, "InitializeCriticalSectionAndSpinCount"); if (pfn) pfn(&GC_allocate_ml, 4000); @@ -487,6 +505,13 @@ void GC_init() InitializeCriticalSection (&GC_allocate_ml); } #endif /* MSWIN32 */ +#if defined(SN_TARGET_PS3) + pthread_mutexattr_init (&mattr); + + pthread_mutex_init (&GC_allocate_ml, &mattr); + pthread_mutexattr_destroy (&mattr); + +#endif LOCK(); GC_init_inner(); @@ -659,7 +684,7 @@ void GC_init_inner() # if defined(SEARCH_FOR_DATA_START) GC_init_linux_data_start(); # endif -# if (defined(NETBSD) || defined(OPENBSD)) && defined(__ELF__) +# if defined(NETBSD) && defined(__ELF__) GC_init_netbsd_elf(); # endif # if defined(GC_PTHREADS) || defined(GC_SOLARIS_THREADS) \ @@ -804,7 +829,10 @@ void GC_init_inner() void GC_enable_incremental GC_PROTO(()) { -# if !defined(SMALL_CONFIG) +# if !defined(SMALL_CONFIG) && !defined(KEEP_BACK_PTRS) + /* If we are keeping back pointers, the GC itself dirties all */ + /* pages on which objects have been marked, making */ + /* incremental GC pointless. */ if (!GC_find_leak) { DCL_LOCK_STATE;