aboutsummaryrefslogtreecommitdiff
path: root/tests/test.sh
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 /tests/test.sh
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 'tests/test.sh')
-rwxr-xr-xtests/test.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test.sh b/tests/test.sh
index 6992c0d..8bf7a9b 100755
--- a/tests/test.sh
+++ b/tests/test.sh
@@ -103,6 +103,8 @@ run(){ # $1 = vm command, $2 = label
chk "$($vm < examples/typed.zc | tr '\n' '/')" "last: 4/point is 2 words: x int, y int/vec<point*> is 3 words: len int, cap int, items point**/push is bool(vec<T>*, T.d)/the heap says v is a vec<point*>, and v.items[0] is a point/" "$l typed example"
chk "$($vm < examples/wiring.zc)" "16 1234 25 4/9" "$l enhancement example"
chk "$($vm < tests/programs/allocfast.zc)" "0 0 499500 0" "$l constant-size allocation fast path"
+ chk "$($vm < tests/programs/o3_freelist.zc)" "0 0 1 12502500 500 1" "$l o3 new and free: class-list reuse, zeroing, an empty list, untyped neighbours"
+ chk "$(sed 's/^include rt;$/include rt;\nmemdebug on;/' tests/programs/o3_freelist.zc | $vm)" "0 0 1 12502500 500 1" "$l o3 new and free under memdebug take the general path"
chk "$($vm < tests/programs/basics.zc | tr '\n' '/')" "285 610 42 512/hey 65 -3 -2 1024 -8/12456/757/9 100-101/5/ok/" "$l language basics"
chk "$($vm < tests/programs/umd.zc)" "100 6 0 15 99 5 5" "$l u m d lifetimes"
chk "$($vm < tests/programs/names.zc)" "12 1 8" "$l u, m and d are ordinary names"
@@ -523,7 +525,9 @@ s_jit() {
chk $r 0 "x86-64 jit agrees with the interpreter: $(tail -n 1 $T/jit_x64.out)"
chk "$(ZYNOENH=1 $T/zyx < tests/programs/enh_ops.zc | md5sum)" "$(md5sum < tests/programs/enh_ops.expected)" "x86-64 jit with enhancements called through xrun (ZYNOENH=1)"
chk "$(ZYTRACE=1 $T/zyx < tests/programs/o3.zc 2>&1 | grep -c 'bytes of x86-64')" "7" "x86-64 jit compiles the o3 regions it can (one has too many live values)"
- for p in o3 o3copy o3licm o3push o3bytes fo3 o3call o3deep; do
+ chk "$(ZYTRACE=1 $T/zyx < tests/programs/o3_freelist.zc 2>&1 | grep -c ' inline at ')" "11" "x86-64 jit inlines new_k and recycle_leaf in compiled o3 regions"
+ chk "$(ZYNOFASTALLOC=1 $T/zyx < tests/programs/o3_freelist.zc 2>&1)" "$($T/zyx < tests/programs/o3_freelist.zc 2>&1)" "x86-64 o3 inline allocation matches the plain calls (ZYNOFASTALLOC=1)"
+ for p in o3 o3copy o3licm o3push o3bytes fo3 o3call o3deep o3_freelist; do
chk "$($T/zyx < tests/programs/$p.zc 2>&1)" "$(ZYO3INTERP=1 $T/zyx < tests/programs/$p.zc 2>&1)" "x86-64 o3 code matches the region interpreter (ZYO3INTERP=1): $p"
done
fi