Commit 2dd03bc
authored
Implement the semi-space copying garbage collector (#13107)
* Implement the semi-space copying garbage collector
This is a classic semi-space copying collector that uses bump allocation and
Cheney-style worklists to avoid an explicit stack for grey (relocated but not
yet scanned) objects outside the GC heap. Forwarding "pointers" (really
`VMGcRef` indices) are stored inline in objects in the old semi-space, which
again avoids explicit data structures outside of the GC heap. Furthermore, an
intrusive linked-list of all `externref`s is maintained to allow for efficiently
sweeping their associated host data after collection (and, once again, avoiding
additional data structures outside the GC heap).
Allocation in compiled Wasm code always happens by calling out to the
`gc_alloc_raw` libcall currently. This is expected to become inline bump
allocation, very similar to the null collector, in a follow-up commit shortly
after this one. It is delayed to make review easier.
Collection is not incremental (in the Wasmtime sense, not the GC literature
sense) yet and the `CopyingCollection::collect_increment` implementation only
has a single increment. This is delayed to make review easier and is also
expected to come shortly in follow-up commits.
I've also added new disas tests for the copying collector and also enabled
running wast tests which need a GC heap with the copying collector.
Finally, fuzz config generation can now generate configurations that enable the
copying collector.
* fix compilation error, add a couple more asserts
* Fix bug where semi-spaces' usable sizes were not equal
* Ensure that we always poison new gc heap capacity in `replace_memory`
* remove dead method
* remove unused import
* review feedback and little clean ups
* fix poisoning for new growth
* Add additional copying collector and GC object tests
* fix compilation after rebase
* actually fix compilation after rebase
* Update disas test output
* Fix grow-vs-collect logic under GC zeal
* remove warning in no-gc build1 parent 24938c4 commit 2dd03bc
73 files changed
Lines changed: 4457 additions & 263 deletions
File tree
- crates
- cranelift/src/func_environ/gc
- enabled
- environ/src
- gc
- fuzzing
- src/generators
- wasmtime/src
- runtime
- store
- vm
- gc
- enabled
- tests
- all
- disas/gc/copying
- misc_testsuite/gc
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
108 | 139 | | |
109 | 140 | | |
110 | 141 | | |
| |||
645 | 676 | | |
646 | 677 | | |
647 | 678 | | |
648 | | - | |
| 679 | + | |
649 | 680 | | |
650 | 681 | | |
651 | 682 | | |
| |||
660 | 691 | | |
661 | 692 | | |
662 | 693 | | |
663 | | - | |
| 694 | + | |
664 | 695 | | |
665 | 696 | | |
666 | 697 | | |
| |||
1333 | 1364 | | |
1334 | 1365 | | |
1335 | 1366 | | |
1336 | | - | |
| 1367 | + | |
1337 | 1368 | | |
1338 | 1369 | | |
1339 | 1370 | | |
| |||
1381 | 1412 | | |
1382 | 1413 | | |
1383 | 1414 | | |
1384 | | - | |
| 1415 | + | |
1385 | 1416 | | |
1386 | 1417 | | |
1387 | 1418 | | |
| |||
1483 | 1514 | | |
1484 | 1515 | | |
1485 | 1516 | | |
1486 | | - | |
| 1517 | + | |
1487 | 1518 | | |
1488 | 1519 | | |
1489 | 1520 | | |
| |||
0 commit comments