5 ms·
Isn't this what the GraalVM [1] guys are also trying to do? Seems like today the competition is between who is more polyglot than the other, JVM, CLR or WASM.
by johnnycerberus 5y ago
Isn't this what the GraalVM [1] guys are also trying to do? Seems like today the competition is between who is more polyglot than the other, JVM, CLR or WASM.
[1] https://github.com/oracle/graalpython https://github.com/oracle/graalpython
- chrisseaton 5y agoA big difference is the Pyjion generates .NET compiler IR manually, while GraalVM generates Graal compiler IR automatically through partial evaluation of a declarative specification of an interpreter specialised to the program (the first Futamura Projection.) In my opinion that's far more powerful in terms of removing abstraction. But Pyjion also seems like a very cool project.
- rowanG077 5y agoDamn I didn't know any of the Futamura Projections where actually implemented in practice.
- chrisseaton 5y agohttps://chrisseaton.com/truffleruby/pldi17-truffle/pldi17-truffle.pdf https://chrisseaton.com/truffleruby/pldi17-truffle/pldi17-tr...
- jhgb 5y agoSounds to me like PyPy has been using Futamura projections for a decade or so.
- rowanG077 5y agoCan you link me to some sources? I'm not familiar with PyPy but I thought it's a normal tracing JIT. In fact quick googling shows a blog post explicitly saying PyPy does NOT use PE: https://www.pypy.org/posts/2018/09/the-first-15-years-of-pypy-3412615975376972020.html#why-did-we-abandon-partial-evaluation https://www.pypy.org/posts/2018/09/the-first-15-years-of-pyp.... Besides not every PE instance is a Futurama Projection.
- svieira 5y agoPyPy is two projects. 1. RPython + the PyPy _compiler_ which is a compiler for JIT compilers (like GraalVM as I understand it) 2. An implementation of the Python language _using_ RPython to produce a JIT for Python scripts. There are other languages _using_ RPython + PyPy compiler to produce JIT compilers for languages other than Python too. https://doc.pypy.org/en/latest/architecture.html#layers https://doc.pypy.org/en/latest/architecture.html#layers
- rowanG077 5y agoI see. This doesn't look like a Futaruma Projection to me. What PyPy does is run a python program under their own RPython based interpreter. Then it uses a tracing JIT to JIT the RPython based interpreter. There is no PE going on. No residual specialized program is created. The first Futaruma Projection would be if PyPy would specialize the interpreter based on the python program yielding an executable.
- samth 5y agoThat's exactly what PyPy does do. You get a specialized version of the interpreter which is specialized to the particular program.
- rowanG077 5y agoNo you don't get that. A tracing JIT is not capable of producing an executable like that under normal circumstances. If a certain path is not taken during execution it might not be compiled at all. The point of the first futurama projection is that you get a fully runnable executable that is semantically equivalent to running the original program in the interpreter. A JIT only produces what it sees during execution. I guess it might be possible if you carefully run your program with inputs that exhaust every possible path.
- jhgb 5y agoClearly PyPy has to produce executable code if it wants to jump into it. The CPU wouldn't understand if it were asked to jump into something that isn't executable code. > The point of the first futurama projection ...was to delight viewers with what would turn out to be a wonderful pilot episode?
- dolmen 5y agoAbout Futamura Projections (for people like me that had never heard about it): https://gist.github.com/tomykaira/3159910 https://gist.github.com/tomykaira/3159910
- r-zip 5y agoFor some reason I read this as Futurama projections.
- pjmlp 5y agoWASM isn't on the same league until it offers GC support.