Skip to content

jets: +grab jet for the +sip lazy jam cursor - #1054

Draft
sigilante wants to merge 1 commit into
developfrom
sigilante/sip-jet
Draft

jets: +grab jet for the +sip lazy jam cursor#1054
sigilante wants to merge 1 commit into
developfrom
sigilante/sip-jet

Conversation

@sigilante

Copy link
Copy Markdown
Collaborator

Draft — companion to urbit/urbit#7385 (the +sip library and tests). Merge that first; this is the jet for its hot path.

Summary

+sip is a read-only cursor over a jammed noun (see urbit/urbit#7385). This jets its one hot entry point — +grab, atom at axis — as an i-tier library jet under %non/%sip, mirroring lagoon/math. The jet subsumes +dive, +gaze, +fetch, and the +hop skips on the path: one jet, one parity surface.

  • pkg/noun/jets/i/sip.cu3wi_sip_grab (wrapper) / u3qi_sip_grab (core). No C recursion — the subtree skip uses an explicit pending-node counter (O(1) space). 64-bit (c3_d) bit-cursor arithmetic; every read bounds-checked against u3r_met(0, a).
  • pkg/noun/jets/135/tree.c — register %non/sip/grab (k135; the running kernel is ~% %k.135).
  • pkg/noun/jets/w.h, q.h — declare u3wi_sip_grab / u3qi_sip_grab.
  • pkg/noun/build.zig — wire in jets/i/sip.c.

Crash parity

Malformed input, buffer overrun, a forward or self backref, an out-of-range axis, axis-into-atom, and fetch-of-cell all u3m_bail(c3__exit) — exactly where the Hoon spec crashes. Following a backref asserts a strictly-decreasing offset, so hostile backref chains terminate by construction.

Verification

Built (DEVELOPER_DIR=/nonexistent zig build -Dtarget=aarch64-macos) and booted on a fake ship with the +sip library from urbit/urbit#7385:

  • Binds and fires: 1913 jet dispatches observed across the parity suite.
  • Parity: every +grab result matched +cue / +slot ground truth over the full suite — hand-computed USTJ vectors, 400 random DAG-shaped nouns (forced cell + atom backrefs), and hostile-input crash tests. Full %/tests tree green.
  • Benchmarks (macOS aarch64): jetted +grab on a [%tag …] head-tag lookup is flat at 1.27 µs across 1 KB → 10 MB jams (<1% spread) and ~880× faster than +cue+slot at 1 MB (~9000× at 10 MB); ~16× over the same walk un-jetted. Worst case (5000-deep right-spine, deepest axis, O(N)): jetted +grab 303 µs vs 71 ms un-jetted (235×) and still beats cue+slot for a single lookup. Full table in lib: add +sip lazy jam cursor urbit#7385.

No changes to jam/cue/mat/rub; this is purely additive.

🤖 Generated with Claude Code

Jets the hot path of +sip (urbit/urbit#7385): +grab, atom at axis in a
jammed noun. Registered as an i-tier library jet under %non/%sip, mirroring
lagoon/math. The jet subsumes +dive, +gaze, +fetch, and the +hop skips on
the path -- one jet, one parity surface.

pkg/noun/jets/i/sip.c: no C recursion (explicit pending-node skip counter),
64-bit bit-cursor arithmetic, bounds-checked against u3r_met. Malformed
input, overrun, forward/self backref, out-of-range axis, and type mismatch
all u3m_bail(c3__exit) exactly where the Hoon crashes -- crash parity.

Registration in 135/tree.c (%non/sip/grab), decls in w.h/q.h, source wired
into build.zig. Verified: jet binds and every +grab result matches +cue /
+slot ground truth across the +sip parity suite; head-tag dispatch on a 1 MB
jam is ~880x faster than +cue, flat across 1 KB -> 10 MB payloads.

Companion to urbit/urbit#7385 (the +sip library and tests).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants