logoalt Hacker News

Merad • yesterday at 8:34 PM • 1 reply • view on HN

A compiler writes machine code do a file. The OS then loads the code from the file into executable memory before it runs the program. The compiler isn't actually trying to execute the machine code it produces. This is why a JIT wouldn't work - the JIT bypasses the interpreter and produces machine code _that executes directly on the CPU_ inside of the same app.

I don't know any details about Python's architecture, but it's totally possible to write an interpreter for machine code; that's basically what an emulator is. The trade off is that pure interpreters tend to be very slow.


Replies

chrisjj • yesterday at 10:03 PM

> why a JIT wouldn't work

Uh? It would work via a file - as AOT.