diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 00:45:31 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 12:15:01 -0300 |
| commit | e699ffe4182f66e28180ea2d91ab1fb8c408d49e (patch) | |
| tree | 0577374fb6164ef214cd727b662a23498ad547eb /src/abi.zig | |
| parent | a1ae80096bd69ee7d92ea9e4564e960d8553395e (diff) | |
| download | sketchbook-e699ffe4182f66e28180ea2d91ab1fb8c408d49e.tar.gz sketchbook-e699ffe4182f66e28180ea2d91ab1fb8c408d49e.zip | |
Delete the Store; State is checked against the 64 MiB a save holds
A sketch's data is State: flat bytes, what grows has its capacity in its
type. The Store, a heap in a file mapped at 0x2000_0000_0000 with 64 GiB
reserved, its power-of-two allocator, its root adopt and migration, and
its test, are gone from memory.zig; so are Context.store and store_root,
Info.store, Memory.store, the Store declaration's glue, Init.store,
Frame.store and Console.store, the web host's store in wasm memory, the
host's StoreFile wiring and `<state>.store` file, the `.store` suffix in
moving an old state into .sketchbook/, the build's tests' `rm` of it, and
layout.check's `pointers` flag (State is the one checked memory now).
Its one real user, micscope, moved off it in the change before. Old
`.state.store` files are not read, converted or deleted, and stay
ignored by .gitignore. A sketch that still declares a Store gets no
error for the declaration: nothing reads it, and a `*Store` parameter is
a compile error (no argument of that type).
layout.of(T, .state) refuses a State bigger than layout.max_state, 64 MiB,
one constant: "State is N bytes, and a save holds at most 64 MiB: lower
a capacity (an array, an sk.List), or keep what need not be saved in
Session." The pointer-hash gap the spec found (a Store pointer's
element type changing kept the old bytes) is gone with the only
persisted memory that held pointers.
README: no Store row, allocator row, migration paragraph, file bullet or
known limits; draw and command lose their store parameter; State's row
says 64 MiB at most; data that grows and is the user's work goes in a
List in State or, bigger than a save, in files the sketch appends to.
Tests: zig build test, 166/166 steps (the store's unit test gone; new: a
65-MiB State fails to compile with the message above, by expect_errors).
micscope, spheres, noc's e2e and drat-meout's test unchanged and green.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src/abi.zig')
| -rw-r--r-- | src/abi.zig | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/abi.zig b/src/abi.zig index f88fca5..aecb654 100644 --- a/src/abi.zig +++ b/src/abi.zig @@ -313,8 +313,8 @@ pub const Voice = struct { /// Slices must stay alive until the host consumes the frame, right after /// `draw` returns. `sketch.Frame` copies the small ones (text, GPU /// descriptions, uniforms) into scratch memory itself; bulk data (vertices, -/// samples, pixels, uploads) must already live in scratch, session or store -/// memory, or be a literal. +/// samples, pixels, uploads) must already live in scratch or session memory, +/// or be a literal. pub const Command = union(enum) { clear: Color, rect: struct { dst: Rect, color: Color }, @@ -751,12 +751,8 @@ pub const Context = struct { /// This process: survives reloads; frees one allocation at a time, and /// releases the rest when Session's layout changes. session: std.mem.Allocator, - /// On disk, next to the state file: survives reloads and restarts, at - /// the same addresses, so Store may point into it. - store: std.mem.Allocator, - /// The sketch's `Session` and `Store` values. + /// The sketch's `Session` value. session_root: [*]u8, - store_root: [*]u8, /// Filled by `draw`, using `scratch`. commands: *std.ArrayList(Command), }; @@ -805,7 +801,6 @@ pub const Info = struct { height: u32, state: Layout, session: Layout, - store: Layout, /// Console completions offered by the sketch. commands: []const []const u8 = &.{}, /// What the sketch was built from: its repository's revision ("jj:<commit> @@ -818,7 +813,7 @@ pub const Info = struct { }; /// Which memory `sketch_defaults` fills. -pub const Memory = enum(u8) { state, session, store }; +pub const Memory = enum(u8) { state, session }; /// The entry points of a sketch, exported from libraries under these names. /// What became of a console line offered to a sketch. @@ -840,8 +835,7 @@ pub const Sketch = struct { setup: *const fn (*const Context) callconv(.c) bool, /// Deterministic: new state from state and input, nothing else. update: *const fn (*const Context, [*]u8) callconv(.c) void, - /// Presentation: reads state, may change session and store, appends - /// commands. + /// Presentation: reads state, may change session, appends commands. draw: *const fn (*const Context, [*]const u8) callconv(.c) void, /// A console line the host did not understand. command: *const fn (*const Context, [*]u8, *const []const u8) callconv(.c) Outcome, |
