The code section is now written out one function
at a time rather than all the functions in a given
objects being serialized at once.
This change lays the groundwork for supporting
--gc-sections.
Paths
| Differential D41315
[WebAssembly] Output functions individually ClosedPublic Authored by sbc100 on Dec 15 2017, 4:53 PM.
Details Summary The code section is now written out one function This change lays the groundwork for supporting
Diff Detail
Event TimelineHerald added subscribers: llvm-commits, sunfish, aheejin and 3 others. · View Herald TranscriptDec 15 2017, 4:53 PM
sbc100 retitled this revision from [WebAssembly] Output function individually to [WebAssembly] Output functions individually.Dec 15 2017, 7:17 PM Comment Actions (This is towards https://bugs.llvm.org/show_bug.cgi?id=35534) It looks like you're still emitting all functions, and the output hasn't actually changed? I haven't read it thoroughly yet, but from the fact that the tests haven't changed I deduce this patch doesn't do any pruning. The next simple/logical thing to do is to handle weak symbols - when assigning the function indices, check for duplicates. Only functions that actually provide a Symbol should be kept, and the rest discarded (if the Symbol that they would have provided points to a different Function). That's a straightforward and quick check that's probably worth having, even if GC is later used to do even more vigorous pruning of unused code.
Comment Actions Looks good, this definitely goes in the right direction and will be useful.
This revision is now accepted and ready to land.Dec 18 2017, 5:46 AM Comment Actions I've just been doing some testing, to evaluate the filesize from Wasm LLD. I have here a binary that's part of our HTML5 product (the VNC Connect SDK, which includes an asm.js blob).
So, we're actually pretty small already, at least compared to asm.js from Emscripten. Pruning some duplicate data would be nice, but (to me) it's lower-priority than essential functionality, considering the output is surprisingly competitive with asm.js already. The next steps for me are to continue debugging the Comdat support to the point where our full app runs successfully.
Comment Actions I have a followup change that will unify the InputFunction and InputSegment, but I'd like to land this change as-is to keep reasonably sizes. @ruiu WDYT? Comment Actions ping @ruiu. I've got quick a few other pending changes stacked up on top of this one now. (sorry I know the holidays are coming up).
Comment Actions @ruiu PTAL. This change is needed before I can land https://reviews.llvm.org/D41426
Comment Actions LGTM
Closed by commit rLLD322138: [WebAssembly] Output functions individually (authored by sbc). · Explain WhyJan 9 2018, 3:57 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 127660 wasm/InputFiles.h
wasm/InputFiles.cpp
wasm/InputFunction.h
wasm/InputSegment.h
wasm/OutputSections.h
wasm/OutputSections.cpp
wasm/SymbolTable.h
wasm/SymbolTable.cpp
wasm/Symbols.h
wasm/Symbols.cpp
wasm/Writer.cpp
|
What is a relation between Segment and Function? Is Function a type of Segment?