Fwd: Feedback on Graduate School Research Idea Using Pypy
Oops, replied directly. Forwarding to the mailing list. ---------- Forwarded message --------- From: yun bao <dayunbao@gmail.com> Date: Wed, Nov 13, 2019 at 9:57 AM Subject: Re: [pypy-dev] Feedback on Graduate School Research Idea Using Pypy To: Yury V. Zaytsev <yury@shurup.com> Thanks for all your feedback. You've given me a lot to think about. I'll probably send you some follow up questions regarding the topics you raised, if you don't mind. I was thinking that compiling PyPy to Wasm, and getting it running in the browser, would simply be the first step to doing real research, not as a research topic itself. I won't be starting grad school until next fall, so I have some time to play around with things and figure out exactly what I want to research. By the way, I was reading more about WebAssembly, and saw this: https://github.com/WebAssembly/binaryen. It might allow the removing of Emscripten from a toolchain that compiles an RPython interpreter to Wasm, since "It accepts input in WebAssembly-like form but also accepts a general control flow graph for compilers that prefer that." Maybe it's be possible to feed the control flow graphs the Annotator creates into Binaryen, and go straight to Wasm without ever first compiling to C? On Wed, Nov 13, 2019 at 12:00 AM Yury V. Zaytsev <yury@shurup.com> wrote:
An experimental WebAssembly backend is definitively an interesting idea, but as you have realised, to get PyPy running in the browser, it's not necessarily needed, as you can compile C to WebAssembly instead.
Sure, a native backend sounds nicer, but from my PoV the real performance questions lie elsewhere - so you've got an interpreter running under V8, what next? Obviously, it's not performing very well. What are the possibilities?
Are you going to try to restructure the interpreter in a way, that your language sematics become clearer to V8 so to say and it will be able to more or less JIT your interpreter directly? Is it even possible, with custom backend by avoiding Emscripten or otherwise?
Or maybe it makes sense to first write a WebAssembly JIT backend keeping the rest of the messy RPython -> C -> Emscripten -> WebAssembly toolchain in place, and study how to JITs (PyPy generated JIT and V8 JIT) interact? Is this interaction meaningful or harmful? Can it be turned into productive cooperation?
These are open questions, I don't know the answers, but what I want to say is that just being able to port interpreters to the browser is already possible via Emscripten, and in the context of PyPy there are other (I think) much more interesting questions to study.
... and I wouldn't muddy the waters with Python 3 transition, working on the questions above there is enough material for several PhDs, not even speaking of a master thesis :-)
On Tue, 12 Nov 2019, yun bao wrote:
I took a look at PyPyJS. I also spoke with some folks at Mozilla, and have become very interested in WebAssembly. I think having WebAssembly as a target for RPython would be very useful. Based on what I've learned recently, it should be possible to write an interpreter in RPython, translate it to C, then use Emscripten to compile that to WebAssembly. However, if there was a WebAssembly backend for RPython, it would be possible to build interpreters than run directly in the browser (potentially even PyPy.). That seems like an avenue worth investigating, doesn't it? I think while doing that, it would be worth getting RPython compatible with Python 3. By the way, these are things I'm thinking about doing myself, not recommendations to any of you. I'm still working on a solid thesis idea for my Master's.
On Sat, Nov 9, 2019 at 12:25 AM Yury V. Zaytsev <yury@shurup.com> wrote: Maybe you should start by having a look at PyPyJS and then exploring WebAssembly: https://github.com/pypyjs/pypyjs
Sent from my iPad
On 9. Nov 2019, at 03:40, yun bao <dayunbao@gmail.com> wrote:
Hi, I'm planning to go to grad school for a Master's. I'm thinking about researching something related to getting Python running in a web browser. All of the current implementations that allow you to do that either transpile Python to JavaScript ahead of time, or do some kind of on-the-fly conversion from Python to JavaScript. I'd like to write an actual Python engine that will run in the browser. As I've been mulling over this idea, I read about Pypy. Given my limited knowledge of this domain (programming language engines that run in the browser) and the exact nature of the problem, Pypy seems like the best route to achieving this. I'm still very much in the early stages of fleshing this idea out, and besides the typical undergraduate Programming Language class, I haven't done much in the way of programming language design or anything compiler related. So I have A LOT to learn. But I was hoping some of you who are Pypy experts could give me a bit of advice on the feasibility of what I'm considering.
Thank you,
Andrew _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev
-- Sincerely yours, Yury V. Zaytsev
participants (1)
-
yun bao