4 ms·
Interesting, first time I heard about sljit. > Although sljit does not support higher level features such as automatic register allocation I don't quite see h
by the_duke 2y ago
Interesting, first time I heard about sljit.
> Although sljit does not support higher level features such as automatic register allocation
I don't quite see how it can be architecture independent if it doesn't do register allocation. Does it use a small fixed amount of virtual registers which work on every target? Or does it spill virtual registers to memory if required?
> The key design principle of sljit is that it does not try to be smarter than the developer.
> This principle is achieved by providing control over the generated machine code like assembly languages.
So it sounds like this is essentially your LLVM backend, taking care of going from intermediate representation to machine code.
Optimisations have to be done separately.
I see how a lightweight code generator could be quite useful, is sljit used in any larger projects?
- tnodir 2y ago> is sljit used in any larger projects? https://github.com/PCRE2Project/pcre2/tree/master/src/sljit https://github.com/PCRE2Project/pcre2/tree/master/src/sljit
- Retr0id 2y agoI think the idea is that if you bring-your-own register allocator, it's easy to configure it to use the right number of registers for a given target. The "LIR representation" itself is machine independent, but a given stream of LIR instructions won't necessarily be portable. (If I'm understanding correctly)
- toast0 2y ago> I don't quite see how it can be architecture independent if it doesn't do register allocation. Does it use a small fixed amount of virtual registers which work on every target? Or does it spill virtual registers to memory if required? If it's low level and platform independent, that probably means more that it provides the tools to the user to work on many platforms, rather than it does the work for many platforms for the user. Jit libraries like this are building blocks, not a turnkey interpreter to native execution pipeline.
- throwaway81523 2y ago> I don't quite see how it can be architecture independent if it doesn't do register allocation. Does it use a small fixed amount of virtual registers which work on every target? Or does it spill virtual registers to memory if required? This is pretty common in low tech compilers as well. Basically you assume just a few registers, and have some templates for various code sequences that compute a result and push it onto a stack, or that sort of thing. The code you get is way less efficient than an optimizing compiler would produce, but it beats most interpreters. GNU Lightning is a similar sort of JIT compiler.