Open olofson opened 9 years ago
Can we implement this as a native module, so it can just be dropped in when desired? Native code generation will add substantially to the footprint, so it would be nice if it could be left out or added on as needed, without recompiling the EEL core library.
EEL is pretty fast already (faster than Lua in some tests), speed isn't everything, and all that - but an order of magnitude is a big deal! That's more than enough enough to eliminate the need for C, C++ and the like in the vast majority of applications, even when dealing directly with low level APIs like SDL or OpenGL.
The best option at this point is probably to use LLVM, as it supports a wide range of targets (including asm.js!), generates really fast code, and is still improving.
Due to the focus on realtime applications, JIT is probably not an option.
The easiest and most flexible way of implementing the native compiler is probably by having it recompile EEL VM bytecode into native code. This will allow pre-compiled EEL modules, and code issued by the VM code generation API (see #45), to be compiled into native code as well - not just EEL source code.
What we get is essentially a bonus toolkit: Write compilers for domain specific languages in EEL, using the EEL VM code generation API, and get both EEL VM and native execution out of the box.