On 64-bit systems, this decreases sizeof(SymbolUnion) from 112 to 96.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Nice! I wonder if its worth adding some kind of static assert or unittest to avoid accidental increases in future? Either way lgtm.
Comment Actions
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 └⏷ 0 llvm::StringRef Name └⏷16 lld::wasm::InputFile *File ├╸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.