4 ms·
The Truffle implementation of Ruby can be plugged into a Truffle implementation of C, in order to maintain compatibility with C extensions http://chrisseaton.c
by chriswarbo 10y ago
The Truffle implementation of Ruby can be plugged into a Truffle implementation of C, in order to maintain compatibility with C extensions
http://chrisseaton.com/rubytruffle/cext/ http://chrisseaton.com/rubytruffle/cext/
Has anyone in the Python community thought of doing something similar, e.g. using PyPy to build a C interpreter, maybe re-using front-end components (pre-processor, parser, type-checker, etc.) from an existing C compiler? In fact, it might be useful to build an interpreter for something like LLVM IR, or even x86 machine code, in order to gain access to a bunch of existing languages.
Once access is gained at that low (ABI?) level, abstractions and interfaces can be built to hide the horribleness. The performance would initially be terrible, but some targetted, profiling-guided optimisation might get it down to reasonable levels; in a similar way to a JS interpreter adding specific optimisations to make asm.js code run fast.
- PeCaN 10y agoSomething like Sulong¹ in RPython would be really cool and probably entirely feasible—I too am curious if that's on the PyPy team's radar. ¹ https://github.com/graalvm/sulong https://github.com/graalvm/sulong
- ltratt 10y agoSulong is a really good idea -- I wish I'd thought of it first! We've had a student do a small project looking at something equivalent for RPython. There are, as expected, no show-stoppers yet, but I have no idea how far we'll be able to go with the limited resources we have to throw at the problem.