[pypy-dev] Why does pypy include my code three times in the JIT-capable executable?

Armin Rigo armin.rigo at gmail.com
Sun Dec 18 05:39:25 EST 2016


Hi,

On 16 December 2016 at 23:41,  <hgualandi at inf.puc-rio.br> wrote:
> Apparently when I compile my program with --opt=JIT, my code gets included
> 3 times in the resulting executable.

Likely, you are seeing two C copies of the function because of the way
the JIT is built.  You may get two very similar copies, but only of
the function that contains jitdriver.jit_merge_point().  You only get
one copy of all the rest.

The reason is that there is the normal function, and another
reorganized copy which can be called in some cases, like when
execution needs to exit the JIT and jump back to the interpreter.
This copy starts from the jit_merge_point instead of starting from the
normal entry point of the function.  In some cases the two versions
can be very similar, but for example, if the function does things
before entering the loop, then these things will not be found in the
JIT-generated copy.


A bientôt,

Armin.


More information about the pypy-dev mailing list