Implement memory.discard instruction
Categories
(Core :: JavaScript: WebAssembly, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox112 | --- | fixed |
People
(Reporter: rhunt, Assigned: bvisness)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
Implement the memory.discard
[1] in Ion/Baseline. Both of them will likely just perform a call to a builtin to do the real work.
The semantics of this instruction are not firmly pinned down yet, we can make something up or coordinate with V8 to see if they've chosen something yet. A reasonable start would be memory.discard $memIndex : [i32:offset, i32:length] -> []
.
The idea for the instruction is roughly a semantic zero'ing of some range of memory, with the hint provided to the OS that this memory is not likely needed anytime soon. The OS would likely free the backing pages then, and provide a fresh zero-page back on-demand if the memory is touched in the future.
For Linux (OSX too?), this would be done with madvise(MADV_DONTNEED)
For Windows, this might be VirtualFree(MEM_DECOMMIT);VirtualAlloc(MEM_COMMIT)
. We'll need to double check the atomicity of that for threading.
Assignee | ||
Comment 1•1 year ago
|
||
memory.discard stuff from windows
Rearrange discard code (and scaffold for M64)
Get the JS API working, bounds checks and all
Visual cleanup
Updated•1 year ago
|
Assignee | ||
Comment 2•1 year ago
|
||
Depends on D167324
Pushed by rhunt@eqrion.net: https://hg.mozilla.org/integration/autoland/rev/73c05bcb4c1f Implement memory.discard wasm instruction. r=rhunt,supply-chain-reviewers https://hg.mozilla.org/integration/autoland/rev/893e8d9462ad Add wasm memory control pref. r=rhunt
Comment 4•1 year ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/73c05bcb4c1f
https://hg.mozilla.org/mozilla-central/rev/893e8d9462ad
Description
•