From 541151996c2ec4b2168538796f3516a31279b806 Mon Sep 17 00:00:00 2001 From: hboehm Date: Sat, 11 Feb 2006 02:27:31 +0000 Subject: [PATCH] 2006-02-10 Hans Boehm * powerpc_darwin_mach_dep.s: Add ppc64 support (imported from gcc). * darwin_stop_world.c, misc.c, doc/README.changes, include/private/gc_priv.h, include/private/gcconfig.h: minor updates from gcc. --- darwin_stop_world.c | 2 ++ doc/README.changes | 2 ++ include/private/gc_priv.h | 14 +++----------- include/private/gcconfig.h | 2 +- misc.c | 5 +++-- powerpc_darwin_mach_dep.s | 20 +++++++++++++++----- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/darwin_stop_world.c b/darwin_stop_world.c index 87484cc8..f49a22b9 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -1,5 +1,7 @@ #include "private/pthread_support.h" +/* This probably needs more porting work to ppc64. */ + # if defined(GC_DARWIN_THREADS) /* From "Inside Mac OS X - Mach-O Runtime Architecture" published by Apple diff --git a/doc/README.changes b/doc/README.changes index 1474c952..bf26df47 100644 --- a/doc/README.changes +++ b/doc/README.changes @@ -2261,6 +2261,8 @@ Since 6.6: (Thanks to Andreas Tobler.) - Add support for Darwin/X86. (Thanks to Geoff Norton and the Mono developers.) + - Merge in some recent gcc fixes. Add ppc64 asm code. (Thanks to Bryce + McKinley and other gcj developers.) Since gc6.7: - Remove GC_PROTO, VOLATILE, GC_PTR, and GC_CONST. Assume ANSI C compiler diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 9ea778bf..fec8e08f 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -721,17 +721,9 @@ struct hblk { # ifdef LARGE_CONFIG # define MAX_ROOT_SETS 4096 # else -# ifdef PCR -# define MAX_ROOT_SETS 1024 -# else -# if defined(MSWIN32) || defined(MSWINCE) -# define MAX_ROOT_SETS 1024 - /* Under NT, we add only written pages, which can result */ - /* in many small root sets. */ -# else -# define MAX_ROOT_SETS 256 -# endif -# endif + /* GCJ LOCAL: MAX_ROOT_SETS increased to permit more shared */ + /* libraries to be loaded. */ +# define MAX_ROOT_SETS 1024 # endif # define MAX_EXCLUSIONS (MAX_ROOT_SETS/4) diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index 6f356515..efa364c2 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -1362,8 +1362,8 @@ # define DATAEND /* not needed */ # endif # if defined(NETBSD) -# define ALIGNMENT 4 # define OS_TYPE "NETBSD" +# define ALIGNMENT 4 # define HEURISTIC2 # ifdef __ELF__ extern int etext[]; diff --git a/misc.c b/misc.c index e5309797..daebd9b4 100644 --- a/misc.c +++ b/misc.c @@ -410,8 +410,9 @@ void GC_init(void) BOOL (WINAPI *pfn) (LPCRITICAL_SECTION, DWORD) = NULL; HMODULE hK32 = GetModuleHandleA("kernel32.dll"); if (hK32) - (FARPROC) pfn = GetProcAddress(hK32, - "InitializeCriticalSectionAndSpinCount"); + pfn = (BOOL (WINAPI *) (LPCRITICAL_SECTION, DWORD)) + GetProcAddress (hK32, + "InitializeCriticalSectionAndSpinCount"); if (pfn) pfn(&GC_allocate_ml, 4000); else diff --git a/powerpc_darwin_mach_dep.s b/powerpc_darwin_mach_dep.s index fd23110b..1121ee89 100644 --- a/powerpc_darwin_mach_dep.s +++ b/powerpc_darwin_mach_dep.s @@ -1,10 +1,21 @@ +#if defined(__ppc64__) +#define MODE_CHOICE(x, y) y +#else +#define MODE_CHOICE(x, y) x +#endif + +#define lgu MODE_CHOICE(lwzu, ldu) + +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ ; GC_push_regs function. Under some optimization levels GCC will clobber ; some of the non-volatile registers before we get a chance to save them ; therefore, this cannot be inline asm. .text - .align 2 + .align LOG2_GPR_BYTES .globl _GC_push_regs _GC_push_regs: @@ -65,7 +76,7 @@ _GC_push_regs: .data .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 - .align 2 + .align LOG2_GPR_BYTES L_GC_push_one$stub: .indirect_symbol _GC_push_one mflr r0 @@ -74,12 +85,11 @@ L0$_GC_push_one: mflr r11 addis r11,r11,ha16(L_GC_push_one$lazy_ptr-L0$_GC_push_one) mtlr r0 - lwzu r12,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)(r11) + lgu r12,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)(r11) mtctr r12 bctr .data .lazy_symbol_pointer L_GC_push_one$lazy_ptr: .indirect_symbol _GC_push_one - .long dyld_stub_binding_helper - + .g_long dyld_stub_binding_helper -- 2.40.0