Re: [Gcl-devel] ia64 and garbage collection
Greetings, and thanks for the speedy replies! This really shows off
the power of the net! I've just put together a quick working gc for
gcl on the ia64, and it appears to be building maxima now without
problems! A world record turn around, if you asked me :-).
My current patch is below. Comments most welcome. And of course, a
few questions remaining!
Jim Wilson <email@example.com> writes:
> IA-64 has a register stack. This is somewhat like the register windows
> on sparcs. If you want to be able to view all of the registers, you need
> to flush the register stack to memory somehow. This can be done by calling
> getcontext as David Mosberger mentioned, but can also be done by using the
> flushrs instruction, either directly via a builtin, or by a small assembly
> language stub (which is what boehm-gc does).
1) Does the __builtin function identically to the asm in the Boehm-gc?
Returning the same address too?
> IA-64 has two stacks. One is the regular stack that holds procedure activation
> frames. The other stack is called the backing store, and holds the part of
> the register stack that has been flushed to memory. (This is unlike the sparc
> which uses a single stack for both.) You will have to search both stacks.
2) Looking over the boehm code, am I correct in guessing that this is
also the case on hppa (HP PA-RISC)?
> In order to get your GC working, you will have to spend a little time reading
> IA-64 architecture manuals to understand how all of this stuff works. Or
> alternatively study a working example. boehm-gc for instance already supports
3) I'd appreciate your comments on the patch below if possible.
Andrew Haley <firstname.lastname@example.org> writes:
> You don't seem to have mentioned that the IA-64 has *two* stacks: one
> contains registers and one structures and arrays. If you want to
perhaps this is because I was unaware of it :-).
> flush the register stack to memory for the sake of the garbage
> collector, that's easy: just call __builtin_ia64_flushrs().
Thanks for the tip!
David Mosberger <email@example.com> writes:
> >>>>> On Tue, 30 Jul 2002 13:33:12 -0400, Camm Maguire <firstname.lastname@example.org> said:
> Camm> 1) Is there a work around, i.e. a way in which I can ensure
> Camm> clearing all registers back to the stack at a certain point in
> Camm> the program?
> A call to getcontext() does have the effect of forcing all
> callee-saved (preserved) registers into memory (and the "scratch"
> registers won't be live, by virtue of getcontext() being a regular
> function call).
And thank you for this suggestion! How does this differ from the
#if defined(__ia64__) /* from boehm-gc code */
asm(" .psr abi64");
asm(" .psr lsb");
asm(" .align 16");
asm(" .global GC_save_regs_in_stack");
asm(" .proc GC_save_regs_in_stack");
asm(" mov r8=ar.bsp");
asm(" br.ret.sptk.few rp");
asm(" .endp GC_save_regs_in_stack");
void * GC_save_regs_in_stack();
(fn is set to a stack marking function, 'mark_stack_carefully')
(C_GC_OFFSET is defined to 0, but allows for marking addresses at
fractional word boundaries if set to 2)
extern void * __libc_ia64_register_backing_store_base;
void * bst=GC_save_regs_in_stack();
void * bsb=__libc_ia64_register_backing_store_base;
Camm Maguire email@example.com
"The earth is but one country, and mankind its citizens." -- Baha'u'llah