Commit 9954544
committed
More carefully encapsulate the compiler cache within NativeCompiler.
We want for NativeCompiler to provide a simple, clean abstraction for
a code-compilation service. You should be able to push code in, ask whether
you've pushed code before, and get TypedCallTargets and function pointers
out, and not really need to worry about the compiler cache.
This change moves the compiler cache fully behind the native compiler,
and tries to ensure that the python converter doesn't itself need to
track the functions that its compiled in the past. Instead, we're moving
towards it being stateless across invocations (and we'll probably do
the same thing for the native-to-llvm converter as well) since its
substantially simpler to think about.
As part of this change, we modify the compiler cache to acknowledge that
modules inside might not be loadable and that as a result, it might think
that a symbol is available when it is not. In this pathway, the compiler
cache tracks all modules that define a symbol, as well as the first module
that it loads that defines a symbol, and if its tries to load all possible
modules that provide a given symbol and fails, then returns without loading
the symbol. NativeCompiler doesn't return a positive indication that it
has a symbol until it has actually loaded the symbol.
Eventually we may not need this because we'll be loading modules partially.1 parent 638fe5b commit 9954544
5 files changed
Lines changed: 205 additions & 96 deletions
File tree
- typed_python/compiler
- native_compiler
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
58 | 65 | | |
| 66 | + | |
| 67 | + | |
59 | 68 | | |
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
64 | 73 | | |
65 | | - | |
66 | | - | |
| 74 | + | |
| 75 | + | |
67 | 76 | | |
68 | | - | |
69 | | - | |
70 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
71 | 82 | | |
72 | | - | |
73 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
74 | 87 | | |
75 | | - | |
76 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
77 | 94 | | |
78 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
79 | 98 | | |
80 | 99 | | |
81 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
82 | 115 | | |
83 | 116 | | |
84 | 117 | | |
| |||
134 | 167 | | |
135 | 168 | | |
136 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
137 | 174 | | |
138 | 175 | | |
139 | 176 | | |
| |||
149 | 186 | | |
150 | 187 | | |
151 | 188 | | |
152 | | - | |
| 189 | + | |
153 | 190 | | |
154 | 191 | | |
155 | 192 | | |
156 | 193 | | |
157 | 194 | | |
158 | 195 | | |
159 | 196 | | |
160 | | - | |
161 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
162 | 202 | | |
163 | 203 | | |
164 | 204 | | |
| |||
185 | 225 | | |
186 | 226 | | |
187 | 227 | | |
188 | | - | |
189 | | - | |
190 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
191 | 233 | | |
192 | 234 | | |
193 | 235 | | |
| |||
225 | 267 | | |
226 | 268 | | |
227 | 269 | | |
228 | | - | |
229 | | - | |
230 | | - | |
| 270 | + | |
231 | 271 | | |
232 | 272 | | |
233 | | - | |
| 273 | + | |
234 | 274 | | |
235 | 275 | | |
236 | 276 | | |
| |||
262 | 302 | | |
263 | 303 | | |
264 | 304 | | |
265 | | - | |
| 305 | + | |
266 | 306 | | |
267 | 307 | | |
268 | 308 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
| 362 | + | |
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| |||
Lines changed: 93 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| 32 | + | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | | - | |
35 | | - | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
38 | 41 | | |
| 42 | + | |
| 43 | + | |
39 | 44 | | |
40 | 45 | | |
41 | | - | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
45 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
46 | 99 | | |
47 | 100 | | |
48 | | - | |
| 101 | + | |
| 102 | + | |
49 | 103 | | |
50 | | - | |
51 | | - | |
52 | | - | |
| 104 | + | |
53 | 105 | | |
54 | 106 | | |
55 | 107 | | |
| |||
69 | 121 | | |
70 | 122 | | |
71 | 123 | | |
| 124 | + | |
| 125 | + | |
72 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
73 | 130 | | |
74 | 131 | | |
75 | 132 | | |
76 | 133 | | |
77 | | - | |
78 | 134 | | |
79 | 135 | | |
80 | 136 | | |
81 | 137 | | |
82 | 138 | | |
83 | 139 | | |
84 | | - | |
| 140 | + | |
85 | 141 | | |
86 | 142 | | |
87 | 143 | | |
88 | | - | |
| 144 | + | |
89 | 145 | | |
90 | 146 | | |
91 | 147 | | |
92 | 148 | | |
93 | 149 | | |
94 | 150 | | |
95 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
96 | 166 | | |
97 | 167 | | |
98 | 168 | | |
99 | | - | |
| 169 | + | |
100 | 170 | | |
101 | | - | |
| 171 | + | |
102 | 172 | | |
103 | 173 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
108 | 177 | | |
109 | | - | |
110 | | - | |
| 178 | + | |
111 | 179 | | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
117 | 185 | | |
118 | 186 | | |
119 | 187 | | |
| |||
184 | 252 | | |
185 | 253 | | |
186 | 254 | | |
187 | | - | |
| 255 | + | |
188 | 256 | | |
189 | 257 | | |
190 | 258 | | |
| |||
0 commit comments