Hacker News new | ask | show | jobs
by Retr0id 390 days ago
It already does, in the form of JIT compilation.
1 comments

OK but I meant in already native code, like in a C program - no bytecode.
If you are generating or modifying code at runtime then how is that different from bytecode? Standardised bytecodes and JITs are just an organised way of doing the same thing.
LuaJIT has a wonderful dynamic code generation system in the form of the DynASM[1] library. You can use it separately from LuaJIT for dynamic runtime code generation to create machine code optimized for a particular problem.

[1]: https://luajit.org/dynasm.html

I mean that, too.