aboutsummaryrefslogtreecommitdiffstats
path: root/core/module-jit.c
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-05 07:53:22 +0100
committereunhhu <[email protected]>2026-10-05 07:53:22 +0100
commit6c641903b089d81fb193c3949ccc677b701bc55b (patch)
tree31aa8442c04bebeccb414838ebccf186ea5eb062 /core/module-jit.c
parent2dc0a4df9485c0a4c08859ad81f41d6efab98dd5 (diff)
downloadpure-6c641903b089d81fb193c3949ccc677b701bc55b.tar.gz
pure-6c641903b089d81fb193c3949ccc677b701bc55b.zip
Read a tree's items in compiled code from a run the frame keeps, start a run at the finger's leaf, and move indices only for a list an index refers to (021)
- The frame keeps the run compiled code read a tree's item from last (the list as it was: its version); an item it holds is read from its column, else pure_run_item takes the item's run and steps. - pure_list_run starts at the leaf the finger keeps when it holds the position (a slice found by key just before): no second descent; the run after it is found from the root (PureRun.pathless). - LIST_APPEND and LIST_REMOVE move index states only for a list one refers to. - A search (core only): 89 ms compiled (answers the executor's).
Diffstat (limited to 'core/module-jit.c')
-rw-r--r--core/module-jit.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/core/module-jit.c b/core/module-jit.c
index a6ab7f1..8e50eb0 100644
--- a/core/module-jit.c
+++ b/core/module-jit.c
@@ -557,13 +557,38 @@ static void compile_op(Block *k, uint32_t pc) {
bind(e, done);
return;
}
- case PURE_OP_ITEM_GET: { /* a FLAT list's cell by its column */
+ case PURE_OP_ITEM_GET: { /* a FLAT list's cell by its column, a tree's from the run kept */
if (op->plan & PLAN_TEXT) break;
- int slow = new_label(e), done = new_label(e);
+ int slow = new_label(e), done = new_label(e), flat = new_label(e), refill = new_label(e);
+ size_t field = item_field(arg) * sizeof(void *);
load64(e, X10, X24, list_of(arg) * sizeof(PureList *));
load8(e, X12, X10, pure_list_layout[LIST_FORM_AT]);
cmp_w_imm(e, X12, 1); /* FLAT */
- b_cond(e, NE, slow);
+ b_cond(e, EQ, flat);
+ cbnz_w(e, X12, slow); /* DENSE */
+ load_d(e, D0, X20, AT(height - 1));
+ fp2(e, FCVTZU_X, X13, D0);
+ load64(e, X11, X19, offsetof(Frame, run.list));
+ cmp_reg(e, X11, X10);
+ b_cond(e, NE, refill);
+ load64(e, X11, X19, offsetof(Frame, run.version));
+ load64(e, X12, X10, pure_list_layout[LIST_VERSION_AT]);
+ cmp_reg(e, X11, X12);
+ b_cond(e, NE, refill);
+ load64(e, X11, X19, offsetof(Frame, run.start));
+ sub_reg(e, X14, X13, X11);
+ load64(e, X11, X19, offsetof(Frame, run.count));
+ cmp_reg(e, X14, X11);
+ b_cond(e, HS, refill);
+ load64(e, X15, X19, offsetof(Frame, run.columns) + field);
+ load64_index(e, X9, X15, X14);
+ store64(e, X9, X20, AT(height - 1));
+ b(e, done);
+ bind(e, refill);
+ call_step(k, (uintptr_t)pure_run_item, pc, height);
+ cbnz_w(e, X0, k->exit);
+ b(e, done);
+ bind(e, flat);
load_d(e, D0, X20, AT(height - 1));
fp2(e, FCVTZU_X, X13, D0);
load64(e, X12, X10, pure_list_layout[LIST_COUNT_AT]);