On 8/20/2025 3:15 PM, Mike Terry wrote:
On 20/08/2025 03:08, Richard Heathfield wrote:
On 20/08/2025 02:37, Mike Terry wrote:
On 19/08/2025 19:06, Richard Heathfield wrote:
<snip>
But HHH is not a factorial calculation. It is a function that takes a function pointer it can
only assign or dereference, and then returns 0.
ok, we've got onto cross purposes.
Agreed.
I was not talking about HHH, because HHH involves recursive simulation, not recursive call.
Understood.
Let me re-state: I accept your explanation that that's not how it
works. It *should* work that way, and the way it does work is
clearly broken, but okay, it doesn't.
That can't happen - (c) is performing the same calculation as (a): same code and the same input.
Sure it could. When HHH detects that it's about to recurse into itself it could just start off
a new simulation, and if it starts to run away with itself it could can /its/ simulation and
return 0.
You are describing recursive /simulation/ (or emulation). (I think...) HHH does not involve
recursive call, so what I was saying does not apply to HHH.
Right.
IF (as I originally thought) HHH worked by recursing into a new simulation every time it hit DD's
HHH call, that would be quite clever. It would be easy to add static metrics to make the call
about aborting the recursion and unwinding the stack back to where it can continue simulating DD,
and nothing would be discarded as being "unreachable".
Let's see if I've fully got what you're saying. I'll use notation HHH[n] for HHH running at
nested simulation level n. So HHH[0] is outer HHH etc.
[Yeah, I know your eyes are already starting to glaze over! All I can say is the steps below are
little steps with no big jumps, so if you grab a pad and pen and cup of tea you can get through it
- believe that that can happen!!]
1. HHH[0] is simulating DD[1], and spots DD's "call HHH".
2. Rather than simulating that x86 call instruction, HHH decides to spin up a new
simulation of ... DD? [must be...]
Numbering begins at 0.
HHH uses cooperative multi-tasking to switch between
itself and its simulated DD instance.
HHH[0](DD) called from main() begins simulating its
DD[0] instance.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 157:43:35 |
Calls: | 10,384 |
Calls today: | 1 |
Files: | 14,056 |
Messages: | 6,416,479 |