Re: Bug #13587 Updated: Recurence makes crash
| From: | Jeroen van Wolffelaar | Date: | Mon, 08 Oct 2001 09:27:31 +0000 |
| Subject: | Re: Bug #13587 Updated: Recurence makes crash | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-67527@lists.php.net to get a copy of this message | ||
On Mon, 8 Oct 2001, Markus Fischer wrote:
> On Mon, Oct 08, 2001 at 11:05:21AM +0200, Jeroen van Wolffelaar wrote :
> > There's a solution which is easy to mention but requires some
> > work to implement. Don't implement function calls by means of function
> > calls... The PHP processes stack will then not be based on the script,
> > and thus not overflow. I cannot oversee how hard it is to implement,
> > chances are it involves a change of approach in zend_execute...
>
> But wouldn't this step be *awfully* slow?
I can't tell yet, but I don't see why. I think no change of approach is
needed. Now a function call happens like this:
create hash for function-scope
call that function
(inside function)
function call: create hash for function-scope
call that function
(inside function, etc)
assign return value
assign return value
A different approach which only changes the way userland functions are
called:
create hash for function
push on the execution stack
JUMP to the beginning of that function
(etc, for recursive calls, you remain at this level)
at function end, pop from execution stack and JUMP to appropriate place.
read return value
This is terribly simplified and therefore also quite wrong in every
detail, but I believe it does cover the idea. I'm not sure though, it's
not easy to oversee the code.
>
> - Markus
>
>
Jeroen van Wolffelaar
Jeroen@A-Eskwadraat.nl
http://www.A-Eskwadraat.nl/~jeroen