[pypy-dev] PyPy improving generated machine code

Richard Plangger rich at pasra.at
Sat Jan 31 10:51:13 CET 2015


Hi,

I'm a student at the technical university of Vienna and currently
looking for a topic to complete my master thesis.

I stumbled over PEP 484 that currently is discussed on the mailing list.
It seems to me that this is going to become reality pretty soon.

I had the idea that this additional type annotations could beneficial
for JIT compilation. Two weeks ago someone already mentioned pretty much
the same idea
(https://mail.python.org/pipermail/pypy-dev/2015-January/013037.html).
In this thread it was mentioned that to improve the compiled code more
detailed information (such as an integer stays in range [0-50], ...)
would be necessary to remove guards of a trace.

I read the document "Tracing the Meta-Level: PyPy'€™s Tracing JIT
Compiler" that was published 2009 to understand the basics of how PyPy
currently works. I assume that PyPy is still a trace JIT compiler.

By using the PEP 484 proposal I think this opens up new possibilities.
Using trace compilation as it is done in PyPy or SpiderMonkey makes a
lot of sense because most of the time type information is not present
prior the first execution. PEP 484 changes the game. After type
inference has completed e.g. on a function it should not occur often
that a variable's type is unknown. The document "Tracing the Meta-Level"
already mentioned that when RPython is provided as input to PyPy it
already infers the type. Is that true for not RPython programs as well?

I think there are two possibilities to improve the generated machine
code for PyPy:

* Find a sensible sub set of optimizations that rely on the available
type information and further improve the trace compilation

* Evaluate other possibilities of inter procedural methods to compile
good machine code or completely move to method based jit compilation.

I could imagine to evaluate and implement this for my master thesis.

What do you think?
Would it benefit PyPy?
Has anybody else started to implement something similar?

Best,
Richard



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150131/547497bd/attachment.sig>


More information about the pypy-dev mailing list