aboutsummaryrefslogtreecommitdiff
path: root/src/core/stack.h
diff options
context:
space:
mode:
authorGravatar zinc <zinc@downsta.ir> 2026-10-15 07:30:53 +0330
committerGravatar zinc <zinc@downsta.ir> 2026-10-15 07:30:53 +0330
commit63ff1aacf764e692a7a29a7c0043278f637f1dbb (patch)
tree4aa3e31f2b3892def6cc00dfb73eb243311c0adc /src/core/stack.h
parentrt: recycle, new_k and own without helper calls or || chains (diff)
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.
Diffstat (limited to 'src/core/stack.h')
-rw-r--r--src/core/stack.h5
1 files changed, 5 insertions, 0 deletions
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; }