diff options
| author | 2026-10-14 15:54:04 +0330 | |
|---|---|---|
| committer | 2026-10-14 15:54:04 +0330 | |
| commit | 0879d0a42d137054057cd2a1e37437e6be78ed0b (patch) | |
| tree | fcb16d3185c1f80fae8d54cd9062bd68d6c0c88d /tests/programs/trace_jit.zc | |
| parent | merge spec conformance suite (diff) | |
| parent | merge main into work/line-tables (diff) | |
merge line tables
Diffstat (limited to 'tests/programs/trace_jit.zc')
| -rw-r--r-- | tests/programs/trace_jit.zc | 24 |
1 files changed, 24 insertions, 0 deletions
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; +} |
