[pypy-dev] reg. GCLS recursive test.

Carl Friedrich Bolz cfbolz at gmx.de
Tue Jan 29 20:37:02 CET 2008


Hi Amund,

Amund Tveit wrote:
> Hi, I wrote a blog entry yesterday about using rpython for the great
> computer language shootout recursive program, and got a RunTime error
> when I input on the commandline 11 (1 to 10 goes fine). Just did an
> svn update of pypy to version 51115 and still get the error, here is
> the program:

The runtime error is a stack overflow. RPython is checking for stack 
overflows when a recursive call is occuring (which is probably also the 
reason why the RPython version is slower). It is a bit conservative in 
doing that, which is why C still works for 11, but not the RPython version.

To simulate an infinite stack you could additionally pass in the option 
stackless=True and gc="generation" instead of ="ref" to the Translation 
class. This will make the program slightly slower, but should allow you 
very large arguments (argument sizes that probably make the normal C 
version segfault).

Cheers,

Carl Friedirch



More information about the Pypy-dev mailing list