Re[2]: [Gc] Re: Partially scanning a VM's call stack

Ivan Maidanski ivmai at mail.ru
Wed Aug 19 03:34:42 PDT 2009


Hi!

ludo at gnu.org (Ludovic CourtХs) wrote:
> Ivan Maidanski <ivmai at mail.ru> writes:
> 
> > Do you know the VM stack direction?
> 
> It grows up (towards higher addresses).
> 
> > Typically most stacks grow down, but if this is an outstanding case
> > then: Allocate the VM thead stack using
> > GC_GCJ_MALLOC(sizeof(word)+stack_size, &descr), where descr is of type
> > struct { some_word; word stack_top; }, where stack_top is adjusted on
> > every push/pop (initially stack_top = sizeof(word) | GC_DS_LENGTH,
> > i.e. stack is empty).
> 
> This looks like the easiest solution.  OTOH `GC_gcj_malloc ()' appears
> to be undocumented, so I'd rather go for GC_new_kind + GC_MAKE_PROC.

It's public (exported from gc_gcj.h). It's used in GCC/GCJ (and Mono AFAIK) projects.

I use it (length-based only) too. The ways I use it, I've described in http://permalink.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2679

Note, however, I use const descriptors - You should use non-const descriptors (I guess, it would be good to mark stack_top field (residing a descriptor) as volatile for safety).

I don't think custom proc is preferred in your case (at least for speed considerations).

> 
> Thanks,
> Ludo'.

Bye.


More information about the Gc mailing list