Bug 254960 - Use fixed-size deadCells vector in MarkedBlock::sweep
Summary: Use fixed-size deadCells vector in MarkedBlock::sweep
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Degazio
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-04-03 17:36 PDT by David Degazio
Modified: 2023-04-04 23:45 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Degazio 2023-04-03 17:36:48 PDT
rdar://107585451

In MarkedBlock::specializedSweep, we allocate a `Vector<uint64_t>` to store the list of dead cells we need to destroy. However, the maximum number of atoms in a MarkedBlock is bounded by a constant - currently 1024. This means we can do two things:

 - Because the maximum atom number is less than 65536, we can store them as `uint16_t`s to reduce memory usage/improve locality.
 
 - At only 1024 atoms per block, and since `specializedSweep` isn't recursive or anything, it's probably fine to allocate the full storage of the vector on the stack. This means we avoid allocation (both initially and to grow the vector), can use `Vector::uncheckedAppend`, and probably improve locality somewhat.
Comment 1 David Degazio 2023-04-03 17:42:47 PDT
Pull request: https://github.com/WebKit/WebKit/pull/12350
Comment 2 EWS 2023-04-04 23:45:35 PDT
Committed 262612@main (424d1996eedf): <https://commits.webkit.org/262612@main>

Reviewed commits have been landed. Closing PR #12350 and removing active labels.