aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-save.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-18 23:29:42 +0100
committereunhhu <[email protected]>2026-10-18 23:29:42 +0100
commitff2e0823e97d10477341192d72f5d9e61d9d5bad (patch)
treea882cce6e799ab2096ed3d3722e01ec357764e9b /core/module-save.h
parent1d255b735e92c2d6b360ed5ea150a1e42f6dd535 (diff)
downloadpure-ff2e0823e97d10477341192d72f5d9e61d9d5bad.tar.gz
pure-ff2e0823e97d10477341192d72f5d9e61d9d5bad.zip
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
Diffstat (limited to 'core/module-save.h')
-rw-r--r--core/module-save.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/module-save.h b/core/module-save.h
index 83ffe60..4ec50a2 100644
--- a/core/module-save.h
+++ b/core/module-save.h
@@ -95,4 +95,13 @@ bool pure_layout_same(const PureLayout *, const PureLayout *);
* them in their stored form, else an event's, holding none yet). */
PureResult pure_list_migrate(PureList **out, const PureList *from, const PureLayout *from_layout, const PureModule *m,
uint32_t record, bool kept);
+/* A stored list's place (a state's number, PURE_LIST_HEARD or PURE_LIST_OUTBOX) and its slot in an app's arrays of
+ * them (its states', then the runtime's two), and how many slots (027's 4f-2). */
+static inline size_t pure_slot(const PureApp *app, uint32_t place) {
+ return place >= PURE_LIST_HEARD ? app->laid + (place - PURE_LIST_HEARD) : place;
+}
+static inline uint32_t pure_place(const PureApp *app, size_t slot) {
+ return slot < app->laid ? (uint32_t)slot : PURE_LIST_HEARD + (uint32_t)(slot - app->laid);
+}
+static inline size_t pure_slots(const PureApp *app) { return (size_t)app->laid + PURE_LIST_RUNTIME; }
#endif