[PATCH] D37834: [WebAssembly] Use a seperate wasm data segment for each global symbol
Derek Schuff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 14 15:34:28 PDT 2017
dschuff accepted this revision.
dschuff added inline comments.
This revision is now accepted and ready to land.
================
Comment at: lib/MC/WasmObjectWriter.cpp:102
+ uint32_t Offset;
+ SmallVector<char, 0> Data;
+};
----------------
sbc100 wrote:
> dschuff wrote:
> > IIRC A SmallVector with size 0 is no better (worse actually) than a std::vector. We could just use std::vector, or I guess if we really do want one segment per LLVM global, then 4 will be the most common size, so we could just use a Smallvector<4>.
> Hmm... look like this was inherited from the existing code. I'll change it to 4 for now and revisit in a followup.
sounds good.
================
Comment at: lib/MC/WasmObjectWriter.cpp:271
const SmallVector<WasmFunction, 4> &Functions);
- uint64_t
- writeDataSection(const SmallVector<char, 0> &DataBytes);
+ void writeDataSection(const SmallVector<WasmDataSegment, 4> &Segments);
void writeNameSection(const SmallVector<WasmFunction, 4> &Functions,
----------------
sbc100 wrote:
> dschuff wrote:
> > APIs should just take `SmallVectorImpl` parameters, and then any size SmallVector can be used as an argument.
> Actually it looks like these can take ArrayRef? Would that make sense? If its OK with you I'll make a separate change for that... maybe I can land that one first?
Yeah, separate change is fine, this is preexisting for the other functions too.
https://reviews.llvm.org/D37834
More information about the llvm-commits
mailing list