Phase F F4: bounce machinery deleted — strand pin holds through the removal
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Td4ujboGuAw26jvbDQzehj
This commit is contained in:
parent
594e6f9a27
commit
94e5c68909
9 changed files with 27 additions and 93 deletions
|
|
@ -1161,6 +1161,31 @@ each deletion must flip its spec in the same commit (the
|
||||||
`fiber-resume-park` red→green flip is the template). That is the next Phase F
|
`fiber-resume-park` red→green flip is the template). That is the next Phase F
|
||||||
increment after the bounce removal.
|
increment after the bounce removal.
|
||||||
|
|
||||||
|
### F4 — the doc-19 mainstack bounce is GONE (2026-08-09)
|
||||||
|
|
||||||
|
Deleted in one increment: the `DoRun` bounce, `s_mainStackRunner` /
|
||||||
|
`wxWasmSetMainStackRunner` / `wxWasmRunOnMainStack`, `wx/wasm/private/
|
||||||
|
mainstack.h`, `wasm/bindings/main_stack_runner.h` (+ its five embind includes),
|
||||||
|
and KiCad's `TOOL_MANAGER::RunOnMainStackIfActiveTool` — the fork moves CLOSER
|
||||||
|
to upstream. `wxWasmOnCoroutineStack()` and the captured main-stack bounds stay
|
||||||
|
(the `fiberStackParks` probe uses them).
|
||||||
|
|
||||||
|
Post-flip a nested loop opened from a tool parks the TOOL'S OWN context through
|
||||||
|
`wxWasmYieldUntil` (context_sleep set the precedent for symmetric-lane parks) —
|
||||||
|
which is what the bounce approximated from outside, minus the detour through
|
||||||
|
the root. **Gates: battery 395/1 (nested green through the removal), strand 2/2
|
||||||
|
(`closed=true refused-resumes=0` — the doc-19 pin holds with the mitigation
|
||||||
|
deleted), kicad suite 139/1-equivalent.**
|
||||||
|
|
||||||
|
Build-system note that cost two cycles: deleting a header leaves stale
|
||||||
|
recorded deps in BOTH wx build trees (host `build-wasm/wxwidgets/.deps` and the
|
||||||
|
docker volume `kicad-wasm-libs_kicad-build-cache:/cache/wxwidgets/.deps`) —
|
||||||
|
remove the `.o` + `.o.d` pair in each before rebuilding.
|
||||||
|
|
||||||
|
Flake watch: `ngspice-probe` "bg_run streams events live" has now failed twice
|
||||||
|
under full-suite parallel load and passed 4/4 solo both times — a de-flake
|
||||||
|
candidate, not a regression.
|
||||||
|
|
||||||
### Prod-provider smoke (2026-08-08) — done, with one pre-existing red bisected
|
### Prod-provider smoke (2026-08-08) — done, with one pre-existing red bisected
|
||||||
|
|
||||||
Against the live web stack (playwright-web config, reference backend :3060):
|
Against the live web stack (playwright-web config, reference backend :3060):
|
||||||
|
|
|
||||||
2
kicad
2
kicad
|
|
@ -1 +1 @@
|
||||||
Subproject commit 72b754b2c5552d7596ad5e5a31721eddb048f53e
|
Subproject commit 452eb5260d8a73c2bd0dff8d2a53ab2c05f116be
|
||||||
|
|
@ -59,7 +59,6 @@
|
||||||
#include <tool/coroutine.h>
|
#include <tool/coroutine.h>
|
||||||
#include <pcbjam_remote_lock.h>
|
#include <pcbjam_remote_lock.h>
|
||||||
#include "collab_common.h"
|
#include "collab_common.h"
|
||||||
#include "main_stack_runner.h"
|
|
||||||
#include "open_gate.h"
|
#include "open_gate.h"
|
||||||
#include "collab_presence_core.h"
|
#include "collab_presence_core.h"
|
||||||
#include "collab_presence_style.h"
|
#include "collab_presence_style.h"
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include "main_stack_runner.h"
|
|
||||||
#include "open_gate.h"
|
#include "open_gate.h"
|
||||||
|
|
||||||
using namespace emscripten;
|
using namespace emscripten;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@
|
||||||
#include <project.h>
|
#include <project.h>
|
||||||
|
|
||||||
#include "pcbjam_libs_reload.h"
|
#include "pcbjam_libs_reload.h"
|
||||||
#include "main_stack_runner.h"
|
|
||||||
#include "open_gate.h"
|
#include "open_gate.h"
|
||||||
#include "timer_park.h"
|
#include "timer_park.h"
|
||||||
#include "fiber_park.h"
|
#include "fiber_park.h"
|
||||||
|
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
/*
|
|
||||||
* Main-stack runner: the KiCad half of wx's nested-loop bounce
|
|
||||||
* (pcbjam docs/features/async/19, 20 D3).
|
|
||||||
*
|
|
||||||
* A quasi-modal's nested event loop parks its whole stack for the dialog's
|
|
||||||
* lifetime. When that stack is a TOOL coroutine's, the park suspends the
|
|
||||||
* fiber's body where the fiber layer cannot see it: the stale-fiber guard
|
|
||||||
* quarantines the fiber, then REFUSES its own resume, and the dialog stops
|
|
||||||
* responding to clicks (only the titlebar x still works, because that path is
|
|
||||||
* ungated). That is the Symbol Properties hang.
|
|
||||||
*
|
|
||||||
* wx detects "this nested loop is about to park on a non-main stack" — it can,
|
|
||||||
* cheaply and exactly, by comparing a frame address against
|
|
||||||
* emscripten_stack_get_base()/end() — but it must not know what a coroutine
|
|
||||||
* is. So it calls this runner, and KiCad's TOOL_MANAGER moves the loop onto
|
|
||||||
* the main stack via its own RunMainStack mechanism, which suspends the
|
|
||||||
* coroutine the legitimate way: a fiber swap the layer records
|
|
||||||
* (swap_suspended = true), so no quarantine, no refused resume.
|
|
||||||
*
|
|
||||||
* This lives in pcbjam's binding layer rather than in KiCad or wx precisely
|
|
||||||
* because it is the only place that may know about both.
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <wx/app.h>
|
|
||||||
|
|
||||||
#include <eda_base_frame.h>
|
|
||||||
#include <tool/tool_manager.h>
|
|
||||||
|
|
||||||
#include <wx/wasm/private/mainstack.h>
|
|
||||||
|
|
||||||
namespace pcbjam_main_stack
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run aFunc on the main stack if a tool coroutine is currently active.
|
|
||||||
*
|
|
||||||
* Returns 1 when the body has been run (bounced, or run inline because there
|
|
||||||
* was no coroutine to bounce off), 0 when there was nothing to run it with —
|
|
||||||
* no frame or no tool manager — in which case wx parks in place exactly as it
|
|
||||||
* did before this hook existed.
|
|
||||||
*/
|
|
||||||
inline int run_on_main_stack( void ( *aFunc )( void* ), void* aArg )
|
|
||||||
{
|
|
||||||
if( !wxTheApp )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
auto* frame = dynamic_cast<EDA_BASE_FRAME*>( wxTheApp->GetTopWindow() );
|
|
||||||
|
|
||||||
if( !frame )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
TOOL_MANAGER* toolMgr = frame->GetToolManager();
|
|
||||||
|
|
||||||
if( !toolMgr )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// RunOnMainStackIfActiveTool runs the body inline when no coroutine is
|
|
||||||
// running. Either way the body HAS run, so report it as handled — letting
|
|
||||||
// wx fall through would run the nested loop a second time.
|
|
||||||
bool ran = false;
|
|
||||||
|
|
||||||
toolMgr->RunOnMainStackIfActiveTool(
|
|
||||||
[aFunc, aArg, &ran]()
|
|
||||||
{
|
|
||||||
ran = true;
|
|
||||||
aFunc( aArg );
|
|
||||||
} );
|
|
||||||
|
|
||||||
return ran ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Installs at static-init time. Only stores a function pointer, so it is safe
|
|
||||||
* before wx exists; every lookup above happens lazily per call, since frames
|
|
||||||
* come and go. Included by more than one binding TU — setting the same pointer
|
|
||||||
* twice is idempotent.
|
|
||||||
*/
|
|
||||||
struct INSTALLER
|
|
||||||
{
|
|
||||||
INSTALLER() { wxWasmSetMainStackRunner( &run_on_main_stack ); }
|
|
||||||
};
|
|
||||||
|
|
||||||
inline INSTALLER g_installer;
|
|
||||||
|
|
||||||
} // namespace pcbjam_main_stack
|
|
||||||
|
|
@ -52,7 +52,6 @@
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include "collab_common.h"
|
#include "collab_common.h"
|
||||||
#include "collab_presence_core.h"
|
#include "collab_presence_core.h"
|
||||||
#include "main_stack_runner.h"
|
|
||||||
#include "open_gate.h"
|
#include "open_gate.h"
|
||||||
#include "timer_park.h"
|
#include "timer_park.h"
|
||||||
#include "fiber_park.h"
|
#include "fiber_park.h"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/window.h>
|
#include <wx/window.h>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include "main_stack_runner.h"
|
|
||||||
#include "open_gate.h"
|
#include "open_gate.h"
|
||||||
#include <eda_draw_frame.h>
|
#include <eda_draw_frame.h>
|
||||||
#include <kiid.h>
|
#include <kiid.h>
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit 49cd4c53b6ea1469b6fb1ef5fb867487f231dc97
|
Subproject commit a8d9ece31f9130dc5b8726924fd2f6f34f1b305f
|
||||||
Loading…
Reference in a new issue