Skip to content

refactor(fspy_shared): separate sealed, overflow, and abort states in shm_io - #1052

Merged
wan9chi merged 1 commit into
fspy-loss/2-shm-io-closed-fast-pathfrom
fspy-loss/3-shm-io-gate-bits
Dec 2, 2026
Merged

wan9chi merged 1 commit into
fspy-loss/2-shm-io-closed-fast-pathfrom
fspy-loss/3-shm-io-gate-bits

Conversation

@wan9chi

@wan9chi wan9chi commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Motivation

shm_io previously collapsed receiver sealing, transport capacity exhaustion, and writer-initiated aborts into a single CLOSED bit set via store/swap, which clobbered both the claim count and other close causes. Separating these states is required so higher layers can distinguish capacity overflow from explicit writer-reported loss without losing the claim count, and so shm_io stays domain-neutral (no report_loss terminology).

Changes

  • Split CLOSED into three monotonic close-gate bits (GATE_SEALED, GATE_OVERFLOW, GATE_ABORTED) updated via fetch_or.
  • Rename ShmWriter::report_loss to ShmWriter::abort and split SealError::Closed into SealError::{AlreadySealed, Capacity, Aborted} with explicit precedence (AlreadySealed > Aborted > Capacity).
  • Update shm_io documentation and unit tests for the separated gate bits and error variants.

Stack created with GitHub Stacks CLI • Give Feedback 💬

… shm_io

Split shm_io's single CLOSED bit into GATE_SEALED, GATE_OVERFLOW, and
GATE_ABORTED using fetch_or so transport capacity exhaustion, receiver
sealing, and writer-initiated aborts are distinct and never clobber each
other. Rename ShmWriter::report_loss to ShmWriter::abort so shm_io stays
domain-neutral, return distinct SealError variants on seal, and update
shm_io's README to match.

Co-authored-by: Gemini 4 Neon <noreply@google.com>
@wan9chi
wan9chi added this pull request to stack #1057 December 2, 2026 10:19
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.19%  [ -3.97% ..  +4.27%]  overhead   +58.58%
dynamic/access             change  +0.00%  [ -4.11% ..  +3.67%]  overhead   +20.01%
dynamic/access-relative    change  -0.83%  [ -3.66% ..  +2.39%]  overhead   +69.82%
dynamic/access-contended   change  +0.45%  [ -6.59% ..  +9.00%]  overhead   +45.88%
static/launch              change  +0.90%  [ -3.65% ..  +5.84%]  overhead  +201.61%
static/access              change  +0.06%  [ -2.74% ..  +1.31%]  overhead +1451.17%
static/access-relative     change  -0.27%  [ -1.72% ..  +1.27%]  overhead +1940.11%
static/access-contended    change  +0.12%  [ -1.54% ..  +0.91%]  overhead +2078.88%

macos

dynamic/launch             change  +0.26%  [ -2.35% ..  +3.21%]  overhead  +223.23%
dynamic/access             change  +0.76%  [ -2.41% ..  +3.25%]  overhead    +5.13%
dynamic/access-relative    change  -0.70%  [ -3.15% ..  +3.07%]  overhead  +250.00%
dynamic/access-contended   change  -0.09%  [ -1.67% ..  +2.21%]  overhead    +3.73%

windows

dynamic/launch             change  +0.76%  [ -5.54% ..  +5.91%]  overhead   +29.02%
dynamic/access             change  +0.58%  [ -1.86% ..  +3.63%]  overhead    +1.69%
dynamic/access-relative    change  -0.37%  [ -9.67% ..  +1.88%]  overhead    +1.90%
dynamic/access-contended   change  +0.00%  [ -4.78% ..  +5.56%]  overhead    +2.09%

@wan9chi
wan9chi merged commit 4777bcd into main Dec 2, 2026
34 of 36 checks passed
@wan9chi
wan9chi deleted the fspy-loss/3-shm-io-gate-bits branch December 2, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant