diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 15:52:33 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-19 15:52:33 -0300 |
| commit | 8fea4ab90a04acd5f20528b00342c23d42f8c83e (patch) | |
| tree | be264d2cd8ba57492e227d9d6a65027f3d7680c9 /core/Addon.zig | |
| parent | 553a62bac675bfc0a64254718488d3c8012f533e (diff) | |
| parent | ee2e79dea10c93c104b70cf1eedccd7ba85003fc (diff) | |
| download | pardes-8fea4ab90a04acd5f20528b00342c23d42f8c83e.tar.gz pardes-8fea4ab90a04acd5f20528b00342c23d42f8c83e.zip | |
integration: the soak on the real session loop and the cli's serve thread joined, with the tape's handle through the kinds, the core's own files and the small ones: pardes-runners-d (10c's last changes) and pardes-handle-2 (the handle's steps 3 to 5 and its two rules as tests), merged without a conflict; gates in the coordinator's ledger
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Addon.zig')
| -rw-r--r-- | core/Addon.zig | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/core/Addon.zig b/core/Addon.zig index 5c23ed51..d52462e0 100644 --- a/core/Addon.zig +++ b/core/Addon.zig @@ -21,7 +21,6 @@ const std = @import("std"); const Kind = @import("Kind.zig"); const dump = @import("dump.zig"); const pardes = @import("root.zig"); -const tape = @import("tape.zig"); const Pardes = pardes.Pardes; const Why = Kind.Buf(160); @@ -342,7 +341,7 @@ fn listed(data: []const u8, path: []const u8, n: usize, why: *Why) Loaded { /// Kind `k`'s code, a session's (a replica's is `plainOps`'s or none): its /// library loaded at the first pane of its kind, from the file the start /// listed it from (`listed`); null, and why, when it will not load. -pub fn need(r: *Kind.Registry, k: u8, why: *Why, distrusted: ?*const Distrusted) ?*const Kind.Ops { +pub fn need(r: *Kind.Registry, tape: *pardes.tape.Tape, k: u8, why: *Why, distrusted: ?*const Distrusted) ?*const Kind.Ops { if (r.ops[k] != null) return r.ops[k]; // A client's: its own code for a plain kind, loaded at its first pane. if (tape.replaying()) { @@ -612,7 +611,7 @@ pub fn leader(r: *const Kind.Registry, keys: []const u8) union(enum) { none, pre /// `l` taken in, its words and extensions with it, or listed refused, /// and why: collisions with the core's names and the kinds here /// (`except`'s own looked past, a reload's old one). -pub fn take(r: *Kind.Registry, l: Loaded, except: []const u8) ?[]const u8 { +pub fn take(r: *Kind.Registry, tape: *pardes.tape.Tape, l: Loaded, except: []const u8) ?[]const u8 { if (r.n == Kind.max_kinds) return "refused: no room for another kind"; const e = &r.kinds[r.n]; e.* = .{ .version = l.version, .abi = l.abi, .hash = l.hash, .caps = l.caps }; @@ -775,7 +774,7 @@ pub fn landed(p: *Pardes, op: Op, pane: u8, l: Loaded) void { while (i < p.kinds.n) { if (p.kinds.kinds[i].refused and std.mem.eql(u8, p.kinds.kinds[i].path.slice(), l.path)) p.kinds.drop(i) else i += 1; } - if (p.kinds.take(l, "")) |why| { + if (p.kinds.take(p.tape, l, "")) |why| { if (l.why.len == 0) release(p, l.hash); return p.reportFailure(id, std.fmt.bufPrint(&said, "Addon load: {s}: {s}", .{ base, why }) catch "Addon load: refused"); } @@ -812,7 +811,7 @@ fn swap(p: *Pardes, l: Loaded, why: *Why) bool { if (p.kinds.collides(l, name, &scratch)) |r| return fail(why, "{s}", .{r}); if (!std.mem.eql(u8, l.name, name)) return fail(why, "refused: its kind is now {s}, not {s}", .{ l.name, name }); const old_ops = p.kinds.ops[k]; - const new_ops: ?*const Kind.Ops = if (tape.replaying()) null else @ptrFromInt(l.ops); + const new_ops: ?*const Kind.Ops = if (p.tape.replaying()) null else @ptrFromInt(l.ops); const gen = p.kinds.kinds[k].gen +% 1; var fresh: [pardes.MAX_PANES]?*Kind.Slot = @splat(null); defer for (fresh) |f| if (f) |s| { @@ -857,7 +856,7 @@ fn swap(p: *Pardes, l: Loaded, why: *Why) bool { }; const old_hash = p.kinds.kinds[k].hash; p.kinds.drop(k); - _ = p.kinds.take(l, ""); + _ = p.kinds.take(p.tape, l, ""); p.kinds.kinds[p.kinds.n - 1].gen = gen; release(p, old_hash); return true; @@ -899,7 +898,7 @@ test "addon reload gives migration the old record version and saves the new vers var old = std.mem.zeroInit(Kind.Ops, .{ .head = std.mem.zeroInit(Kind.c.pa_head, .{ .size = @sizeOf(Kind.c.pa_head), .abi = Kind.abi, .version = 1 }), .open = Fake.open, .paint = Fake.paint, .dump = Fake.save, .load = Fake.load }); @memcpy(old.head.name[0..7], "migrate"); var words: [64]LoadedWord = undefined; - try std.testing.expect(p.kinds.take(loadedOf(&old, "test.so", @splat(0), &words), "") == null); + try std.testing.expect(p.kinds.take(p.tape, loadedOf(&old, "test.so", @splat(0), &words), "") == null); const pane = try Kind.open(p, 1, p.kinds.byName("migrate").?, null, null); var new = old; new.head.version = 2; |
