loader.lua: the completion check is empty and a fixed LOADER_END truncates slow clients #3

Open
opened 2026-11-12 07:22:50 +02:00 by opencode.siil.arti.ee · 0 comments

In dwt/loader/loader.lua the done flag is only set in the frames >= ENDF branch. The status-checking block is a no-op:

if injected and not done then
    local st = r32(RESULT + 0x000)
    if st ~= 0xFFFFFFFF and not done then
        -- comment only; nothing sets done or exits
    end
    ...
end

So done is never set from the loader result, the "inspect and exit on completion" path never runs early, and every run continues to the fixed LOADER_END (default 2700) and then calls machine:exit().

That fixed window is the only stop for a slow client. The termtris port retries startup up to 40 × 50 ms because XOpenDisplay/window creation intermittently fails while the display server settles (apps/termtris/VT1200.md, "Limits"); its play_keys.sh uses LOADER_END=3200, and the tms-c-compiler M3 harness uses LOADER_END=3400. A client that is still in startup at LOADER_END is cut off with no diagnostic.

Requested fix: either honor a real completion signal (loader result status plus an app ready/exit marker or quiescence) and exit early, or add LOADER_END=0 / LOADER_WAIT semantics that run until the app signals ready; at minimum, print a warning when the app is still in startup at LOADER_END. Also fix or remove the empty status block.

In `dwt/loader/loader.lua` the `done` flag is only set in the `frames >= ENDF` branch. The status-checking block is a no-op: ``` if injected and not done then local st = r32(RESULT + 0x000) if st ~= 0xFFFFFFFF and not done then -- comment only; nothing sets done or exits end ... end ``` So `done` is never set from the loader result, the "inspect and exit on completion" path never runs early, and every run continues to the fixed `LOADER_END` (default 2700) and then calls `machine:exit()`. That fixed window is the only stop for a slow client. The termtris port retries startup up to 40 × 50 ms because `XOpenDisplay`/window creation intermittently fails while the display server settles (`apps/termtris/VT1200.md`, "Limits"); its `play_keys.sh` uses `LOADER_END=3200`, and the `tms-c-compiler` M3 harness uses `LOADER_END=3400`. A client that is still in startup at `LOADER_END` is cut off with no diagnostic. Requested fix: either honor a real completion signal (loader result status plus an app ready/exit marker or quiescence) and exit early, or add `LOADER_END=0` / `LOADER_WAIT` semantics that run until the app signals ready; at minimum, print a warning when the app is still in startup at `LOADER_END`. Also fix or remove the empty status block.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: arti/vt1200#3