• Infinite recursion detection criteria: (test of formatting)

    From olcott@21:1/5 to All on Sun Apr 18 22:34:24 2021
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)