[PATCH] D62548: [WebAssembly] Move direct call tracking from member to local. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 08:38:32 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD361977: [WebAssembly] Move direct call tracking from member to local. NFC. (authored by sbc, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62548?vs=201750&id=201934#toc

Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62548/new/

https://reviews.llvm.org/D62548

Files:
  wasm/InputFiles.cpp
  wasm/InputFiles.h


Index: wasm/InputFiles.h
===================================================================
--- wasm/InputFiles.h
+++ wasm/InputFiles.h
@@ -69,13 +69,6 @@
 
   // List of all symbols referenced or defined by this file.
   std::vector<Symbol *> Symbols;
-  // Bool for each symbol, true if called directly.  This allows us to implement
-  // a weaker form of signature checking where undefined functions that are not
-  // called directly (i.e. only address taken) don't have to match the defined
-  // function's signature.  We cannot do this for directly called functions
-  // because those signatures are checked at validation times.
-  // See https://bugs.llvm.org/show_bug.cgi?id=40412
-  std::vector<bool> SymbolIsCalledDirectly;
 
 private:
   const Kind FileKind;
Index: wasm/InputFiles.cpp
===================================================================
--- wasm/InputFiles.cpp
+++ wasm/InputFiles.cpp
@@ -272,7 +272,14 @@
   }
 
   uint32_t SectionIndex = 0;
-  SymbolIsCalledDirectly.resize(WasmObj->getNumberOfSymbols(), false);
+
+  // Bool for each symbol, true if called directly.  This allows us to implement
+  // a weaker form of signature checking where undefined functions that are not
+  // called directly (i.e. only address taken) don't have to match the defined
+  // function's signature.  We cannot do this for directly called functions
+  // because those signatures are checked at validation times.
+  // See https://bugs.llvm.org/show_bug.cgi?id=40412
+  std::vector<bool> IsCalledDirectly(WasmObj->getNumberOfSymbols(), false);
   for (const SectionRef &Sec : WasmObj->sections()) {
     const WasmSection &Section = WasmObj->getWasmSection(Sec);
     // Wasm objects can have at most one code and one data section.
@@ -292,7 +299,7 @@
     // directly
     for (const WasmRelocation &Reloc : Section.Relocations)
       if (Reloc.Type == R_WASM_FUNCTION_INDEX_LEB)
-        SymbolIsCalledDirectly[Reloc.Index] = true;
+        IsCalledDirectly[Reloc.Index] = true;
   }
 
   TypeMap.resize(getWasmObj()->types().size());
@@ -342,7 +349,7 @@
       }
     }
     size_t Idx = Symbols.size();
-    Symbols.push_back(createUndefined(WasmSym, SymbolIsCalledDirectly[Idx]));
+    Symbols.push_back(createUndefined(WasmSym, IsCalledDirectly[Idx]));
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62548.201934.patch
Type: text/x-patch
Size: 2289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190529/9d28868c/attachment.bin>


More information about the llvm-commits mailing list