Tiny D suitable for embedded JIT

Jonathan Marler johnnymarler at gmail.com
Wed May 23 20:08:53 UTC 2018


On Wednesday, 23 May 2018 at 18:49:05 UTC, Dibyendu Majumdar 
wrote:
> Now that D has a better C option I was wondering if it is 
> possible to create a small subset of D that can be used as 
> embedded JIT library. I would like to trim the language to a 
> small subset of D/C - only primitive types and pointers - and 
> remove everything else. The idea is to have a high level 
> assembly language that is suitable for use as JIT backend by 
> other projects. I wanted to know if this is a feasible project 
> - using DMD as the starting point. Should I even think about 
> trying to do this?
>
> The ultimate goal is to have JIT library that is small, has 
> fast compilation, and generates reasonable code (i.e. some form 
> of global register allocation). The options I am looking at are 
> a) start from scratch, b) hack LLVM, or c) hack DMD.
>
> Regards
> Dibyendu

I've recently been looking into how QEMU works and it uses 
something called TCG (Tiny Code Generator).  QEMU works by taking 
code from another platform/cpu and translates it to TCG, which 
then gets "jitted" to the instructions for the host.

 From what I understand, TCG is fairly small.  I think it aims to 
be simple rather than highly optimized, unlike LLVM which allows 
more complexity for the sake of performance.

TCG: 
https://git.qemu.org/?p=qemu.git;a=blob_plain;f=tcg/README;hb=HEAD


More information about the Digitalmars-d mailing list