binaryen icon indicating copy to clipboard operation
binaryen copied to clipboard

Memory packing is not safe with imported memory

Open tlively opened this issue 6 years ago • 1 comments

The MemoryPacking pass assumes that the initial memory is zero, so it is free to remove spans of zeroes from active segments. This is not technically true with an imported memory. Do we care? This has not been a problem in practice because toolchains generally assume that memory is fresh and owned by the wasm module.

tlively avatar Nov 06 '19 02:11 tlively

Good point. We should perhaps make variations on the pass that either make that assumption or do not, but a downside is that most code will likely assume this, so forcing people to opt-in means some would miss out. Still, it's probably the right thing to do.

kripken avatar Nov 06 '19 14:11 kripken