Commit cfc2cea
committed
Make table/memory creation
This commit is a large-ish refactor which is made possible by the many
previous refactorings to internals w.r.t. async-in-Wasmtime. The end
goal of this change is that table and memory allocation are both `async`
functions. Achieving this, however, required some refactoring to enable
it to work:
* To work with `Send` neither function can close over `dyn VMStore`.
This required changing their `Option<&mut dyn VMStore>` arugment to
`Option<&mut StoreResourceLimiter<'_>>`
* Somehow a `StoreResourceLimiter` needed to be acquired from an
`InstanceAllocationRequest`. Previously the store was stored here as
an unsafe raw pointer, but I've refactored this now so
`InstanceAllocationRequest` directly stores `&StoreOpaque` and
`Option<&mut StoreResourceLimiter>` meaning it's trivial to acquire
them. This additionally means no more `unsafe` access of the store
during instance allocation (yay!).
* Now-redundant fields of `InstanceAllocationRequest` were removed since
they can be safely inferred from `&StoreOpaque`. For example passing
around `&Tunables` is now all gone.
* Methods upwards from table/memory allocation to the
`InstanceAllocator` trait needed to be made `async`. This includes new
`#[async_trait]` methods for example.
* `StoreOpaque::ensure_gc_store` is now an `async` function. This
internally carries a new `unsafe` block carried over from before with
the raw point passed around in `InstanceAllocationRequest`. A future
PR will delete this `unsafe` block, it's just temporary.
I attempted a few times to split this PR up into separate commits but
everything is relatively intertwined here so this is the smallest
"atomic" unit I could manage to land these changes and refactorings.async functions1 parent 683d4c1 commit cfc2cea
File tree
15 files changed
+214
-366
lines changed- crates/wasmtime/src/runtime
- store
- trampoline
- vm
- instance
- allocator
- pooling
- memory
- tests/all
15 files changed
+214
-366
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
| |||
349 | 349 | | |
350 | 350 | | |
351 | 351 | | |
352 | | - | |
353 | | - | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
| 352 | + | |
370 | 353 | | |
371 | 354 | | |
372 | 355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
98 | 97 | | |
99 | 98 | | |
100 | 99 | | |
| |||
470 | 469 | | |
471 | 470 | | |
472 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
473 | 486 | | |
474 | 487 | | |
475 | 488 | | |
| |||
646 | 659 | | |
647 | 660 | | |
648 | 661 | | |
649 | | - | |
| 662 | + | |
650 | 663 | | |
651 | 664 | | |
652 | 665 | | |
| |||
670 | 683 | | |
671 | 684 | | |
672 | 685 | | |
673 | | - | |
| 686 | + | |
674 | 687 | | |
675 | 688 | | |
676 | 689 | | |
| |||
1489 | 1502 | | |
1490 | 1503 | | |
1491 | 1504 | | |
1492 | | - | |
| 1505 | + | |
1493 | 1506 | | |
1494 | 1507 | | |
1495 | 1508 | | |
1496 | | - | |
| 1509 | + | |
1497 | 1510 | | |
1498 | 1511 | | |
1499 | 1512 | | |
1500 | | - | |
| 1513 | + | |
1501 | 1514 | | |
1502 | 1515 | | |
1503 | 1516 | | |
| |||
1507 | 1520 | | |
1508 | 1521 | | |
1509 | 1522 | | |
1510 | | - | |
1511 | | - | |
| 1523 | + | |
1512 | 1524 | | |
1513 | 1525 | | |
1514 | 1526 | | |
1515 | 1527 | | |
1516 | | - | |
1517 | | - | |
1518 | | - | |
1519 | | - | |
1520 | | - | |
| 1528 | + | |
1521 | 1529 | | |
1522 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
1523 | 1541 | | |
1524 | 1542 | | |
1525 | 1543 | | |
| |||
1532 | 1550 | | |
1533 | 1551 | | |
1534 | 1552 | | |
1535 | | - | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
| 1553 | + | |
| 1554 | + | |
1540 | 1555 | | |
1541 | | - | |
1542 | | - | |
1543 | 1556 | | |
1544 | | - | |
1545 | | - | |
1546 | | - | |
1547 | | - | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
1548 | 1561 | | |
1549 | 1562 | | |
1550 | 1563 | | |
| |||
1560 | 1573 | | |
1561 | 1574 | | |
1562 | 1575 | | |
1563 | | - | |
1564 | | - | |
1565 | | - | |
1566 | | - | |
1567 | | - | |
| 1576 | + | |
1568 | 1577 | | |
1569 | 1578 | | |
1570 | 1579 | | |
| |||
1944 | 1953 | | |
1945 | 1954 | | |
1946 | 1955 | | |
1947 | | - | |
| 1956 | + | |
1948 | 1957 | | |
1949 | 1958 | | |
1950 | 1959 | | |
| |||
2091 | 2100 | | |
2092 | 2101 | | |
2093 | 2102 | | |
| 2103 | + | |
2094 | 2104 | | |
2095 | 2105 | | |
2096 | 2106 | | |
| |||
2225 | 2235 | | |
2226 | 2236 | | |
2227 | 2237 | | |
2228 | | - | |
2229 | | - | |
2230 | | - | |
2231 | | - | |
2232 | | - | |
2233 | | - | |
2234 | | - | |
2235 | | - | |
2236 | | - | |
2237 | | - | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
2238 | 2249 | | |
2239 | 2250 | | |
2240 | 2251 | | |
| |||
2316 | 2327 | | |
2317 | 2328 | | |
2318 | 2329 | | |
2319 | | - | |
2320 | | - | |
2321 | | - | |
2322 | | - | |
2323 | | - | |
2324 | | - | |
2325 | | - | |
2326 | | - | |
2327 | | - | |
2328 | | - | |
2329 | | - | |
2330 | | - | |
2331 | | - | |
2332 | | - | |
2333 | | - | |
2334 | | - | |
2335 | | - | |
2336 | | - | |
2337 | | - | |
2338 | | - | |
2339 | | - | |
2340 | | - | |
2341 | | - | |
2342 | | - | |
2343 | | - | |
2344 | | - | |
2345 | | - | |
2346 | | - | |
2347 | | - | |
2348 | | - | |
2349 | | - | |
2350 | | - | |
2351 | | - | |
2352 | | - | |
2353 | | - | |
2354 | | - | |
2355 | | - | |
2356 | | - | |
2357 | | - | |
2358 | | - | |
2359 | | - | |
2360 | | - | |
2361 | | - | |
2362 | | - | |
2363 | | - | |
2364 | | - | |
2365 | | - | |
2366 | | - | |
2367 | | - | |
2368 | | - | |
2369 | | - | |
2370 | | - | |
2371 | | - | |
2372 | | - | |
2373 | | - | |
2374 | | - | |
2375 | | - | |
2376 | | - | |
2377 | | - | |
2378 | | - | |
2379 | | - | |
2380 | | - | |
2381 | | - | |
2382 | | - | |
2383 | | - | |
2384 | | - | |
2385 | | - | |
2386 | | - | |
2387 | | - | |
2388 | | - | |
2389 | | - | |
2390 | | - | |
2391 | | - | |
2392 | | - | |
2393 | | - | |
2394 | | - | |
2395 | 2330 | | |
2396 | 2331 | | |
2397 | 2332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
127 | 128 | | |
128 | 129 | | |
129 | 130 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
| 171 | + | |
171 | 172 | | |
172 | | - | |
| 173 | + | |
173 | 174 | | |
174 | | - | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
191 | | - | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| |||
204 | 206 | | |
205 | 207 | | |
206 | 208 | | |
207 | | - | |
| 209 | + | |
208 | 210 | | |
209 | | - | |
| 211 | + | |
210 | 212 | | |
211 | | - | |
212 | 213 | | |
213 | 214 | | |
214 | | - | |
| 215 | + | |
215 | 216 | | |
216 | 217 | | |
217 | 218 | | |
| |||
0 commit comments