A smaller GC benchmark
Vladimir Panteleev
thecybershadow at gmail.com
Mon Dec 10 14:54:49 PST 2007
On Mon, 10 Dec 2007 23:12:38 +0200, Sean Kelly <sean at f4.ca> wrote:
> The void[] thing is a language decision, not a runtime decision. The
> runtimes for Phobos and Tango rely on TypeInfo.flags & 1 to determine
> whether a particular type contains pointers. More exact type info for
> precise scanning would likely require a compiler change as well, since
> this would have to be added to TypeInfo. All of this would allow for a
> moving GC, but the GC would still be somewhat conservative because type
> information would still not be available for the stack (unless the app
> contained debug information, perhaps). So basically, any blocks pointed
> to from a location whose type is unknown, the block would effectively be
> pinned.
Ah, right.
Also, providing type information for the stack has already been discussed here. It's partially possible to do without much execution time overhead by storing the stack layout of a function's stack frame for every point in code somewhere. This requires that the GC have access to every stack frame in every thread, though - and it can't be done with a stack trace, because of non-D functions that D code might call.
Hmm. What if every time before D code calls non-D code, it saves a pointer to its stack frame into thread local storage (saving the previous pointer beforehand)? Then it would be possible for the GC to trace the function stack.
I think that this is definitely doable, but requires some thinking and work (and perhaps code change) :)
--
Best regards,
Vladimir mailto:thecybershadow at gmail.com
More information about the Digitalmars-d
mailing list