Only tangentially related, asking out of curiosity.
If one wanted to have a JIT compiler from what I understand it would essentially need to be able to get a chunk of memory, generate instructions into it and then jmp there.
Is creating such a thing possible in just Go?
Yes. You need some syscalls and unsafe, but it's possible.
wazero does this, on amd64 and arm64: https://github.com/wazero/wazero
You can read more about the approach - from the creator - here: https://mathetake.github.io/posts/runtime-code-generation-in...