[PATCH] D41315: [WebAssembly] Output function individually

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 15 17:58:57 PST 2017


ruiu added inline comments.


================
Comment at: wasm/InputFiles.cpp:147
 
 static void CopyRelocationsRange(std::vector<WasmRelocation> &To,
                                  ArrayRef<WasmRelocation> From, size_t Start,
----------------
This is not a review comment to lld, but why don't you emit one relocation section for each function? IIUC, this code scans an entire relocation section each time you instantiate a function, so that's O(n*m) where n and m are the number of relocations and functions.


================
Comment at: wasm/InputFiles.cpp:203
+  ArrayRef<WasmSignature> Types = WasmObj->types();
+  for (size_t i = 0; i < Funcs.size(); i++) {
+    const WasmFunction &Func = Funcs[i];
----------------
i -> I

i++ -> ++I


================
Comment at: wasm/InputFiles.cpp:207
+    InputFunction *Function = make<InputFunction>(Sig, Func, *this);
+    CopyRelocationsRange(Function->Relocations, CodeSection->Relocations,
+                         Func.CodeSectionOffset, Func.Size);
----------------
CopyRelocationsRange -> copyRelocationsRange


================
Comment at: wasm/InputFiles.h:119-120
   Symbol *createDefined(const WasmSymbol &Sym,
-                        const InputSegment *Segment = nullptr);
-  Symbol *createUndefined(const WasmSymbol &Sym);
+                        const InputSegment *Segment = nullptr,
+                        InputFunction *Function = nullptr);
+  Symbol *createUndefined(const WasmSymbol &Sym,
----------------
What is a relation between Segment and Function? Is Function a type of Segment?


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D41315





More information about the llvm-commits mailing list