[webkit-dev] Stuck... again (Conserative GC)
Maciej Stachowiak
mjs at apple.com
Sun Jun 12 02:16:31 PDT 2005
On Jun 11, 2005, at 3:16 PM, Justin Haygood wrote:
> the Win32 API simply does not allow getting the base stack address
> of a thread, because:
>
> 1. not stable.. Windows WILL and DOES move that base address at will.
This part seems unlikely - I could imagine moving the physical
address of the stack, but what would be the point of moving the
virtual address? Further, this would break any code that kept a
pointer to anything on the stack.
But as Darin pointed out, it doesn't matter, because you only need to
get it at one particular point in time, it does not need to be stable
for all time.
> 2. Its exclusively chosen and managed by Windows itself.. no ands,
> buts, or ors about it.
It's ok that Windows chooses it - it's chosen by the OS on pretty
much all platforms. We don't need to change the stack base, just to
get it.
> What would be an alternative way to implement a conservative GC
> that I can use?
My suggestion for how to research this would be to look at the code
for the Boehm garbage collector. This is a portable conservative GC
implementation for C++, so they must have some way of getting the
range of the stack on windows. I'm not sure if the Boehm GC is
threadsafe, but as I pointed out it should be sufficient to just get
the stack base for the current thread or for the main thread, and to
disable marking of other threads.
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
I took a quick peek in the source and it does appear to have a way to
get the stack base on win32.
Regards,
Maciej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/webkit-dev/attachments/20050612/a2bbdb5c/attachment.html
More information about the webkit-dev
mailing list