From 7c54e48bca711a6596be4bb17fcaa4330b9928e3 Mon Sep 17 00:00:00 2001 From: zinc Date: Wed, 14 Oct 2026 15:52:01 +0330 Subject: line tables and backtraces: port agent/line-tables onto main, op 56 on the x86-64 jit, docs, measurements, tests; default genome reservation 0x68000 --- tests/programs/trace_jit.zc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tests/programs/trace_jit.zc (limited to 'tests/programs/trace_jit.zc') diff --git a/tests/programs/trace_jit.zc b/tests/programs/trace_jit.zc new file mode 100644 index 0000000..e864c50 --- /dev/null +++ b/tests/programs/trace_jit.zc @@ -0,0 +1,24 @@ +namespace; +include rt; + +// a hot path: the jits have translated down() and the loop in main long before +// the last call, so the return stack pointer comes from translated code (op 56 +// reads it at the gate store, cb_r on both jits) +int down(int n, int last) { + if (n == 0) { + if (last) rt.trace(); + return 1; + } + return down(n - 1, last) + 1; +} + +int main() { + int i = 0, s = 0; + while (i < 5000) { + s = s + down(3, i == 4999); + i++; + } + rt.put_n(s); + rt.put_c(10); + return 0; +} -- cgit v1.2.3