[pypy-dev] Stack limit in the jit backends
Armin Rigo
arigo at tunes.org
Thu Jan 28 08:58:18 EST 2016
Hi Richard,
On Thu, Jan 28, 2016 at 2:37 PM, Richard Plangger <planrichi at gmail.com> wrote:
> the file rpython/translator/c/src/stack.h defines MAX_STACK_SIZE. PPC
> has a bigger limit than e.g. x86. I experienced that on s390x there is
> as well a higher consumption of memory for stack frames (they are
> variable sized with a pretty high minimum limit (160 bytes) by the ABI).
>
> I have two questions:
>
> 1) The OS (i.e. linux) defines a stack limit (ulimit -s), does pypy
> overwrite this value with MAX_STACK_SIZE?
>
> 2) How would I determine which size is best for s390x? Or how did we
> come up with 768kb for x86, and 2.8mb for ppc?
The stack limit is some number that is choosen to correspond to a bit
more than 1000 recursive levels of a typical Python program when run
by PyPy without JIT, as compiled with a typical "gcc -O3". It's thus
very much hand-waving. The limit of 768 KB was done in this way.
It's much lower than the stack provided by the OS, so no "ulimit" is
needed.
I had to pick a higher limit for PPC because 768 KB was definitely too
low there. Likely, you should measure more precisely how many levels
you get on x86-64 (I think it was around 1400) and pick a value for
s390x that gives a similar limit.
A bientôt,
Armin.
More information about the pypy-dev
mailing list