diff options
| author | eunhhu <[email protected]> | 2026-10-18 17:45:16 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-18 17:45:16 +0100 |
| commit | d5f0cac74721863a91b0a799256b62c0b7b2a3c1 (patch) | |
| tree | 4c97847d2accad5bbc66b947222b4fb242eeee8a /core/module-save.c | |
| parent | d8e297452d8e0896d4733e09b70fdc3e6ce08a55 (diff) | |
| download | pure-d5f0cac74721863a91b0a799256b62c0b7b2a3c1.tar.gz pure-d5f0cac74721863a91b0a799256b62c0b7b2a3c1.zip | |
Module executor: a kept list's lists through steps of their own (027's stage 3): the load gives ITEM_GET and ITEM_SET of a kept list's list field, and LIST_APPEND, LIST_INSERT and APPEND_IN of a kept list whose record holds lists, numbers past the module's (OP_KEPT_*, after verifying and planning: no module holds them, the JIT leaves their blocks to the executor), so the instructions' own steps are as before stage 3; the list module holds a list field's value as bytes (PURE_CELL_LIST only in images' headers and layouts) and text_field is a text's alone again: the stage 3 commit had cost BFS 1.4% of its instructions with batches and 1.7% without (its millions of appends asking each field twice), the five works now within 0.04% of before it
Diffstat (limited to 'core/module-save.c')
| -rw-r--r-- | core/module-save.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/module-save.c b/core/module-save.c index 2b3bd73..3b1284c 100644 --- a/core/module-save.c +++ b/core/module-save.c @@ -532,7 +532,10 @@ PURE_COLD PureResult pure_save_open_list(PureApp *app, const PureModule *m, uint } PureList *from = NULL; if (result == PURE_OK && stored) { - from = pure_list_new(count, stored_layout.record[0].kinds); + uint8_t held[PURE_RECORD_FIELDS]; /* a list field's value held as bytes */ + for (unsigned f = 0; f < count; ++f) + held[f] = stored_layout.record[0].kinds[f] == PURE_CELL_LIST ? PURE_CELL_BYTES : stored_layout.record[0].kinds[f]; + from = pure_list_new(count, held); result = from ? pure_list_read(from, bytes + at, items) : PURE_ALLOCATION; if (result == PURE_OK && !image) result = pure_list_replay(from, bytes + at + items, size - at - items); } @@ -566,7 +569,8 @@ PURE_COLD PureResult pure_save_open_list(PureApp *app, const PureModule *m, uint } else if (from) result = pure_list_migrate(out, from, &stored_layout, m, record, true); else { uint8_t own[PURE_RECORD_FIELDS]; - for (unsigned f = 0; f < r->count; ++f) own[f] = pure_record_kind(m, r->first + f); + for (unsigned f = 0; f < r->count; ++f) + own[f] = pure_record_kind(m, r->first + f) == PURE_CELL_LIST ? PURE_CELL_BYTES : pure_record_kind(m, r->first + f); if (!(*out = pure_list_new(r->count, own))) result = PURE_ALLOCATION; } } |
