Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.software-eng > #2657

Infinite recursion detection criteria: (test of formatting)

Newsgroups comp.software-eng
From olcott <NoOne@NoWhere.com>
Subject Infinite recursion detection criteria: (test of formatting)
Date 2021-04-18 22:34 -0500
Message-ID <EOadndbVgOajZ-H9nZ2dnUU7-RmdnZ2d@giganews.com> (permalink)

Show all headers | View raw


Infinite recursion detection criteria:
(1) Function X() is called twice in sequence from the same machine 
address of Y().
(2) With the same parameters to X().
(3) With no conditional branch or indexed jump instructions in Y().
(4) With no function call returns from X().

The following code is written in "C"

void X(u32 P, u32 I)
{
   Simulate(P, I);
}

void Y(u32 P)
{
   X(P, P);
}

int main()
{
   X((u32)Y, (u32)Y);
}

When X() simulates the machine language of Y() and examines resulting 
execution trace after simulating each machine instruction of Y() then 
X() can apply the criteria provided above to correctly decide to stop 
simulating Y() on the basis that Y() would otherwise cause X() have 
infinite execution.


-- 
Copyright 2021 Pete Olcott

"Great spirits have always encountered violent opposition from mediocre 
minds." Einstein

Back to comp.software-eng | Previous | Next | Find similar | Unroll thread


Thread

Infinite recursion detection criteria: (test of formatting) olcott <NoOne@NoWhere.com> - 2021-04-18 22:34 -0500

csiph-web