Compiling to Heap for CTFE

Bruce Adams tortoise_74 at yeah.who.co.uk
Mon Dec 17 18:37:52 PST 2007


On Tue, 18 Dec 2007 02:27:06 -0000, Craig Black <craigblack2 at cox.net>  
wrote:

> Currently, CTFE only supports a subset of the language, and it relies on  
> the compiler acting as an interpreter, which is slow.  It just occured  
> to me that if we could compile code to the heap, there would be no need  
> for a CTFE interpreter.  CTFE code could be compiled to the heap and  
> executed at full speed.  Further, all the features of D would be  
> available at compile time.
>
> Thoughts?
>
> -Craig

Its not necessarily that simple. You might be on a machine which  
distinguishes memory used by
a program with memory that contains executable code. What you may end up  
with there is
effectively the same as compiling and then running an exe.
You also need some mechanism for the resulting 'stage 1 (or n)' exe to  
feed back into the compiler
for 'stage 2 (or n+1)'. Presumably you are generating code as text tokens  
for the compiler but
ideally with context that can be backtraced.



More information about the Digitalmars-d mailing list