Repository navigation
Commit e1a28d3
committed
[JSC] Fix leftover marks after the marking version wraps, and test the wrap
https://bugs.webkit.org/show_bug.cgi?id=328420
rdar://190682109
Reviewed by Keith Miller.
When a heap's marking version wraps, every block is reset to nullVersion, and a
block whose marks were current keeps them as the survivors. Since 181146@main
(2016), staleMarksStillRecordSurvivors(), previously named
marksConveyLivenessDuringMarking(), has treated nullVersion as recording
survivors in every Full collection, not just the one that wrapped. A block that
collection does not reach keeps its old marks through sweeping and reuse, and
the next Full collection takes them for survivors. If the block is being
allocated from, that trips a Debug assert in resetStaleMarks(), or a release
assert if the block is swept during marking. If not, its freed cells count as
live, so a stale stack pointer can make the conservative scan visit one.
Make initialVersion 1, which is nextVersion(nullVersion), and drop the
nullVersion case. Now one rule covers every Full collection: a block's stale
marks record the survivors only if its version is one behind the heap's. A wrap
keeps this true: it sets every block to nullVersion, one behind initialVersion,
and clears the marks of blocks without survivors. Between wraps, versions only
increase, so an old version never matches a new one.
The wrap was never tested, because it takes about 2^32 Full collections: 50
days even at one per millisecond, and over a century at one per second. Add an
option, initialMarkingVersion, to start near it. The collect-continuously
stress modes now start up to 32 Full collections before the wrap, and
NoCJITValidatePhases, which also runs in Debug builds, wraps on each test's
second Full collection, so the first has populated the marks. Without the fix,
over 300 existing stress tests fail in these modes. The new test hits the Debug
assert; JS cannot create the stale stack pointer the other case needs.
Test: JSTests/stress/marking-version-wrap-reused-block.js
* JSTests/stress/marking-version-wrap-reused-block.js: Added.
(makeObject):
* Source/JavaScriptCore/heap/MarkedBlock.cpp:
(JSC::MarkedBlock::resetMarksForVersionWrap):
* Source/JavaScriptCore/heap/MarkedBlock.h:
* Source/JavaScriptCore/heap/MarkedBlockInlines.h:
(JSC::MarkedBlock::staleMarksStillRecordSurvivors):
* Source/JavaScriptCore/heap/MarkedSpace.cpp:
(JSC::startingMarkingVersion):
(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::adoptMarkingVersion):
* Source/JavaScriptCore/heap/MarkedSpace.h:
(JSC::MarkedSpace::nextVersion):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Tools/Scripts/run-jsc-stress-tests:
Canonical link: https://commits.webkit.org/324475@main1 parent a5ec4c1 commit e1a28d3
8 files changed
Lines changed: 65 additions & 21 deletions
File tree
- JSTests/stress
- Source/JavaScriptCore
- heap
- runtime
- Tools/Scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | | - | |
| 363 | + | |
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
335 | 334 | | |
336 | 335 | | |
337 | 336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
79 | | - | |
80 | 78 | | |
81 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
182 | 190 | | |
| 191 | + | |
183 | 192 | | |
184 | 193 | | |
185 | 194 | | |
| |||
463 | 472 | | |
464 | 473 | | |
465 | 474 | | |
466 | | - | |
467 | | - | |
| 475 | + | |
| 476 | + | |
468 | 477 | | |
469 | 478 | | |
470 | 479 | | |
471 | | - | |
| 480 | + | |
472 | 481 | | |
473 | 482 | | |
474 | 483 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | | - | |
| 77 | + | |
77 | 78 | | |
78 | | - | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| 212 | + | |
212 | 213 | | |
213 | 214 | | |
214 | 215 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
793 | 793 | | |
794 | 794 | | |
795 | 795 | | |
796 | | - | |
| 796 | + | |
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| |||
1423 | 1423 | | |
1424 | 1424 | | |
1425 | 1425 | | |
| 1426 | + | |
| 1427 | + | |
1426 | 1428 | | |
1427 | 1429 | | |
1428 | 1430 | | |
| |||
0 commit comments