On 3/26/11 9:16 PM, Don wrote:
The basic problem with the current implementation of CTFE is that it
uses copy-on-write. This means that references (including dynamic
arrays) don't work properly -- they just copy a snapshot of the thing
they are referencing. This is bug 1330. It also means it burns up memory
like you wouldn't believe.

I'm changing CTFE to use in-place modification. This fixes all those
issues. But this is obviously a fairly intense change, and will take
quite a lot of time to iron out all the corner cases. So that's all I'm
planning on doing right now.

But once that's done, it will be straightforward to implement other
reference types, such as classes and pointers (pointer arithmetic will
be restricted to pointers which point to array members). Once classes
are implemented, it's straightforward to do exceptions. So, pretty much
everything.

First of all, let me say again that I am really looking forward to your changes, as I even considered having a go at solving the referencing issue myself for a while (but without sound knowledge of the compiler internals, this is an even harder thing to pull off).

Do I understand correctly that your changes wouldn't introduce some form of real compile-time memory management, but alleviate the need for it by fixing bug 1330 and related ones, thus cutting down on the ridiculous amount of copying going on today?

And finally – I know such questions are tough to answer –, do you have a rough estimate on how long it will take you to get the basic set of changes ready for testing? This is somewhat relevant for me, as the coding period for GSoC is going to start in about two months from now, and I think that with current DMD, doing the Thrift compiler in CTFE might be infeasible due to memory usage.

Thanks a lot for your work,
David

Reply via email to