Bill Allombert on Thu, 14 Sep 2006 15:00:40 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: PARI_stack_limit


On Fri, Jun 23, 2006 at 09:58:03AM +0200, Bernard Parisse wrote:
> Hello,
> 
> I have a problem when using flisexpr inside a threaded program 
> (more precisely I'm adding a pari command to xcas that should be able
> to execute any PARI command inside xcas, e.g. pari(Euler)),
> it seems related to the PARI_stack_limit check in src/language/anal.c,
> line 1959. The &ptr (in a thread call) is (much) lower than PARI_stack_limit
> and PARI dies with a Deep recursion error (the same code inside
> the readline non-threaded interface icas works correctly). I guess
> this check is here to avoid user recursive calls that end with
> a SEGFAULT (stack capacity exceeded).

I promised a better answer and it is never too late...
(I hope you are still subscribe!)

First a question:
Are you running pari_init outside the thread and flisexpr in the thread
? This is not really supported, though it would be nice if it worked.

How can we improve PARI there ? We could:
1) Allow user to disable PARI_stack_limit check
2) Allow user to reset the stack limit for the new thread.
3) Simply move PARI_stack_limit to paripub.h

Something else ?

A note about src/language/anal.h: it seems to me it would make sense for
2.4 to install all libpari header files, since we install paripriv.h 
anyway.

For example, we could move src/language/anal.h to src/headers/parianal.h,
though we could wait for the new parser (and split anal.h between the
parser and the bytecode interpreter).

Cheers,
Bill.