diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 21:01:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 00:01:23 -0300 |
| commit | 987210dbff8b830203cf5f52fa0cfc9b2974a3a2 (patch) | |
| tree | 644d2a763644b1bbd034401db80b6f41733762bb /core/Kind.zig | |
| parent | 19f9e43dfa8bab618b2566a9060aef0ccb71fb0f (diff) | |
| download | pardes-987210dbff8b830203cf5f52fa0cfc9b2974a3a2.tar.gz pardes-987210dbff8b830203cf5f52fa0cfc9b2974a3a2.zip | |
Kind: a draw's token is this process's count, which no rollback takes back, never its slot's: the token api.draw gives was the slot's `draws` (core/Kind.zig, the `.draw` entry of the api), which the rollback copy holds with the slot, so a frame drawn under a speculation that is rolled back asked token T, the copy put the count back, and the next frame's draw, of the state the replay came to, was given T again; both answers come to the kind's job_done as T, in the order its workers finish (`deliver` matches a job by core, pane, serial, gen and ops, not by token), and a kind with one draw outstanding takes the first and drops the second: it showed the discarded state's picture while asking nothing more, until its state moved again; the count is now `drawn`, beside `ready` (this process's draws), on root.zig's allowed_vars with why, and the slot's field and its kept_out entry are gone; the test `a far client's frame drawn under a speculation that rolls back asks a picture whose token the next draw is never given again: ...` (end of core/replica.zig: a plain kind drawing its count from its paint, a frontend's workers held so the discarded picture lands first) failed on the base with `expected 3, found 1` (the picture of 1 shown, its count 3) and passes; a user could not have hit it with the kinds in the tree (image draws in its open, from the file's bytes, the same picture whichever answer comes, and ignores the token; the pdf kind is not plain, so a client runs none of its code), only with a plain kind that draws from its paint and keeps its last token; gates on the seven together (the stack's top, load 18 to 50 beside them): tui core-test 855/999 (144 skipped), shell-test 1035/1038, pane-test 183/184, term-test 15/15, kitty-test 45/45, behaviour-test 275/275 and --replay 20 seeds 0 failures, process-test 3 of 144 (lspcomplete and lspcompletemoved, the base's, and headersweep-restored, which passes alone), gui unit-test 1633/1637 with the base's BaselineHarnessMismatch; replicas --clients 5 and --seeds 8: diverged 0, unequal 0, deltas wrong 0, quiet checks differed 0, unlisted stops 0, corpus 22 of 22, no leak report; the walk over every word and key passes; frame and perf gate against tree1 (farfaults): frames 77/77 byte-identical in Debug, unit-test 1633/1637, perfab corpus2x -0.087% (noise 0.092%, bar 0.4%, pictures identical), perfops 97 counts within 0.1% (largest +0.0329%)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Kind.zig')
| -rw-r--r-- | core/Kind.zig | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/core/Kind.zig b/core/Kind.zig index 7641c2d1..81997afb 100644 --- a/core/Kind.zig +++ b/core/Kind.zig @@ -136,7 +136,7 @@ pub const Slot = struct { // jobs' inputs, its file's hash, a placeholder's record), and what // a frame makes (the thumb, the pointer, whether one was drawn: a // view's, never a step's). - .local = .{ "ops", "st", "gpa", "arena", "plain", "file", "opened", "reloads", "jobs", "record", "thumb_at", "thumb_span", "pointer", "painted", "over", "used", "draws" }, + .local = .{ "ops", "st", "gpa", "arena", "plain", "file", "opened", "reloads", "jobs", "record", "thumb_at", "thumb_span", "pointer", "painted", "over", "used" }, }; /// Its kind's code here; null in a placeholder (`live` false: its kind /// not in the registry, its record kept for the day it comes) or a @@ -198,11 +198,6 @@ pub const Slot = struct { /// whether a frame was painted since its last tick. pointer: u8 = 0, painted: bool = false, - /// The last of its draws' tokens (api.draw), each its own process's: a - /// draw is a frame's, and how many frames each process paints differs, - /// so it is in no digest; the copy holds it with the slot. A kind - /// keeping one in its state (PA_PLAIN) is caught at that call's digest. - draws: u32 = 0, /// Each view's facts (a hash of its pa_view) as `view` was last told /// them, 0 for none: a change tells it again. views: [views.max]u64 = @splat(0), @@ -1220,8 +1215,8 @@ pub const api: c.pa_api = .{ heap.free(copy); return 0; }; - cl.slot.draws = (cl.slot.draws +% 1) & ~c.PA_DRAWN; - const token = c.PA_DRAWN | cl.slot.draws; + drawn = (drawn +% 1) & ~c.PA_DRAWN; + const token = c.PA_DRAWN | drawn; j.* = .{ .gpa = heap, .pane = @intCast(cl.id), .serial = pane.serial, .token = token, .gen = cl.slot.gen, .ops = ops, .in = copy, .arena = .init(heap), .draw = p }; Addon.holdJob(ops, true); if (drawer) |d| if (d.go(d.ctx, j)) return token; @@ -1250,6 +1245,12 @@ pub const api: c.pa_api = .{ pub var drawer: ?struct { ctx: ?*anyopaque, go: *const fn (ctx: ?*anyopaque, j: *host_io.KindJob) bool } = null; /// Draws done, each kept for its pane's next paint (the loop's alone). var ready: std.ArrayListUnmanaged(*host_io.KindJob) = .empty; +/// The last token a draw was given: a draw is a frame's, this process's, in +/// no digest and no copy (a kind keeping one in its PA_PLAIN state is +/// caught at that call's digest). A rollback takes a slot back, never this, +/// so no draw is given the token a discarded speculation's frame was, whose +/// answer may come after. +var drawn: u32 = 0; /// A draw done on a worker, back on the loop: kept for its pane's next /// paint, a frame owed. One of another core's (a client joined again |
