Live data from Hacker News

JIT compiling a subset of Python to x86-64

csl.name

1–10 of 19 posts

Re: JIT compiling a subset of Python to x86-64

#2
Oh, very interesting! This is somewhat similar to a hack project I did recently, but more dynamic -- going from bytecode and doing the assembly at runtime amps things up a bit! Mine works from a Python AST and is much more static, but it also supports quite a lot more Python syntax. http://benhoyt.com/writings/pyast64/

Re: JIT compiling a subset of Python to x86-64

#5
post #2

Oh, very interesting! This is somewhat similar to a hack project I did recently, but more dynamic -- going from bytecode and doing the assembly at runtime amps things up a bit! Mine works from a Python AST and is much more static, but it also supports quite a lot more Python syntax. http://benhoyt.com/writings/pyast64/

Indeed I had already linked to your really cool project at the end. Perhaps I should have made it stand out more. The AST approach is more stable, as the Python bytecode can change between any release while the AST changes in a slower, evolutionary pace.

Re: JIT compiling a subset of Python to x86-64

#6
post #2

Oh, very interesting! This is somewhat similar to a hack project I did recently, but more dynamic -- going from bytecode and doing the assembly at runtime amps things up a bit! Mine works from a Python AST and is much more static, but it also supports quite a lot more Python syntax. http://benhoyt.com/writings/pyast64/

I tried writing a bytecode optimizer a few months ago, and actually got some basic inlining and constant propagation and other such optimizations working, but then realized it's gonna be fairly useless since bytecode changes between Python versions and isn't necessarily even going to be consistent across different Python implementations. So I abandoned that project and started working on an AST-based optimizer. Sadly I actually deleted that project (which is otherwise not something I normally do) as a means to get myself to stop sinking more time into it, but now that means I still have to mentally figure out some of the techniques I came up with again if I want the AST-based version to go anywhere...

Re: JIT compiling a subset of Python to x86-64

#10
post #8
post #4

Related: https://github.com/Microsoft/Pyjion

Also: https://www.python.org/dev/peps/pep-0523/

A couple years ago I was toying around with libjit in python, wrote some bindings, traced down (most of) the seqfaults and then got distracted by other things. Was going to dust it off to try to hook into pep-0523 but totally forgot about it until you posted that link.

https://github.com/eponymous/libjit-python

Post reply on HN