Debian Codegraph @

rpython/jit/codewriter/test/test_void_list.py

raw symbols SCIP
1 from rpython.rtyper.lltypesystem import lltype
2 from rpython.translator.unsimplify import varoftype
3 from rpython.flowspace.model import Constant
4 from rpython.jit.codewriter.jtransform import NotSupported
5
6 from rpython.jit.codewriter.test.test_list import builtin_test
7
8 # ____________________________________________________________
9 # XXX support for lists of voids is limited right now
10
11 FIXEDLIST = lltype.Ptr(lltype.GcArray(lltype.Void))
12 VARLIST = lltype.Ptr(lltype.GcStruct('VARLIST',
13 ('length', lltype.Signed),
14 ('items', FIXEDLIST),
15 adtmeths={"ITEM": lltype.Void}))
16
17 # ____________________________________________________________
18 # Fixed lists
19
20 def test_newlist():
21 builtin_test('newlist', [], FIXEDLIST,
22 NotSupported)
23 builtin_test('newlist', [Constant(5, lltype.Signed)], FIXEDLIST,
24 NotSupported)
25 builtin_test('newlist', [varoftype(lltype.Signed)], FIXEDLIST,
26 NotSupported)
27 builtin_test('newlist', [Constant(5, lltype.Signed),
28 Constant(0, lltype.Signed)], FIXEDLIST,
29 NotSupported)
30 builtin_test('newlist', [Constant(5, lltype.Signed),
31 Constant(1, lltype.Signed)], FIXEDLIST,
32 NotSupported)
33 builtin_test('newlist', [Constant(5, lltype.Signed),
34 varoftype(lltype.Signed)], FIXEDLIST,
35 NotSupported)
36
37 def test_fixed_ll_arraycopy():
38 builtin_test('list.ll_arraycopy',
39 [varoftype(FIXEDLIST),
40 varoftype(FIXEDLIST),
41 varoftype(lltype.Signed),
42 varoftype(lltype.Signed),
43 varoftype(lltype.Signed)],
44 lltype.Void,
45 NotSupported)
46
47 def test_fixed_ll_arraymove():
48 builtin_test('list.ll_arraymove',
49 [varoftype(FIXEDLIST),
50 varoftype(lltype.Signed),
51 varoftype(lltype.Signed),
52 varoftype(lltype.Signed)],
53 lltype.Void,
54 NotSupported)
55
56 def test_fixed_getitem():
57 builtin_test('list.getitem/NONNEG',
58 [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
59 lltype.Void, "")
60 builtin_test('list.getitem/NEG',
61 [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
62 lltype.Void, "")
63
64 def test_fixed_getitem_foldable():
65 builtin_test('list.getitem_foldable/NONNEG',
66 [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
67 lltype.Void, "")
68 builtin_test('list.getitem_foldable/NEG',
69 [varoftype(FIXEDLIST), varoftype(lltype.Signed)],
70 lltype.Void, "")
71
72 def test_fixed_setitem():
73 builtin_test('list.setitem/NONNEG', [varoftype(FIXEDLIST),
74 varoftype(lltype.Signed),
75 varoftype(lltype.Void)],
76 lltype.Void, "")
77 builtin_test('list.setitem/NEG', [varoftype(FIXEDLIST),
78 varoftype(lltype.Signed),
79 varoftype(lltype.Void)],
80 lltype.Void, "")
81
82 def test_fixed_len():
83 builtin_test('list.len', [varoftype(FIXEDLIST)], lltype.Signed,
84 NotSupported)
85
86 def test_fixed_len_foldable():
87 builtin_test('list.len_foldable', [varoftype(FIXEDLIST)], lltype.Signed,
88 NotSupported)
89
90 # ____________________________________________________________
91 # Resizable lists
92
93 def test_resizable_newlist():
94 builtin_test('newlist', [], VARLIST,
95 NotSupported)
96 builtin_test('newlist', [Constant(5, lltype.Signed)], VARLIST,
97 NotSupported)
98 builtin_test('newlist', [varoftype(lltype.Signed)], VARLIST,
99 NotSupported)
100 builtin_test('newlist', [Constant(5, lltype.Signed),
101 Constant(0, lltype.Signed)], VARLIST,
102 NotSupported)
103 builtin_test('newlist', [Constant(5, lltype.Signed),
104 Constant(1, lltype.Signed)], VARLIST,
105 NotSupported)
106 builtin_test('newlist', [Constant(5, lltype.Signed),
107 varoftype(lltype.Signed)], VARLIST,
108 NotSupported)
109
110 def test_resizable_getitem():
111 builtin_test('list.getitem/NONNEG',
112 [varoftype(VARLIST), varoftype(lltype.Signed)],
113 lltype.Void, "")
114 builtin_test('list.getitem/NEG',
115 [varoftype(VARLIST), varoftype(lltype.Signed)],
116 lltype.Void, "")
117
118 def test_resizable_setitem():
119 builtin_test('list.setitem/NONNEG', [varoftype(VARLIST),
120 varoftype(lltype.Signed),
121 varoftype(lltype.Void)],
122 lltype.Void, "")
123 builtin_test('list.setitem/NEG', [varoftype(VARLIST),
124 varoftype(lltype.Signed),
125 varoftype(lltype.Void)],
126 lltype.Void, "")
127
128 def test_resizable_len():
129 builtin_test('list.len', [varoftype(VARLIST)], lltype.Signed,
130 NotSupported)
131
132 def test_resizable_unsupportedop():
133 builtin_test('list.foobar', [varoftype(VARLIST)], lltype.Signed,
134 NotSupported)