Debian Codegraph @

rpython/jit/backend/riscv/test/test_recursive.py

raw symbols SCIP
1 #!/usr/bin/env python
2
3 from rpython.jit.backend.llsupport.codemap import unpack_traceback
4 from rpython.jit.backend.riscv.test.test_basic import JitRISCVMixin
5 from rpython.jit.metainterp.test.test_recursive import RecursiveTests
6
7
8 class TestRecursive(JitRISCVMixin, RecursiveTests):
9 # for the individual tests see
10 # ====> ../../../metainterp/test/test_recursive.py
11
12 def check_get_unique_id(self, codemaps):
13 assert len(codemaps) == 3
14 # we want to create a map of differences, so unpacking the tracebacks
15 # byte by byte
16 codemaps.sort(lambda a, b: cmp(a[1], b[1]))
17 # biggest is the big loop, smallest is the bridge
18 def get_ranges(c):
19 ranges = []
20 prev_traceback = None
21 for b in range(c[0], c[0] + c[1]):
22 tb = unpack_traceback(b)
23 if tb != prev_traceback:
24 ranges.append(tb)
25 prev_traceback = tb
26 return ranges
27 assert get_ranges(codemaps[2]) == [[4], [4, 2], [4]]
28 assert get_ranges(codemaps[1]) == [[2]]
29 assert get_ranges(codemaps[0]) == [[2], []]