From ff2e0823e97d10477341192d72f5d9e61d9d5bad Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 18 Oct 2026 23:29:42 +0100 Subject: 027's 4f-2: no fixed count of states: the header's u16 alone (PURE_MODULE_STATES gone); a module's transient and counted states are flags of each, the lists views and functions change or name sets of states (state_words words, a bit each), the verifier's walked lists a list with its length, duplicate names found by sorting them; an app's eighteen arrays of each state (values, texts, lists, the stored lists' slots, the last save's and the burst's, a reader's, an event's values and marks) in one block sized to its module, a replace laying the new module's apart and taking it once nothing can fail; the runtime's lists placed past any state (PURE_LIST_HEARD 0x10000), their slots after the states'; a snapshot's arrays sized so too; pure_app_read false without room (pure-serve then shows none); a save's drafts, values and the tree's revisions on the stack for 64 states, else on the heap; the JIT compiles modules of 32 states at most (its sets a word), the app's lists read through a pointer; a view reads the app's values as they are (no state changes in one), no copy of 32 a evaluation; unit test: 300 states loaded and the last counted; a hole closed: pure_app_stop read the arrays a failed start never laid; PureApp 4,256 bytes, not 8,504; counts: b39b against b38 with batches within 0.06%, without batches knapsack +0.49%, join +0.23%, the rest within 0.17%; the bank's queries (s38 and s39b in turns, three each) field -1.99%, found -1.18%, in_credit -1.10%, large -0.99%, the rest -0.58% to +0.11% (the first build, s39, copied a view's values at run time's size: in_credit +2.4%); 008 and 027 --- core/module-store.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'core/module-store.c') diff --git a/core/module-store.c b/core/module-store.c index 7ca2dc0..c27c92b 100644 --- a/core/module-store.c +++ b/core/module-store.c @@ -1,17 +1,18 @@ #include "module-store.h" +#include static PureResult state(void *context, const char *name, PureDraft **out) { return pure_state_open(context, name, out); } -enum { SAVED = 2 * PURE_MODULE_STATES + 3 }; - -/* The app's changed states in one tree commit. */ +/* The app's changed states in one tree commit (their revisions on the stack for a few). */ static PureResult save(void *context, PureDraft *const *states, size_t count) { (void)context; - int64_t revisions[SAVED]; - if (count > SAVED) return PURE_LIMIT; - return pure_draft_commit_all(states, count, revisions); + int64_t few[67], *revisions = count <= 67 ? few : malloc(count * sizeof(*revisions)); + if (!revisions) return PURE_ALLOCATION; + PureResult result = pure_draft_commit_all(states, count, revisions); + if (revisions != few) free(revisions); + return result; } static const char *path_directory(void *context) { return context; } -- cgit v1.2.3