[Gc] Re: Saving all register of Boehm's Stop-World of hypermodern i686, is it reliable?

Hans Boehm Hans.Boehm at hp.com
Sat Feb 10 15:02:11 PST 2007


[Copied to the upstream list, where I agree it belongs.]

In general, I agree there is a potential problem here, which has bitten
us in the past:

- The collector traces from the architected integer registers as defined
at some point in time.

- An architecture adds an extension that increases the size of the
register set.

- Compilers start using the extra registers to hold pointers, and the
collector neglects to trace those.

I've been trying to get away from this issue, particularly in gc7,
by increasingly capturing the register set using either
__builtin_unwind_init() or getcontext(), which would presumably need
to be adjusted anyway when the register set grows.  (Sometimes
setjmp has also been used in this way, but that sometimes doesn't
save a sufficient part of the register set.)

Unfortunately, none of this is 100% portable.  Thus we're stuck
using whatever is available, which sometimes involves explicitly
traversing the set of known registers, and ficing that code when we
have to.

If someone knows of a case where we're currently not looking at all
the registers that may contain pointers (typically this excludes flag
and floating point registers, so this set is somewhat dependent on
compiler conventions), please let us know.  Better yet, post a patch.

This code is typically not performance critical, so patches to trace from
existing registers that might conceivably hold pointers in the future are
probably also appropriate.  (Patches that switch a platform to use
getcontext() are probably even better.)  But it is possible to go
overboard here; explicitly tracing from fp registers probably
doesn't make sense unless we have a good clue how a pointer might
possibly be encoded as a fp value.

Hans

On Sat, 10 Feb 2007, Tom Tromey wrote:

> >>>>> ">" == J C <jc-nospam at jr-pizarro.jazztel.es> writes:
>
> >> In boehm-gc/pthread_stop_world.c from GCJ-4.3,
> >> i don't see any specific information of a modern CPU like AMD Athlon64
> >> AM2 or Intel Pentium-M CoreDuo.
> >> ( to see GC_with_callee_saves_pushed() )
> >> In my opinion, the registers & flags that must to be saved are:
> [...]
>
> This is probably best addressed upstream, on the GC mailing list.
>
> Tom
>


More information about the Gc mailing list