Dynamic Code in D

Paolo Invernizzi paoloinvernizzi at fastwebnet.it
Sat Jan 12 14:53:39 PST 2008


You can also not directly target bytecodes: what I mean its that you can directly, in your program, construct and link (with an veeeery good optimizer) the genetic functions, without having to emit/compile/link nothing bytecode related. The JIT is your friend.
That can be a very good solution expecially if the JITted functions are not-trivial ones, and can benefit a lot from optimizations.

I've done something similar some times ago, writing some wrapper C code to the interesting LLVM C++ API (but now I think there's an effort to produce LLVM C API), using it in a genetic D program that instantiated a lot of LLVM functions (for a generation) in an LLVM module, and then executed them over the D individuals: I aborted the effort for lack of time, and not-so-big improvement over a more classical, only D based, solution.

Cheers, Paolo


Michael Wilson Wrote:

> Thanks! That does look really interesting. I had a quick look at
> GNU Lightning but it's almost entirely unoptimising, and thus probably
> unusable. LLVM looks much better at first glance and I should be able
> to target LLVM bytecode directly, but I'll have to investigate the 
> feasibility of linking against D. Googling, it looks like there have
> been a few attempts to use LLVM and D together before, but mostly in
> the sense of using it as a third static compiler (e.g.
> http://www.dsource.org/projects/llvmdc). I will have to do some more
> research and see if there is anything I could get involved with.
> Needless to say, if I can get my company to contribute engineering
> time to some interesting open source development, I will. :)





More information about the Digitalmars-d mailing list