This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [RFA] boehm-gc for AIX
- From: "Boehm, Hans" <hans_boehm at hp dot com>
- To: "'David Edelsohn'" <dje at watson dot ibm dot com>, hboehm at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 24 Jan 2002 16:05:36 -0800
- Subject: RE: [RFA] boehm-gc for AIX
This looks good to me. Thanks. If you don't mind, I'll also add it to my
version, to keep things in sync.
If libgcj is a dynamic library, and you call GC_INIT() from there, that
still won't do the job, right? You still won't get the main programs data
segment? Or did I misunderstand what's going on here? (Even if I'm right,
it seems to me that the patch improves matters, so it still makes sense to
check it in. But it would be nice if there were some way to find the main
data segment from a dynamic library.)
Hans
> -----Original Message-----
> From: David Edelsohn [mailto:dje@watson.ibm.com]
> Sent: Saturday, January 19, 2002 4:52 PM
> To: hboehm@gcc.gnu.org
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [RFA] boehm-gc for AIX
>
>
> The appended patches get the Boehm Garbage Collector into a
> working state on AIX.
>
> rs6000_mach_dep.s isn't used because of
> USE_GENERIC_PUSH_REGS, but
> we might aw well distribute correct code.
>
> The main problem was the assumption that program data begins at
> 0x20000000 and ends at &end. When the garbage collector is a shared
> library, it has it's own address space and symbol space. &end is
> uninitialized in a shared library and defaults to -1. This
> was causing
> the collector to scan 0x20000000 through the end of the
> virtual address
> space. Also, the symbol _data is provided for the beginning
> of the data
> segment which may begin slightly past 0x20000000 due to the way it is
> mapped in from the executable.
>
> One could use the AIX -Wl,-G / -Wl,-brtl options to merge the
> symbols into the shared library, but it is better to avoid
> placing that
> limitation on the collector and instead use GC_INIT to pass
> the values to
> the collector.
>
> libjava needs to learn to call GC_INIT.
>
> David
>
>
> Index: rs6000_mach_dep.s
> ===================================================================
> RCS file: /cvs/gcc/egcs/boehm-gc/rs6000_mach_dep.s,v
> retrieving revision 1.3
> diff -c -p -r1.3 rs6000_mach_dep.s
> *** rs6000_mach_dep.s 2001/08/17 18:30:46 1.3
> --- rs6000_mach_dep.s 2002/01/20 00:35:01
> ***************
> *** 1,4 ****
> - .csect
> .set r0,0
> .set r1,1
> .set r2,2
> --- 1,3 ----
> ***************
> *** 32,41 ****
> .set r30,30
> .set r31,31
>
> # Mark from machine registers that are saved by C compiler
> .globl .GC_push_regs
> .GC_push_regs:
> - .extern .GC_push_one
> stu r1,-64(r1) # reserve stack frame
> mflr r0 # save link register
> st r0,0x48(r1)
> --- 31,48 ----
> .set r30,30
> .set r31,31
>
> + .extern .GC_push_one
> # Mark from machine registers that are saved by C compiler
> .globl .GC_push_regs
> + .csect .text[PR]
> + .align 2
> + .globl GC_push_regs
> + .globl .GC_push_regs
> + .csect GC_push_regs[DS]
> + GC_push_regs:
> + .long .GC_push_regs, TOC[tc0], 0
> + .csect .text[PR]
> .GC_push_regs:
> stu r1,-64(r1) # reserve stack frame
> mflr r0 # save link register
> st r0,0x48(r1)
> ***************
> *** 103,105 ****
> --- 110,114 ----
> mtlr r0
> ai r1,r1,64
> br
> + .long 0
> + .byte 0,0,0,0,0,0,0,0
> Index: include/gc.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/boehm-gc/include/gc.h,v
> retrieving revision 1.5
> diff -c -p -r1.5 gc.h
> *** gc.h 2001/10/23 00:28:56 1.5
> --- gc.h 2002/01/20 00:35:01
> *************** extern void GC_thr_init(); /* Needed for
> *** 888,894 ****
> # define GC_INIT() { extern end, etext; \
> GC_noop(&end, &etext); }
> #else
> ! # if defined(__CYGWIN32__) && defined(GC_USE_DLL)
> /*
> * Similarly gnu-win32 DLLs need explicit initialization
> */
> --- 888,894 ----
> # define GC_INIT() { extern end, etext; \
> GC_noop(&end, &etext); }
> #else
> ! # if (defined(__CYGWIN32__) && defined(GC_USE_DLL)) ||
> defined (_AIX)
> /*
> * Similarly gnu-win32 DLLs need explicit initialization
> */
> Index: include/private/gcconfig.h
> ===================================================================
> RCS file: /cvs/gcc/egcs/boehm-gc/include/private/gcconfig.h,v
> retrieving revision 1.8
> diff -c -p -r1.8 gcconfig.h
> *** gcconfig.h 2001/12/17 03:24:50 1.8
> --- gcconfig.h 2002/01/20 00:35:01
> ***************
> *** 1174,1183 ****
>
> # ifdef RS6000
> # define MACH_TYPE "RS6000"
> ! # define ALIGNMENT 4
> ! # define DATASTART ((ptr_t)0x20000000)
> extern int errno;
> # define STACKBOTTOM ((ptr_t)((ulong)&errno))
> # define DYNAMIC_LOADING
> /* For really old versions of AIX, this may have to be
> removed. */
> # endif
> --- 1174,1192 ----
>
> # ifdef RS6000
> # define MACH_TYPE "RS6000"
> ! # ifdef __64BIT__
> ! # define ALIGNMENT 8
> ! # define CPP_WORDSZ 64
> ! # else
> ! # define ALIGNMENT 4
> ! # define CPP_WORDSZ 32
> ! # endif
> ! extern long _data, _end;
> ! # define DATASTART ((ptr_t)((ulong)&_data))
> ! # define DATAEND ((ptr_t)((ulong)&_end))
> extern int errno;
> # define STACKBOTTOM ((ptr_t)((ulong)&errno))
> + # define USE_GENERIC_PUSH_REGS
> # define DYNAMIC_LOADING
> /* For really old versions of AIX, this may have to be
> removed. */
> # endif
> ***************
> *** 1582,1588 ****
>
> # if defined(SVR4) || defined(LINUX) || defined(IRIX) ||
> defined(HPUX) \
> || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
> ! || defined(BSD) || defined(AIX) || defined(MACOSX) ||
> defined(OSF1)
> # define UNIX_LIKE /* Basic Unix-like system calls
> work. */
> # endif
>
> --- 1591,1597 ----
>
> # if defined(SVR4) || defined(LINUX) || defined(IRIX) ||
> defined(HPUX) \
> || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \
> ! || defined(BSD) || defined(_AIX) || defined(MACOSX) ||
> defined(OSF1)
> # define UNIX_LIKE /* Basic Unix-like system calls
> work. */
> # endif
>
>