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.zc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/programs/trace.zc (limited to 'tests/programs/trace.zc') diff --git a/tests/programs/trace.zc b/tests/programs/trace.zc new file mode 100644 index 0000000..c283f75 --- /dev/null +++ b/tests/programs/trace.zc @@ -0,0 +1,36 @@ +namespace; +include rt; + +int get(int[?] t, int i) { + return t[i]; +} + +int sum(int[?] t, int n) { + int s = 0, i = 0; + while (i < n) { + s = s + get(t, i); + i++; + } + return s; +} + +int where() { + rt.trace(); + return 1; +} + +int outer() { + int r = where(); + return r; +} + +int main() { + int[?] t = rt.new(int[?]); + t.push(1); t.push(2); t.push(3); t.push(4); + rt.put_n(outer()); + rt.put_c(10); + rt.put_n(sum(t, 4)); + rt.put_c(10); + rt.put_n(sum(t, 5)); + return 0; +} -- cgit v1.2.3