elfe icon indicating copy to clipboard operation
elfe copied to clipboard

Various optimisation levels

Open c3d opened this issue 10 years ago • 0 comments

Right now, ELIoT only runs correctly at -O0, which is fully interpreted mode. Here are the other evaluation mode that need to be built / repaired:

-O1 generates a byte code with the objective to minimise run-time lookups. So it assigns slots to variables and functions, maps shapes to functions, and so on. Semi-functional at this point, passes a few simple tests, but still no closures for example. Part of the problems being to keep compatibility with -O0, e.g. for run-time functions.

-O2 generates machine code with LLVM, structured after the -O1 byte code. -O2 presently may work for some cases, as some of the old code inherited from the LLVM compiler is still in place and has not been purposely broken. But it's been unmaintained for a while on this branch. The -O2 that has worked never had the symbol table as an ELIoT data structure, so anything related to contexts and lookup needs to be re-done.

-O3 performs type inference to generate machine-level optimized code with LLVM. Some infrastructure is in place, and it may even compile very simple cases. But it is even less tested and maintained than -O2 on this branch. Type inference algorithms had to be modified compared to the traditional approach, because a 'type' in ELIoT is something else entirely (the shape of a parse tree, meaning a given tree may belong to several distinct types).

This issue is mostly here for documentation. Sub-issues fixing specific aspects of optimisations may refer to it.

c3d avatar Jul 15 '15 21:07 c3d