The secret sauce in Tango's AAs (Re: Garbage collector...)
Bill Baxter
dnewsgroup at billbaxter.com
Wed Oct 10 18:40:20 PDT 2007
Christian Kamm wrote:
> Bill Baxter wrote:
>
>> Well a good start would be to fix phobos' AA implementation so that it
>> doesn't generate so many false positives. Tango improves on it some,
>> but I wonder if Tango does ok on the test case here:
>> http://d.puremagic.com/issues/show_bug.cgi?id=1561
>
> I just modified the code you provided for tango and ran it: Tango's AAs seem
> not to exhibit this problem at all. (check bug for details)
>
> Christian
Thanks for trying that out. I don't understand why it would work on
Tango, though. There must be something different happening from what I
guessed originally, because keysize and valuesize should both be equal
to (void*).sizeof on a 32 bit machine, and thus Tango shouldn't be
setting the NO_SCAN flag.
Actually looking closer, it appears that the hash value used by DMD
doesn't even look pointer-like. Actually it's just an identity function:
int x = 99;
typeid(int).getHash(cast(void*)&x) // == 99
In the example we're just hashing values 0-999, so those shouldn't be
mistaken as pointers.
Can anyone explain why Tango's AA's work right when Phobos's don't here?
--bb
More information about the Digitalmars-d
mailing list