Replacing AA's in druntime

Daniel Murphy yebblies at nospamgmail.com
Tue Mar 13 22:19:12 PDT 2012


"H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote in message 
news:mailman.651.1331696880.4860.digitalmars-d at puremagic.com...
> On Wed, Mar 14, 2012 at 12:37:08PM +1100, Daniel Murphy wrote:
>> Welcome to Hell. =D
>
> Ahhhahahaha... sounds like I leapt into the deep end of the pool without
> knowing it. :-P
>
>

Yeah, the AA implementation is the deepest part I've found in dmd.

>> Some of the things you can do with AAs are recognized by the compiler
>> during semantic and turned into druntime calls, sometimes the
>> constructs survive all the way to the glue layer (e2ir) and are turned
>> into druntime calls there and sometimes the type of an expressions is
>> magically rewritten to AssociativeArray and the methods are looked up
>> normally.  (this one caused problems with literals)
>>
>> The type needs to stay as V[K] _not_ AssociativeArray, so that error
>> messages work properly.  Something needs to be done about literals
>> too...  Don't forget template arg deduction!
>>
>> There's a function AAGetSym (or something like that) that can be
>> searched for to find where dmd emits druntime calls, but there might
>> be other places it generates them.
> [...]
>
> Alright. So now I have to dig into dmd internals to do what I want.
> Maybe I should complete the template implementation first before
> tackling this stuff. Sounds nasty. :-P  (But then again, I *did* have to
> deal with over-engineered C++ in the past, which at one point required
> making an IPC call via 6 levels of abstraction, one of which involved
> fork(), fwrite() and fread(). I doubt dmd attains to that level of
> evil.)
>
>
> T

Probably a good idea to finish it first.  It might be possible to just 
recognize AssociativeArray when printing error messages, and let the 
existing struct template code handle everything else.  Ideally syntax and 
error messages/stringof/pragma msg should be the only places where the 
compiler is actually aware AAs exist.  But this might not be that easy... 




More information about the Digitalmars-d mailing list