[dmd-internals] AAs in the dmd backend

Walter Bright walter at digitalmars.com
Wed Mar 31 21:11:51 PDT 2010


There is an AA implementation in backend/aa.c that should do the job.

But I thought the dwarf implementation already caches already used types?

Robert Clipsham wrote:
> Hi there,
>
> I'm working on a patch for 
> http://d.puremagic.com/issues/show_bug.cgi?id=3987 and have figured 
> out all the details of why debugging with function pointers isn't 
> working, I need to make sure I implement the fix properly so it gets 
> accepted though... I'm in need of an associative array, what is the 
> correct way to do this in the dmd backend?
>
> The exact issue is that the .debug_info for function pointers isn't 
> cached, so unlike the basic types the info is generated again, and 
> breaks by writing out the debug info in the middle of the current 
> function pointer (if that makes sense). So with the following:
>
> T function(U function(V)) foobar;
>
> The debug info is generated recursively, then the debug info for V is 
> output, then U, then the function pointer etc etc. When it gets to 
> writing the debug info for T function() though, it tries to generate 
> the debug info for its parameters. For basic types this is cached in 
> the typidx_tab array, so it pulls out the reference and places that 
> in, however for function pointers it generates it again, so you end up 
> mixing up the debug order. To fix this I need a way to cache function 
> pointers, the obvious way to do this seems to be with an AA (I'd also 
> need to find a way to mangle a given function pointers type, probably 
> by recurring through it). What would be the right way to go about 
> this? Should I use an AA, and if so, what is the preferred way to do 
> this in the DMDBE? If not, how would you recommend I go about this?
>
> Thanks,
>
> Robert
>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals
>
>


More information about the dmd-internals mailing list