Post by olcottIf a function X() is called by function Y() twice in sequence from the
same machine address of Y() with the same parameters to X() and the
execution trace shows no conditional branch instructions in Y() or
function call returns in X() then the function call from Y() to X() is
infinitely recursive unless X() stops it.
The referenced execution trace is on x86 machine language, disassembled
for human consumption.
When Halts() uses an x86 emulator to simulate its input and maintains an
execution trace of this emulation then it can examine this execution
trace according to the above criteria and correctly decide that Y() is
invoking X() in infinite recursion. On this basis it can stop simulating
Y() and report that Y() would not halt unless its execution was aborted
by Halts().
void Y(u32 P)
Halts(P, P);
}
int main()
{
Halts((u32)Y, (u32)Y);
}
_Y()
[000009ac](01) 55 push ebp
[000009ad](02) 8bec mov ebp,esp
[000009af](03) 8b4508 mov eax,[ebp+08]
[000009b2](01) 50 push eax
[000009b3](03) 8b4d08 mov ecx,[ebp+08]
[000009b6](01) 51 push ecx
[000009b7](05) e840feffff call 000007fc
[000009bc](03) 83c408 add esp,+08
[000009bf](01) 5d pop ebp
[000009c0](01) c3 ret
Size in bytes:(0021) [000009c0]
_main()
[000009cc](01) 55 push ebp
[000009cd](02) 8bec mov ebp,esp
[000009cf](05) 68ac090000 push 000009ac
[000009d4](05) 68ac090000 push 000009ac
[000009d9](05) e81efeffff call 000007fc
[000009de](03) 83c408 add esp,+08
[000009e1](02) 33c0 xor eax,eax
[000009e3](01) 5d pop ebp
[000009e4](01) c3 ret
Size in bytes:(0025) [000009e4]
===============================
....[000009cc][00011278][00000000](01) 55 push ebp
....[000009cd][00011278][00000000](02) 8bec mov ebp,esp
....[000009cf][00011274][000009ac](05) 68ac090000 push 000009ac
....[000009d4][00011270][000009ac](05) 68ac090000 push 000009ac
....[000009d9][0001126c][000009de](05) e81efeffff call 000007fc
Begin Local Halt Decider Simulation at Machine Address:9ac
....[000009ac][00031318][0003131c](01) 55 push ebp
....[000009ad][00031318][0003131c](02) 8bec mov ebp,esp
....[000009af][00031318][0003131c](03) 8b4508 mov
eax,[ebp+08]
....[000009b2][00031314][000009ac](01) 50 push eax
....[000009b3][00031314][000009ac](03) 8b4d08 mov
ecx,[ebp+08]
....[000009b6][00031310][000009ac](01) 51 push ecx
....[000009b7][0003130c][000009bc](05) e840feffff call 000007fc
....[000009ac][0007bd40][0007bd44](01) 55 push ebp
....[000009ad][0007bd40][0007bd44](02) 8bec mov ebp,esp
....[000009af][0007bd40][0007bd44](03) 8b4508 mov
eax,[ebp+08]
....[000009b2][0007bd3c][000009ac](01) 50 push eax
....[000009b3][0007bd3c][000009ac](03) 8b4d08 mov
ecx,[ebp+08]
....[000009b6][0007bd38][000009ac](01) 51 push ecx
....[000009b7][0007bd34][000009bc](05) e840feffff call 000007fc
Local Halt Decider: Infinite Recursion Detected Simulation Stopped
....[000009de][00011278][00000000](03) 83c408 add esp,+08
....[000009e1][00011278][00000000](02) 33c0 xor eax,eax
....[000009e3][0001127c][00010000](01) 5d pop ebp
....[000009e4][00011280][00000058](01) c3 ret
Number_of_User_Instructions(23)
Number of Instructions Executed(16920)
sizeof(Decoded_Line_Of_Code)(24)
--
Copyright 2021 Pete Olcott
"Great spirits have always encountered violent opposition from mediocre
minds." Einstein