Page MenuHomePhabricator

[WebAssembly] Group rodata into a single output segment

Authored by sbc100 on Aug 7 2018, 9:01 PM.

Diff Detail


Event Timeline

sbc100 created this revision.Aug 7 2018, 9:01 PM
fitzgen accepted this revision.Aug 8 2018, 10:09 AM

Looks good to me!

General question: in the case of an optimized (for size) wasm binary, why not put everything into a single segment instead of a small handful?

This revision is now accepted and ready to land.Aug 8 2018, 10:09 AM

I think you are right about the optimized builds. One thing I thought we might want to preserve is that data objects from the same section should be grouped together contiguously.. but I think we can probably do that while at the same time putting it all in a single segment.

Also, we have post-linking tools such as wasm-opt in binaryen which will actually split up the data segments into smaller ones if they contain runs of zeros. I'm not sure about doing this in the general case since its not clear to me we can rely on the memory we are passed being zero-initialized. In general wasm memory are zero intialized, but the embedding code and reuse/modify memory before wasm init time.

This revision was automatically updated to reflect the committed changes.