Live data from Hacker News

Writing a basic x86-64 JIT compiler from scratch in stock Python

csl.name

51–52 of 52 posts

Re: Writing a basic x86-64 JIT compiler from scratch in stock Python

#51
post #10

Just what I love, a scientific and pedagogic CS article, in well formulated English. I would appreciate some introductory notes or links to prerequisites though. That would perhaps entice an audience who has no previous experience in writing compilers.

I really want to be able to wrap my head around compilers but I'm not sure what a good "user friendly" resource is that wont stuff lots of fancy compiler buzzwords in my face and become white noise to me.

Stanford Lagunita has Stanford's Compilers course available for free, with the usual undergraduate prerequisites.

Re: Writing a basic x86-64 JIT compiler from scratch in stock Python

#52
post #48
post #41

Earlier quoted context omitted.

I do see your point, but I tried to make it clear that this is compilation in an extremely restricted sense: It specializes and executes a function at runtime. And I wanted to cover the core technique of doing just that. Perhaps I should have included a small example of compiling a linear list of abstract instructions into machine code. But that again would consist of compiling small templates in a coherent way, just…

My subsequent comment acknowledges that JIT means more than compilation at runtime. In .NET desktop, it means compilation of all CIL to native on every run, just before execution. To me, that's just executing the second pass of a compiler at launch time, but Anders Hejlsberg says it's JIT[1], and I'm not going to argue :) [1]: https://stackoverflow.com/a/1255828/4158187

Anyway, I've made a follow-up post that shows how to JIT compile a subset of Python, directly based on the previous techniques: https://csl.name/post/python-compiler/
Post reply on HN