Le 2010-11-09 à 3:33, Jacob Carlborg a écrit :

> See my replay to Michel Fortin.
> 
> Just out of curiosity why does DMD use this approach with begin, content, end 
> to determine a section on Mac OS X? Looking at the source code for object_.d 
> in Tango for LDC, the same implementation is used for all Posix systems and 
> that is the same approach which is used in druntime for Linux, Solaris and 
> FreeBSD.

I believed the reason was that Walter could not find at the time a way to get 
the size of a section, so he developed this little hack.

Now, that's surprising because if you look at rt/memory_osx.c in druntime 
you'll find it does exactly that: it calls getsectbynamefromheader to get a 
section's address and size to add ranges to the GC, and 
_dyld_register_func_for_add_image/_dyld_register_func_for_remove_image to 
register callbacks for when an image is loaded/unloaded. That file's authors 
are Walter Bright and Sean Kelly. I don't see a reason the same technique can't 
be used to handle modules infos, tls, and the like.

Looking at druntime makes me wonder why the initialization code is scattered 
everywhere... surely it'd be easier to figure out these kinds of problems if 
initialization was all happening in one place.

-- 
Michel Fortin
[email protected]
http://michelf.com/



_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to