Re: Detecting endless recursion?

Joachim Durchholz <joachim.durchholz@web.de>
26 Feb 2004 01:02:20 -0500

          From comp.compilers

Related articles
[26 earlier articles]
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)
Re: Detecting endless recursion? witness@t-online.de (Uli Kusterer) (2004-02-13)
Re: Detecting endless recursion? joachim.durchholz@web.de (Joachim Durchholz) (2004-02-26)
Re: Detecting endless recursion? lex@cc.gatech.edu (Lex Spoon) (2004-02-26)
| List of all articles for this month |

From: Joachim Durchholz <joachim.durchholz@web.de>
Newsgroups: comp.compilers
Date: 26 Feb 2004 01:02:20 -0500
Organization: Oberberg Online Infosysteme
References: 04-01-104 <bvjd1o$aho$1@tom.iecc.com> 04-02-084 04-02-135
Keywords: debug, VM
Posted-Date: 26 Feb 2004 01:02:20 EST

Uli Kusterer wrote:
> "Maarten D. de Jong" <cymric73@hotmail.com> wrote:
>
>> [...] the VM makes use of a concept known as an evaluation cost or
>> 'eval cost' for short. Basically it is a counter which is increased
>> everytime a VM instruction is executed. If the counter exceeds a
>> given amount, an error is thrown and execution is aborted.
>
> I can't quite comprehend how that works. When would that counter be
> reset?


The answer is easy: don't reset it :-)
Simply increase it; if you need an eval cost for some operation, record
the counter at the beginning and at the end of the operation and subtract.
There are various ways to wrap this subtraction in a library or in the
run-time system.


One important point: if you expect that any long-running programs will
be written, make it a 64-bit counter so that it won't overflow in the
foreseeable future. That's *far* easier than requiring library functions
(or *ugh* end-user code) to deal with counter overflows.


Regards,
Jo
--
Currently looking for a new job.


Post a followup to this message

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