Debian Codegraph @

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

raw symbols SCIP
1
2 from rpython.jit.metainterp.test.test_recursive import RecursiveTests
3 from rpython.jit.backend.x86.test.test_basic import Jit386Mixin
4 from rpython.jit.backend.llsupport.codemap import unpack_traceback
5 from rpython.jit.backend.x86.arch import WORD, WIN64
6
7 class TestRecursive(Jit386Mixin, RecursiveTests):
8 # for the individual tests see
9 # ====> ../../../metainterp/test/test_recursive.py
10 def check_get_unique_id(self, codemaps):
11 if WORD == 4:
12 import py; py.test.skip("this is 64 bit only check")
13 if WIN64 and len(codemaps) == 0:
14 import py; py.test.skip("Win64 doesn't produce codemaps")
15
16 assert len(codemaps) == 3
17 # we want to create a map of differences, so unpacking the tracebacks
18 # byte by byte
19 codemaps.sort(lambda a, b: cmp(a[1], b[1]))
20 # biggest is the big loop, smallest is the bridge
21 def get_ranges(c):
22 ranges = []
23 prev_traceback = None
24 for b in range(c[0], c[0] + c[1]):
25 tb = unpack_traceback(b)
26 if tb != prev_traceback:
27 ranges.append(tb)
28 prev_traceback = tb
29 return ranges
30 assert get_ranges(codemaps[2]) == [[4], [4, 2], [4]]
31 assert get_ranges(codemaps[1]) == [[2]]
32 assert get_ranges(codemaps[0]) == [[2], []]