From 63ff1aacf764e692a7a29a7c0043278f637f1dbb Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 07:30:53 +0330 Subject: x86-64 jit: inline new_k, recycle_leaf and own fast paths, in o3 regions and plain blocks a call to rt.new_k / rt.recycle_leaf with a constant class, or to rt.own, does its class-list pop or push (or owner store) inline and goes on after the call; an empty list, memdebug, a held range, a block outside memory, a translated word or a type/class mismatch takes the ordinary call. in a region this replaces the o3_invoke round trip. o3 frees of leaf objects now use recycle_leaf too (new_k stamps the type inside o3 since b86db60). ZYNOFASTALLOC=1 turns it off; ZYPERFMAP=1 writes a perf map of translated code. tests/programs/o3_freelist.zc: reuse, zeroing, an empty list, untyped neighbours, memdebug; jit vs ZYNOFASTALLOC vs ZYO3INTERP. --- src/core/stack.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/core/stack.h') diff --git a/src/core/stack.h b/src/core/stack.h index 8c7f7a2..dbc718a 100644 --- a/src/core/stack.h +++ b/src/core/stack.h @@ -15,6 +15,11 @@ enum { SC_RETURN_LOW, SC_RETURN_TOP, SC_RETURN_NODE, SC_FREE, SC_STOP, SC_BUMP, SC_MAX, SC_HOLD_LOW, SC_HOLD_HIGH, SC_CUT, SC_GC_ACTIVE, SC_COUNT }; +/* optional words after the registered ones, for the native allocator fast paths + in compiled o3 regions: a tag (a runtime without them never has it there), the + address of rt.dbg, and the entry addresses of rt.new_k, rt.recycle_leaf and rt.own */ +enum { SC_FAST = SC_COUNT, SC_DBG, SC_NEW_K, SC_RECYCLE_LEAF, SC_OWN, SC_FAST_END }; +#define SC_FAST_TAG 0x2B7E1517 /* the including core supplies stack_memory_grow and refreshes m if it moves. */ static Cell stack_get(int slot) { Cell p = m[stack_control + slot]; return inmem(p) ? m[p] : 0; } -- cgit v1.2.3