From d7caf4dfb1947d8f804e3d8ae7ef066c6e3b8fb7 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Sun, 18 Oct 2026 23:54:06 +0100 Subject: 027's 4f-3a: no fixed count of inputs, views (the load's columns among them, in u16s), handlers or message fields: the header's u16s alone; a message's fields at most 64 (PURE_MESSAGE_FIELDS: a send pushes them all, as the stored sends' shapes hold them), outputs at most 255 (the store names them in a byte's count: the links and the outbox's image), the numbers of outputs a module dropped carried within it; an app's numbers of each input (last sent, saved, where the event began) in a block sized to its module's inputs (by_input), a replace laying the new one first and filling it by output name; image headers sized to the module (header_room); a view's arguments u32, a made column's field u16; pure-serve's timers grow to the module's inputs, its outlets and known senders its own count (OUTLETS, 32), a list view's JSON keys its columns on the stack for 64, else on the heap; unit test: 40 inputs and 70 views, the last of each used; counts: b40 against b39b within 0.01% with batches and without but BFS +0.09%; the bank's queries (s39b and s40 in turns, three each) in_credit -0.64%, per_branch -0.37%, field +0.34%, the rest within 0.22%; 008 and 027 --- core/module.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'core/module.h') diff --git a/core/module.h b/core/module.h index 645fb71..8de3e33 100644 --- a/core/module.h +++ b/core/module.h @@ -14,10 +14,10 @@ * belongs to), stack heights and the stack at every join, forward-only * branches, names, records, tables, constants and effects. */ enum { - PURE_MODULE_INPUTS = 32, PURE_MODULE_VIEWS = 64, - PURE_MODULE_HANDLERS = 64, PURE_MODULE_CODE = 65535, PURE_MODULE_STACK = 64, + PURE_MODULE_CODE = 65535, PURE_MODULE_STACK = 64, PURE_MODULE_NAME = 32, PURE_MODULE_STRINGS = 32768, PURE_MODULE_HEADER = 38, - PURE_MODULE_FIELDS = 64, PURE_MODULE_CONSTANTS = 4096, + /* A message's fields at most: a send pushes them all (the stack's), a width of the stored sends too (027's 4f-3a). */ + PURE_MESSAGE_FIELDS = PURE_MODULE_STACK, PURE_MODULE_CONSTANTS = 4096, PURE_MODULE_CONSTANT_BYTES = 1 << 20, PURE_MODULE_RECORDS = 16, PURE_MODULE_RECORD_FIELDS = 128, PURE_RECORD_FIELDS = 16, PURE_MODULE_JOINS = 8 }; @@ -403,11 +403,11 @@ typedef struct { uint16_t *view_table; /* a column's list view + 1, or 0 */ uint16_t *view_list; /* the list state of a list view over one, or its column's */ uint16_t *view_record; /* a list view's or a list column's items' record + 1 (a map's: 0) */ - uint8_t *view_field; /* a column the load made: its item's field + 1 (read as it is), or 0 */ + uint16_t *view_field; /* a column the load made: its item's field + 1 (read as it is), or 0 */ bool *view_computed; /* a list view whose code leaves its list (a column's: its view's) */ PureBlock *view_code; uint8_t *view_plan; /* a table's filter runs a leaf of its list at once (as a fold may) */ - uint8_t *view_arguments; /* the input of a view's arguments + 1 (a column's: its table's), or 0 */ + uint32_t *view_arguments; /* the input of a view's arguments + 1 (a column's: its table's), or 0 */ /* Set at load: a view's code computes (its locals and loops: a body), and the event's lists it changes (a set of * states, state_words for each view). */ bool *view_body; @@ -469,7 +469,7 @@ uint32_t pure_module_shape(const PureModule *, uint32_t input); /* An input's (or output's) fields as a sender names them to a receiver: u8 * count, each field's {u8 type, u8 name length, name}. Its size (at most * PURE_FIELDS_NAMED), written to out. */ -enum { PURE_FIELDS_NAMED = 1 + PURE_MODULE_FIELDS * (2 + PURE_MODULE_NAME) }; +enum { PURE_FIELDS_NAMED = 1 + PURE_MESSAGE_FIELDS * (2 + PURE_MODULE_NAME) }; size_t pure_module_fields(const PureModule *, uint32_t input, unsigned char out[PURE_FIELDS_NAMED]); /* Whether input takes messages laid out with the fields named (as * pure_module_fields names them): it has every one by name, of the same type @@ -585,7 +585,7 @@ typedef struct { PureList *outbox; size_t sent_saved, durable_sent_saved, durable_outbox; uint64_t sends_gone; /* how many ever left it: a host's places in it move back at most that many */ - uint64_t last_sent[PURE_MODULE_INPUTS], saved_sent[PURE_MODULE_INPUTS]; + uint64_t *last_sent, *saved_sent; /* each input's (by_input), an output's numbers */ struct PureCarried { char name[PURE_MODULE_NAME]; uint64_t last; } *carried; unsigned carried_count; /* The last number delivered from each source: a list of {source (text), @@ -602,7 +602,7 @@ typedef struct { * none), where their fields are, and a count of the times they were given. */ unsigned argued; PureSpan arguments; - uint32_t argument_spans[PURE_MODULE_FIELDS][2]; + uint32_t argument_spans[PURE_MESSAGE_FIELDS][2]; uint64_t arguments_given; /* Passes over lists that answer shaped folds, by the list's version. */ struct PurePass *passes; @@ -622,8 +622,12 @@ typedef struct { struct { unsigned char **blocks; size_t *sizes; unsigned count, at; size_t used; } calls; struct PureSpare { PureList **lists; unsigned count, capacity; } *spare; PureValue *pending; /* the values an event works on until it ends */ - PureVersion *marked_texts; /* where the event running began: each text's version, each stored list's journal */ + PureVersion *marked_texts; /* where the event running began: each text's version, each stored list's journal, */ size_t *marked_lists; + /* Each input's: its last number sent and as saved, and where the event running began; one block (by_input) for + * the inputs of the module it was laid out for (027's 4f-3a). */ + uint64_t *marked_sent; + void *by_input; } PureApp; PureResult pure_app_start(PureApp *, const PureModule *, PureData data); -- cgit v1.2.3