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-run.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'core/module-run.h') diff --git a/core/module-run.h b/core/module-run.h index 49bdf35..453c342 100644 --- a/core/module-run.h +++ b/core/module-run.h @@ -8,6 +8,10 @@ /* An item's or a key's op->plan: its cell a text; a FIND joined to the ITEM_GET after it. */ enum { PLAN_TEXT = 1, PLAN_JOINED = 2 }; +/* An item instruction's argument: its list and its field. */ +static inline uint32_t list_of(uint32_t arg) { return arg & 0xFFFF; } +static inline uint32_t item_field(uint32_t arg) { return arg >> 16; } + typedef struct { union { double num; int64_t i64; }; PureBytes bytes; } Slot; /* A walk (EACH): the list, the item it runs for, where it ends (items the @@ -84,6 +88,12 @@ int pure_run_loop(Frame *, uint32_t pc); void pure_run_break(Frame *); int pure_run_iterate(Frame *); +/* Where a list keeps what compiled code reads of it (module-list.c owns the + * layout and says where): its item count, its key set (the words, how many, + * whether they are bits), its form (pure_list_form) and its arrays. */ +enum { LIST_COUNT_AT, LIST_MEMBERS_AT, LIST_MEMBER_CAPACITY_AT, LIST_BITMAP_AT, LIST_FORM_AT, LIST_COLUMNS_AT }; +extern const size_t pure_list_layout[]; + /* A module's code compiled (AArch64 Linux; elsewhere, or with PURE_JIT=0 in * the environment, none): a block's code runs a frame as run does, giving how * it went (a STEP_). */ -- cgit v1.2.3