[PATCH] D64208: [WebAssembly] Reorder Symbol fields to make it smaller

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 4 19:16:24 PDT 2019


MaskRay added a comment.

> static_assert(sizeof(SymbolUnion) <= 96, "SymbolUnion too large");
> 
> c:\b\slave\sanitizer-windows\build\llvm.src\tools\lld\wasm\Symbols.h(481): error C2338: SymbolUnion too large

*NIX systems place bitfields at the next available unit where the entire bitfield would fit in an aligned storage unit of the declared type;

  UndefinedFunction  ;;;; sizeof(UndefinedFunction) = 96
  └⏷56 llvm::StringRef ImportName
  └⏷72 llvm::StringRef ImportModule
  ├╸88 bool IsCalledDirectly
  ├╸48 uint32_t TableIndex
  ├╸52 uint32_t FunctionIndex
  ├╸24 uint32_t Flags
  ├╸28 uint32_t OutputSymbolIndex
  ├╸32 uint32_t GOTIndex
  ├╸36 lld::wasm::Symbol::Kind SymbolKind
  ├╸37 unsigned int Referenced                    ;;;;;;;; on Windows, 40
  ├╸37.1 unsigned int IsUsedInRegularObj
  ├╸37.2 unsigned int ForceExport
  ├╸37.3 unsigned int CanInline
  └╸37.4 unsigned int Traced

On Windows, bit fields are placed differently, `sizeof(UndefinedFunction) = 104`.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D64208





More information about the llvm-commits mailing list