From 2dc0a4df9485c0a4c08859ad81f41d6efab98dd5 Mon Sep 17 00:00:00 2001 From: eunhhu Date: Mon, 5 Oct 2026 07:43:22 +0100 Subject: Write the hot instructions as code: constants, states, locals, rows, arithmetic, has by bits, a DENSE field by key, a FLAT item, and loop iterations (021) - module-jit.c writes CONST, LOAD, STORE, the local and row loads, INDEX_FIRST, LIST_COUNT, INDEX_MOVE, NOT, NEG, FLOOR, the number arithmetic and comparisons (DIVIDE and NON_FINITE faults where the executor gives them), LIST_HAS by a key set's bits, a joined FIND's field of a DENSE list, a FLAT list's ITEM_GET, and a walk's and a count's iteration (work charged as the executor charges it). Anything else, or a list in another form, still calls step. - module-list.c says where a list keeps what the code reads (pure_list_layout); list_of and item_field are shared. - PURE_JIT_DUMP=file writes the code made, to read with objdump. - A search (core only): 103 ms compiled, 122 ms executed; the answers (hops, reached, work) are the executor's. --- core/module-list.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/module-list.c') diff --git a/core/module-list.c b/core/module-list.c index 3b9ca38..7bf05e1 100644 --- a/core/module-list.c +++ b/core/module-list.c @@ -1,6 +1,8 @@ #include "module-list.h" +#include "module-run.h" #include "module-text.h" #include +#include #include #include @@ -1132,6 +1134,11 @@ bool pure_list_arrays(PureList *list) { unsigned pure_list_form(const PureList *list) { return list->form; } +const size_t pure_list_layout[] = { + [LIST_COUNT_AT] = offsetof(PureList, count), [LIST_MEMBERS_AT] = offsetof(PureList, members), + [LIST_MEMBER_CAPACITY_AT] = offsetof(PureList, member_capacity), [LIST_BITMAP_AT] = offsetof(PureList, bitmap), + [LIST_FORM_AT] = offsetof(PureList, form), [LIST_COLUMNS_AT] = offsetof(PureList, columns)}; + bool pure_list_lookup(const PureList *list, unsigned key_field, PureCell key, unsigned field, PureCell *cell) { bool found; if (list->form == DENSE && (int)key_field == list->layout.key) { /* at its key, by its bits */ -- cgit v1.2.3