Closed
Bug 1715456
Opened 4 years ago
Closed 3 months ago
Use less space for stack maps
Categories
(Core :: JavaScript: WebAssembly, enhancement, P3)
Core
JavaScript: WebAssembly
Tracking
()
RESOLVED
FIXED
People
(Reporter: lth, Unassigned)
References
(Blocks 1 open bug)
Details
See bug 1714086 for a test case + analysis.
In the case where there is a large number of stack maps they can come to occupy significant space and take significant time to create. In the case of debugging, when maps are created for virtually every wasm bytecode, this is painfully obvious. When reference types become common it will probably be a concern also to non-debugging code.
There are several credible approaches to reducing creation time and data volume for stack maps.
- Stack maps can be deduplicated locally or module-wide since frames will tend to be small and many maps will tend to be equal (this is especially true for debugging).
- Stack maps can be allocated out of an arena to avoid malloc overhead, small though it may be. This may in any case be required to implement deduplication.
- The stack maps themselves are so compact that the data structure used to track them, the vector of maplets, comes to occupy a significant fraction of the space used for stack maps. Maplets contain two pointers, but can probably be shrunk to contain two offsets, see bug 1714086 comment 13. And the maplet vector can probably be reimplemented using more chunked storage, thus avoiding the need for a very large linear segment of memory and also allowing for eg compression of individual segments. (Maplet vectors are sorted by increasing PC, hence the PC values can be delta-encoded; with deduplication of maps, most offsets into the arena of stack maps can be ULEB-encoded.)
- An additional problem with placing the maplets in a vector is that when the vector needs to be grown, both the old (N elements) and the new (about 2N elements) will be live at the same time, creating large peaks in the memory consumption (observed in practice). Chunking the maplet store will likely avoid this. Parallel compilation does not improve the situation, really, but is probably only a secondary effect.
| Reporter | ||
Comment 1•4 years ago
|
||
Many fewer stack maps are now (bug 1714086) created for debug code when the function does not use reference types, but the problem will come back once reference types become common.
| Reporter | ||
Updated•3 years ago
|
Blocks: wasm-large-web-properties
Updated•7 months ago
|
Severity: -- → N/A
Comment 2•3 months ago
|
||
Fixed by bug 1992014.
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•