aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-list.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-05 16:07:48 +0100
committereunhhu <[email protected]>2026-10-05 16:07:48 +0100
commit6cd7f5a415f9286ae4bec58545dccd89a15ef46d (patch)
tree826d39f784273751d9ce1c5c70701ca8158b6d7c /core/module-list.c
parent5aaed2a58d0b5c3dea22b9f915eb02a823db49ac (diff)
downloadpure-6cd7f5a415f9286ae4bec58545dccd89a15ef46d.tar.gz
pure-6cd7f5a415f9286ae4bec58545dccd89a15ef46d.zip
The tier, first (023): a nest of loops as SSA, its stack, locals and states values in registers (x20-x28 too, the frame's read again where it ends), whole numbers integers by their facts, the message's fields and lists' columns read once, invariants made before inner loops; where anything does not hold it gives up to the executor at the instruction (pure_run_rest) and the generic code goes on. roots 22.9 to 14.0 ms, knapsack 1,030 to 38.8, matmul 908 to 48.6; module_tier checks random handlers against the executor
Diffstat (limited to 'core/module-list.c')
-rw-r--r--core/module-list.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/core/module-list.c b/core/module-list.c
index c965c6d..db79802 100644
--- a/core/module-list.c
+++ b/core/module-list.c
@@ -1506,6 +1506,19 @@ void pure_list_clear(PureList *list) {
(void)members_start(list);
}
+bool pure_list_full(PureList *list) { return list->form == DENSE && list->count && dense_keys(list) && list->full; }
+
+bool pure_list_suits(PureList *list, unsigned needs, unsigned narrow) {
+ if (list->form == DENSE && !dense_keys(list)) return false; /* its keys counted: full as it is (the tier reads it, LIST_FULL_AT) */
+ if (needs & 1 && list->form != DENSE) return false; /* by key: at its keys */
+ if (needs & 2 && list->form != FLAT && !(list->form == DENSE && dense_keys(list) && list->full)) return false; /* by position */
+ if (needs & 4 && !(list->form == DENSE && dense_keys(list) && list->full)) return false; /* a key its position */
+ if (list->form != FLAT && list->form != DENSE) return false;
+ for (unsigned f = 0; f < list->layout.fields; ++f)
+ if (narrow >> f & 1 && list->width[f] != 1 && list->width[f] != 4) return false;
+ return true;
+}
+
bool pure_list_hashed(PureList *list) {
const Layout *l = &list->layout;
if (list->members) return true;
@@ -1560,7 +1573,7 @@ const size_t pure_list_layout[] = {
[LIST_FORM_AT] = offsetof(PureList, form), [LIST_COLUMNS_AT] = offsetof(PureList, columns),
[LIST_VERSION_AT] = offsetof(PureList, version), [LIST_ROOM_AT] = offsetof(PureList, room),
[LIST_MEMBER_COUNT_AT] = offsetof(PureList, member_count), [LIST_BYTES_AT] = offsetof(PureList, bytes),
- [LIST_PACK_AT] = offsetof(PureList, pack), [LIST_WIDTH_AT] = offsetof(PureList, width)};
+ [LIST_PACK_AT] = offsetof(PureList, pack), [LIST_WIDTH_AT] = offsetof(PureList, width), [LIST_FULL_AT] = offsetof(PureList, full)};
const size_t pure_pack_layout[] = {
[PACK_FIRST_AT] = offsetof(Pack, first), [PACK_WHOLE_AT] = offsetof(Pack, whole), [PACK_SHIFT_AT] = offsetof(Pack, shift),