From 60e07feef401d9044db3a1c925cb9d1f6d20dac9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 11 Nov 2026 23:46:02 -0300 Subject: canim: relations as one data-oriented subsystem; aim; the ASan pair; the introduction's chapters From the user. Relations between panes are one subsystem: per-frame tables of places and values in struct-of-arrays, owned by the frame; the kinds one table of data; a resolver of pure passes (join, filter, priority, cut) unit-tested on hand-written tables. Ported kinds draw byte-identical frames; a synthetic map of 4000 places and 6000 values resolves in 0.56 ms against the old table's 5.7. aim, a word holding a code address tied to its row, is the first new kind, off unless a scene turns it on. The ASan pair: one overflow built plain and with ASan, recorded by instruction; the frame as bytes eight a row; the plain run goes on alone in the column, its return address aimed at main's row until the letters reach it; the fault at ret. The introduction's three chapters are built and tested, not yet exported. Annotations, rows and scrolls that changed in one frame now fade; captions stand twelve seconds at most. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa --- anim/src/hexdump.zig | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'anim/src/hexdump.zig') diff --git a/anim/src/hexdump.zig b/anim/src/hexdump.zig index a35f091..9b39bf6 100644 --- a/anim/src/hexdump.zig +++ b/anim/src/hexdump.zig @@ -46,10 +46,15 @@ pub fn kindOf(things: []const objects.Object, moment: Recording.Moment, addr: u6 /// The rows of a region (`lo .. hi`, sixteen-aligned) a dump of `count` /// rows shows: all of them, or a window round the first the step touched. pub fn window(now: cursors.Now, lo: u64, hi: u64, count: usize) u64 { + return windowAt(now.rec, now.stops[1], now.stops[0], lo, hi, count); +} + +/// The same for the step from moment `from` to `to`. +pub fn windowAt(rec: *const Recording, from: u64, to: u64, lo: u64, hi: u64, count: usize) u64 { const all = (hi - lo) / 16; if (all <= count) return lo; var touched: ?u64 = null; - for ([_][]const Recording.Span{ now.rec.written(now.stops[1], now.stops[0]), now.rec.read(now.stops[1], now.stops[0]) }) |spans| for (spans) |span| { + for ([_][]const Recording.Span{ rec.written(from, to), rec.read(from, to) }) |spans| for (spans) |span| { if (touched == null and span.addr >= lo and span.addr < hi) touched = span.addr & ~@as(u64, 15); }; const at = touched orelse lo; @@ -368,6 +373,20 @@ pub fn pointerArcs(arcs: *rows.Arcs, now: cursors.Now, field: u64, from: f32, sh const time_arc = theme.time.arc; +/// What the kernel fills strikes a byte every 2 f, as it lands: the +/// kernel's fill is no write the recording has, so by its own times, +/// cooling with the advance (`run` from `here`). +fn givenStrike(now: cursors.Now, of: anytype, here: u64, run: *rows.Run) void { + const g = of.given orelse return; + const since = g.since orelse return; + if (here + run.len <= g.addr or here >= g.addr + g.bytes.len) return; + const first = @max(here, g.addr) - g.addr; + const struck = since - @as(f32, @floatFromInt(first)) * @import("syscalls.zig").Plan.byte; + if (struck >= 0) run.heat = .{ .level = 1, .solid = 1 - std.math.clamp((now.time - now.plan.advance) / theme.time.strike.cool, 0, 1), .in = std.math.clamp(struck / theme.time.strike.in, 0, 1) }; + run.changed = .{ @intCast(@max(here, g.addr) - here), @intCast(@min(here + run.len, g.addr + g.bytes.len) - 1 - here) }; + run.apart = 2; +} + /// One arc from the row at `from` to the row of `shown` that holds /// `target`; a stub toward the rule for one in the region past them, only /// for the step's (`state.hot`). @@ -391,6 +410,8 @@ fn aim(arcs: *rows.Arcs, now: cursors.Now, field: u64, target: u64, from: f32, s // Past the rows: a stub, in the step that touches it, when it is the same region's. if (!state.hot or rows.regionOf(moment, target) != rows.regionOf(moment, field) or rows.regionOf(moment, target) == .none) return; arc.stub = true; + // Its step's alone (not a loupe's, always full): in as the step begins (12 f), out with the advance, never in a frame. + if (state.full < 1) arc.shows *= if (now.resting()) 0 else @min(std.math.clamp(now.time / theme.time.quick, 0, 1), 1 - std.math.clamp((now.time - now.plan.advance) / theme.time.read.out, 0, 1)); arc.to = if (target < shown[0].addr) rule[0] else rule[1]; arcs.add(arc); } @@ -606,7 +627,8 @@ fn fieldRow(u: ui.Ui, now: cursors.Now, y: f32, addr: u64, moment: Recording.Mom if (of.given) |g| for (0..16) |i| { const a = addr + i; if (a < g.addr or a >= g.addr + g.bytes.len) continue; - if (g.since) |since| if (since < @as(f32, @floatFromInt(a - g.addr)) * @import("syscalls.zig").Plan.byte) continue; + // Each byte as its strike lands (s+3), the fill coming in under it: never in a frame. + if (g.since) |since| if (since < @as(f32, @floatFromInt(a - g.addr)) * @import("syscalls.zig").Plan.byte + theme.time.strike.in / 2.0) continue; given_values[i] = g.bytes[a - g.addr]; given_known[i] = true; gives = true; @@ -643,6 +665,7 @@ fn fieldRow(u: ui.Ui, now: cursors.Now, y: f32, addr: u64, moment: Recording.Mom if (of.struck) |since| run.heat = now.writtenAt(here, run.len, since - @as(f32, @floatFromInt(field_k)) * cursors.write_apart); // What the kernel fills lands a byte every 2 f. if (@import("syscalls.zig").filledAt(now, here) != null) run.apart = 2; + givenStrike(now, of, here, &run); var framed: f32 = 0; if (fl.mark) |k| if (k < of.marks.len) { framed = of.marks[k]; @@ -669,6 +692,7 @@ fn fieldRow(u: ui.Ui, now: cursors.Now, y: f32, addr: u64, moment: Recording.Mom }; run.len = @intCast(end - at); readings[n] = .{ .at = at, .len = run.len, .reads = .bytes }; + givenStrike(now, of, here, &run); } runs[n] = run; n += 1; -- cgit v1.3