aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-save.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-19 00:16:56 +0100
committereunhhu <[email protected]>2026-10-19 00:16:56 +0100
commit3cc6bc3d8a1d8827519decbf7e084e89110c93f9 (patch)
treeeb2aa0a0df93815a562e270696b6de3717198c0f /core/module-save.h
parentd7caf4dfb1947d8f804e3d8ae7ef066c6e3b8fb7 (diff)
downloadpure-3cc6bc3d8a1d8827519decbf7e084e89110c93f9.tar.gz
pure-3cc6bc3d8a1d8827519decbf7e084e89110c93f9.zip
027's 4f-3b: no fixed count of records or of their fields in all: the header's u16s alone (16 and 128 before); a stored list's record graph (PureLayout) holds a few records itself and more on the heap, 256 at most (an image numbers them in a byte), an image or a checkpoint not written then without room for it; a record's 16 fields kept, the list engine's width (a leaf's columns, a run's columns and narrow cells, the arrays' and packs' columns), to be widened with the lists' shapes sized to their fields; unit tests: 20 records of 10 fields (200 in all), an item of the last appended; a stored list whose six records each hold a list of the next saved and read back after a restart (its graph on the heap); counts: b41 against b40 with batches BFS +0.12%, without BFS -0.09%, the rest within 0.001%; the bank's queries (s40 and s41 in turns, six each) within 0.09% (the first three's in_credit +1.16% its spread: 2.75% between runs of one build); 008 and 027
Diffstat (limited to 'core/module-save.h')
-rw-r--r--core/module-save.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/core/module-save.h b/core/module-save.h
index 4ec50a2..44d3b95 100644
--- a/core/module-save.h
+++ b/core/module-save.h
@@ -79,15 +79,25 @@ uint8_t pure_record_kind(const PureModule *, uint32_t field);
* order its list fields first meet them, each its fields' kinds (PURE_CELL_...) and names, and a list field's items'
* record by its number here. A module's graph knows each record's number in the module too. */
typedef struct {
- unsigned records;
- struct {
- unsigned count;
- uint8_t kinds[PURE_RECORD_FIELDS], items[PURE_RECORD_FIELDS];
- char names[PURE_RECORD_FIELDS][PURE_MODULE_NAME];
- } record[PURE_MODULE_RECORDS];
- uint16_t module_record[PURE_MODULE_RECORDS];
+ unsigned count;
+ uint8_t kinds[PURE_RECORD_FIELDS], items[PURE_RECORD_FIELDS];
+ char names[PURE_RECORD_FIELDS][PURE_MODULE_NAME];
+} PureLayoutRecord;
+/* Its records in record (a few in few, more on the heap: room of them), at most 256 (a store numbers them in a byte),
+ * module_record beside them. Begun (pure_layout_begin) before use, done (pure_layout_done) after; never copied. */
+typedef struct {
+ unsigned records, room;
+ PureLayoutRecord *record;
+ uint16_t *module_record;
+ PureLayoutRecord few[4];
+ uint16_t few_records[4];
} PureLayout;
-void pure_layout_of(const PureModule *, uint32_t record, PureLayout *out);
+enum { PURE_LAYOUT_RECORDS = 256 };
+void pure_layout_begin(PureLayout *);
+bool pure_layout_room(PureLayout *, unsigned records); /* false without room, or past PURE_LAYOUT_RECORDS */
+void pure_layout_done(PureLayout *);
+/* false: no room, or a graph of more than PURE_LAYOUT_RECORDS records. */
+bool pure_layout_of(const PureModule *, uint32_t record, PureLayout *out);
bool pure_layout_same(const PureLayout *, const PureLayout *);
/* A list with record's fields, taking from `from` (laid out as from_layout's record 0) each field of the same name and
* kind, or a number, a bool and an i64 from each other when the value fits (pure_cell_as), and giving the others their