[dmd-internals] AssociativeArray in druntime should go before the next release

Steve Schveighoffer schveiguy at yahoo.com
Fri Feb 3 11:11:18 PST 2012


>________________________________
> From: Daniel Murphy <yebblies at gmail.com>
>On Sat, Feb 4, 2012 at 2:31 AM, Steve Schveighoffer <schveiguy at yahoo.com> wrote:
>> 2. This conversion:  [a:b, c:d] -->  AALiteral([a, c], [b, d]) should *NOT* use the heap for the two array literals.  I'm not sure how you can declare AALiteral such that this doesn't happen, but this needs to be solved.
>>
>
>It's not about how AALiteral is declared, it's how the compiler calls
>it.  For a lot of druntime calls it currently does something along the
>lines of:
>Key[dim] keys;
>... store the keys ...
>Value[dim] values;
>... store the values ...
>aa = AAliteral(key, value);
>
>We'll need to define an interface, but that's just the point - the
>current half-language/half-runtime solution doesn't have this.

Right, the point I was bringing is that if the new method is to do a simple lowering using the above translation, today that means heap allocations.  If that means we need to invent some new syntax, I'm all for it, or if it means the compiler needs to do a translation more like what you said than a simple expression change, then so be it.
I just don't want to move from the current method to something that unnecessarily heap-allocates, we already have enough of that.

-Steve



More information about the dmd-internals mailing list