aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-list.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-05 07:43:22 +0100
committereunhhu <[email protected]>2026-10-05 07:43:22 +0100
commit2dc0a4df9485c0a4c08859ad81f41d6efab98dd5 (patch)
tree0b35c0993f0da03eee9d6b89f56d9b4ae6c15105 /core/module-list.c
parent75b9c1c1e936e2b7c55275139897e1c78d7939c1 (diff)
downloadpure-2dc0a4df9485c0a4c08859ad81f41d6efab98dd5.tar.gz
pure-2dc0a4df9485c0a4c08859ad81f41d6efab98dd5.zip
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.
Diffstat (limited to 'core/module-list.c')
-rw-r--r--core/module-list.c7
1 files changed, 7 insertions, 0 deletions
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 <math.h>
+#include <stddef.h>
#include <stdlib.h>
#include <string.h>
@@ -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 */