Eli Bendersky has another great, even simpler introduction (from 2013) to JIT compiling but with hardcoded instructions [0]. And a more recent post on JIT compiling Brainfuck [1].
Experiments like these are really fun to do in a small setting. In reality you would only get to this point after having built a complete programming language with all its parts. But in a situation like this you can start at the end, focus on generating the machine code, putting it in a memory buffer and instructing the CPU to start running it at that point. It can hardly be called a JIT compiler of course, but you definitely get an impression of its mechanics.
Wonder if you could create a new language using this approach, designed for efficient JIT compilation: maximum programmer convenience that is still coherent with maximum runtime performance, whiteout any learning curve for the user other than the language itself.
To be a bit less pedantic, this is an area that is kind of ambiguous... From one point of view it's still fair to call this "just in time".
I wish there was terminology to differentiate between kind of "on demand AOT compilation" and jits that do jitty stuff that can't be done ahead of time.
> I wish there was terminology to differentiate between kind of "on demand AOT compilation" and jits that do jitty stuff that can't be done ahead of time.
Some people differentiate between dynamic JIT compilation and static JIT compilation.
Arguably the term "ahead of time" also suffers from the same problem. Among compiler people, "ahead of time" vs "just in time" sometimes has to do with whether the compiler uses run-time information when compiling. But the names don't reflect that, they talk about when the compilation happens.
More good JIT tutorials can also be found in the PyPy ecosystem, which provides tooling to add JITs to any interpreter for a language implementation written with its (R)Python toolchain.
Terry Davis learned in university and on the job before the schizophrenia 'kicked in'. How he was able to focus enough to write so much solid code after the illness started, I'll never know.
It is also possible, that the illness gave him the fanatism required to maintain the focus over the years, to come so far with TempleOS.
(That same fanatism and crazieness also prevented people from participating I guess.)
I bet it was less about fanaticism and more about time. Previously, he had worked full time and made money. He wasn't able to work after the illness (I think I read somewhere that he was rehired by his old company, but only lasted a few weeks).
[0] https://eli.thegreenplace.net/2013/11/05/how-to-jit-an-intro...
[1] https://eli.thegreenplace.net/2017/adventures-in-jit-compila...