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/compiler/analyzer.zc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/analyzer.zc b/src/compiler/analyzer.zc index 8ceaf09..42cb7b5 100644 --- a/src/compiler/analyzer.zc +++ b/src/compiler/analyzer.zc @@ -1004,7 +1004,7 @@ int freevar(int i) { if (o3on && fchk && ldroppable(i)) cerrn(i, "has drop and can't end inside an o3 region"); if (local_captured && local_captured[i]) { lit(0); laddr(lslot[i]); op(O_ST); return 0; } vaddr(i); op(O_LD); - if (lleaf[i] && !o3on && !dry && lookup(s_recycle_leaf) >= 0) { + if (lleaf[i] && !dry && lookup(s_recycle_leaf) >= 0) { // o3 too: new_k stamps the type there as well lit(lleaf[i]); lit(szclass(lnsz[i])); callname(s_recycle_leaf); @@ -1434,7 +1434,7 @@ int reassign_free(int i, int rc, int bor) { // freevar without its clearing store: the new value is stored next, through // the address taken before the right side (a captured local's slot holds its cell) vaddr(i); op(O_LD); - if (lleaf[i] && !o3on && !dry && lookup(s_recycle_leaf) >= 0) { lit(lleaf[i]); lit(szclass(lnsz[i])); callname(s_recycle_leaf); } + if (lleaf[i] && !dry && lookup(s_recycle_leaf) >= 0) { lit(lleaf[i]); lit(szclass(lnsz[i])); callname(s_recycle_leaf); } else callname(s_recycle); op(O_DROP); end_owner(i); -- cgit v1.2.3