Re: Detecting endless recursion?

Ray Dillinger <bear@sonic.net>
4 Feb 2004 21:26:44 -0500

          From comp.compilers

Related articles
[17 earlier articles]
Re: Detecting endless recursion? witness@t-online.de (Uli Kusterer) (2004-02-01)
Re: Detecting endless recursion? joachim.durchholz@web.de (Joachim Durchholz) (2004-02-01)
Re: Detecting endless recursion? joachim.durchholz@web.de (Joachim Durchholz) (2004-02-01)
Re: Detecting endless recursion? nmm1@cus.cam.ac.uk (2004-02-01)
Re: Detecting endless recursion? derkgwen@HotPOP.com (Derk Gwen) (2004-02-01)
Re: Detecting endless recursion? lex@cc.gatech.edu (Lex Spoon) (2004-02-01)
Re: Detecting endless recursion? bear@sonic.net (Ray Dillinger) (2004-02-04)
Re: Detecting endless recursion? nmm1@cus.cam.ac.uk (2004-02-04)
Re: Detecting endless recursion? witness@t-online.de (Uli Kusterer) (2004-02-04)
Re: Detecting endless recursion? joachim.durchholz@web.de (Joachim Durchholz) (2004-02-08)
Re: Detecting endless recursion? alexc@std.com (Alex Colvin) (2004-02-08)
Re: Detecting endless recursion? cymric73@hotmail.com (Maarten D. de Jong) (2004-02-08)
Re: Detecting endless recursion? kenrose@tfb.com (Ken Rose) (2004-02-12)
[3 later articles]
| List of all articles for this month |

From: Ray Dillinger <bear@sonic.net>
Newsgroups: comp.compilers
Date: 4 Feb 2004 21:26:44 -0500
Organization: Compilers Central
References: 04-01-050 04-01-086 04-01-119 04-01-123 04-01-149 04-02-034
Keywords: debug, optimize
Posted-Date: 04 Feb 2004 21:26:44 EST

Lex Spoon wrote:
>
> It's not at all a troll. The tail-call optimization does make
> debugging more difficult -- please review the post again. Further,
> removing the optimization can cause programs that need it to fail, and
> thus sometimes you can end up in a situation where you cannot debug
> the program on your regular PC; you would need a computer with enough
> memory that the tail call optimization is not necessary.
>
> It would appear that there is still a solution, even in this toughest
> case, but I don't know if anyone implements it. It goes like this.
> You could have a debugging execution mode where tail calls are not
> erased immediately; instead, when the stack grows large, tail calls
> deep in the stack are coallesced to free up space. To make things
> easy, heap-allocate all activations so that you can easily delete from
> the middle of the stack. To make this nicer on the user, insert a
> marker at any location you remove stack activations, so that the
> debugger will be able to tell the truth about what has happened.


In Scheme 48, invocation frames stay around until the garbage
collector gets to them. S48 doesn't save dump images that I know of,
but it has a nice interactive debugger where you can look at frames
that haven't been garbage collected yet.


MIT/Gnu Scheme has an interactive debugger which keeps track of a
fixed number of previous calls in a ring buffer. So, if something
dies, you get thrown into the debugger and you can see what the last
hundred function calls were along with their actual parameters.


Neither of these breaks the standard's required tail-recursion
optimization.


Bear


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.