[Gc] Feature Request: Nearly-precise stack tracing

Boehm, Hans hans.boehm at hp.com
Tue Nov 6 16:01:27 PST 2012

I replied to Zach separately as well.  I'm concerned about ensuring that there are no important pointers in machine registers and unmarked stack locations.  In general that seems hard.


> -----Original Message-----
> From: gc-bounces at linux.hpl.hp.com [mailto:gc-bounces at linux.hpl.hp.com]
> On Behalf Of Zach Saw
> Sent: Thursday, November 01, 2012 5:02 PM
> To: gc at linux.hpl.hp.com
> Subject: [Gc] Feature Request: Nearly-precise stack tracing
> Hi,
> I'd like to request a new feature for the GC.
> This is a feature that would be useful to implement a nearly precise
> stack
> trace. Using this, we do not have to trace CPU registers for possible
> pointers.
> Note that I've implemented this for my own nearly precise GC a few
> years ago
> but unfortunately I've only coded it for bcc32 and x86 -- it's
> therefore not
> portable. In my experience (my GC runs 24-7 in a production
> environment), the
> nearly-precise stack tracing method is a lot better at not retaining
> out of
> scope pointers than the conservative one employed by BoehmGC. Out of
> scope
> pointers are extremely rare compared to BoehmGC especially for C++. By
> out of
> scope pointers, I mean pointers that linger in the stack and have not
> been
> overridden by other info but is already out of scope (e.g. a function
> call that
> declares a char array but never uses it).
> Here's what needs to be done for stack tracing:
> 1) Don't trace CPU registers
> 2) Tracing stack: treat pointers as possibly valid only if the next
> GC_word is
> equals to a magic number (choose an arbitrary number - preferably one
> that ends
> with an odd number to ensure it won't traced as another pointer)
> 3) When allocating GC memory, the memory will never get garbage
> collected
> during the sweep phase, *unless* we tell the GC that it's now ready to
> be
> collected when untraceable. I haven't looked into your GC code yet but
> in my
> own implementation, it's merely a single bit in the GC memory block
> descriptor.
> These tweaks should only be enabled via
> GC_set_enable_nearly_precise_stack_tracing.
> We also want to be able to tell the GC what that magic number is (e.g.
> GC_set_nearly_precise_stack_trace_magic_number) and another function
> for
> setting ready-to-be-swept flag --
> GC_set_nearly_precise_stack_trace_memory_ready.
> These features, combined with the stack unwinding of C++ allows us to
> achieve
> nearly-precise stack tracing.
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com
> https://www.hpl.hp.com/hosted/linux/mail-archives/gc/

More information about the Gc mailing list