diff options
Diffstat (limited to 'lld/wasm')
-rw-r--r-- | lld/wasm/Driver.cpp | 8 | ||||
-rw-r--r-- | lld/wasm/InputFiles.cpp | 34 | ||||
-rw-r--r-- | lld/wasm/InputFiles.h | 10 | ||||
-rw-r--r-- | lld/wasm/MarkLive.cpp | 2 | ||||
-rw-r--r-- | lld/wasm/SymbolTable.cpp | 19 | ||||
-rw-r--r-- | lld/wasm/SymbolTable.h | 7 | ||||
-rw-r--r-- | lld/wasm/Symbols.cpp | 22 | ||||
-rw-r--r-- | lld/wasm/Symbols.h | 46 | ||||
-rw-r--r-- | lld/wasm/Writer.cpp | 36 |
9 files changed, 92 insertions, 92 deletions
diff --git a/lld/wasm/Driver.cpp b/lld/wasm/Driver.cpp index 487e56755cd..93985c3a05b 100644 --- a/lld/wasm/Driver.cpp +++ b/lld/wasm/Driver.cpp @@ -301,10 +301,10 @@ void LinkerDriver::link(ArrayRef<const char *> ArgsArr) { // Add synthetic symbols before any others WasmSym::CallCtors = Symtab->addSyntheticFunction( "__wasm_call_ctors", &NullSignature, WASM_SYMBOL_VISIBILITY_HIDDEN); - WasmSym::StackPointer = Symtab->addSyntheticGlobal("__stack_pointer"); - WasmSym::HeapBase = Symtab->addSyntheticGlobal("__heap_base"); - WasmSym::DsoHandle = Symtab->addSyntheticGlobal("__dso_handle"); - WasmSym::DataEnd = Symtab->addSyntheticGlobal("__data_end"); + WasmSym::StackPointer = Symtab->addSyntheticDataSymbol("__stack_pointer"); + WasmSym::HeapBase = Symtab->addSyntheticDataSymbol("__heap_base"); + WasmSym::DsoHandle = Symtab->addSyntheticDataSymbol("__dso_handle"); + WasmSym::DataEnd = Symtab->addSyntheticDataSymbol("__data_end"); if (!Config->Entry.empty()) EntrySym = addUndefinedFunction(Config->Entry, &NullSignature); diff --git a/lld/wasm/InputFiles.cpp b/lld/wasm/InputFiles.cpp index be806c50ef3..65524677671 100644 --- a/lld/wasm/InputFiles.cpp +++ b/lld/wasm/InputFiles.cpp @@ -44,13 +44,13 @@ Optional<MemoryBufferRef> lld::wasm::readFile(StringRef Path) { void ObjFile::dumpInfo() const { log("info for: " + getName() + "\n" + " Total Functions : " + Twine(FunctionSymbols.size()) + "\n" + - " Total Globals : " + Twine(GlobalSymbols.size()) + "\n" + + " Total Data Symbols : " + Twine(DataSymbols.size()) + "\n" + " Function Imports : " + Twine(NumFunctionImports) + "\n" + " Global Imports : " + Twine(NumGlobalImports) + "\n"); } uint32_t ObjFile::relocateVirtualAddress(uint32_t GlobalIndex) const { - if (auto *DG = dyn_cast<DefinedGlobal>(getGlobalSymbol(GlobalIndex))) + if (auto *DG = dyn_cast<DefinedData>(getDataSymbol(GlobalIndex))) return DG->getVirtualAddress(); else return 0; @@ -78,7 +78,7 @@ uint32_t ObjFile::relocateTableIndex(uint32_t Original) const { } uint32_t ObjFile::relocateGlobalIndex(uint32_t Original) const { - const Symbol *Sym = getGlobalSymbol(Original); + const Symbol *Sym = getDataSymbol(Original); uint32_t Index = Sym->getOutputIndex(); DEBUG(dbgs() << "relocateGlobalIndex: " << toString(*Sym) << ": " << Original << " -> " << Index << "\n"); @@ -215,7 +215,7 @@ void ObjFile::initializeSymbols() { } FunctionSymbols.resize(NumFunctionImports + WasmObj->functions().size()); - GlobalSymbols.resize(NumGlobalImports + WasmObj->globals().size()); + DataSymbols.resize(NumGlobalImports + WasmObj->globals().size()); ArrayRef<WasmFunction> Funcs = WasmObj->functions(); ArrayRef<uint32_t> FuncTypes = WasmObj->functionTypes(); @@ -226,7 +226,7 @@ void ObjFile::initializeSymbols() { Symtab->addComdat(C, this); FunctionSymbols.resize(NumFunctionImports + Funcs.size()); - GlobalSymbols.resize(NumGlobalImports + Globals.size()); + DataSymbols.resize(NumGlobalImports + Globals.size()); for (const WasmSegment &S : WasmObj->dataSegments()) { InputSegment *Seg = make<InputSegment>(S, this); @@ -242,7 +242,7 @@ void ObjFile::initializeSymbols() { Functions.emplace_back(F); } - // Populate `FunctionSymbols` and `GlobalSymbols` based on the WasmSymbols + // Populate `FunctionSymbols` and `DataSymbols` based on the WasmSymbols // in the object for (const SymbolRef &Sym : WasmObj->symbols()) { const WasmSymbol &WasmSym = WasmObj->getWasmSymbol(Sym.getRawDataRefImpl()); @@ -264,14 +264,14 @@ void ObjFile::initializeSymbols() { case WasmSymbol::SymbolType::GLOBAL_EXPORT: { InputSegment *Segment = getSegment(WasmSym); if (!isExcludedByComdat(Segment)) { - S = createDefinedGlobal(WasmSym, Segment, getGlobalValue(WasmSym)); + S = createDefinedData(WasmSym, Segment, getGlobalValue(WasmSym)); break; } Segment->Live = false; LLVM_FALLTHROUGH; // Exclude global, and add the symbol as undefined } case WasmSymbol::SymbolType::GLOBAL_IMPORT: - S = createUndefined(WasmSym, Symbol::Kind::UndefinedGlobalKind); + S = createUndefined(WasmSym, Symbol::Kind::UndefinedDataKind); break; } @@ -281,19 +281,19 @@ void ObjFile::initializeSymbols() { if (WasmSym.HasAltIndex) FunctionSymbols[WasmSym.AltIndex] = S; } else { - GlobalSymbols[WasmSym.ElementIndex] = S; + DataSymbols[WasmSym.ElementIndex] = S; if (WasmSym.HasAltIndex) - GlobalSymbols[WasmSym.AltIndex] = S; + DataSymbols[WasmSym.AltIndex] = S; } } DEBUG(for (size_t I = 0; I < FunctionSymbols.size(); ++I) assert(FunctionSymbols[I] != nullptr); - for (size_t I = 0; I < GlobalSymbols.size(); ++I) - assert(GlobalSymbols[I] != nullptr);); + for (size_t I = 0; I < DataSymbols.size(); ++I) + assert(DataSymbols[I] != nullptr);); DEBUG(dbgs() << "Functions : " << FunctionSymbols.size() << "\n"); - DEBUG(dbgs() << "Globals : " << GlobalSymbols.size() << "\n"); + DEBUG(dbgs() << "Globals : " << DataSymbols.size() << "\n"); } Symbol *ObjFile::createUndefined(const WasmSymbol &Sym, Symbol::Kind Kind, @@ -308,11 +308,11 @@ Symbol *ObjFile::createDefinedFunction(const WasmSymbol &Sym, return Symtab->addDefinedFunction(Sym.Name, Sym.Flags, this, Function); } -Symbol *ObjFile::createDefinedGlobal(const WasmSymbol &Sym, - InputSegment *Segment, uint32_t Address) { +Symbol *ObjFile::createDefinedData(const WasmSymbol &Sym, InputSegment *Segment, + uint32_t Address) { if (Sym.isBindingLocal()) - return make<DefinedGlobal>(Sym.Name, Sym.Flags, this, Segment, Address); - return Symtab->addDefinedGlobal(Sym.Name, Sym.Flags, this, Segment, Address); + return make<DefinedData>(Sym.Name, Sym.Flags, this, Segment, Address); + return Symtab->addDefinedData(Sym.Name, Sym.Flags, this, Segment, Address); } void ArchiveFile::parse() { diff --git a/lld/wasm/InputFiles.h b/lld/wasm/InputFiles.h index 8d49d2028aa..5f399dcf951 100644 --- a/lld/wasm/InputFiles.h +++ b/lld/wasm/InputFiles.h @@ -108,8 +108,8 @@ public: return cast<FunctionSymbol>(FunctionSymbols[Index]); } - GlobalSymbol *getGlobalSymbol(uint32_t Index) const { - return cast<GlobalSymbol>(GlobalSymbols[Index]); + DataSymbol *getDataSymbol(uint32_t Index) const { + return cast<DataSymbol>(DataSymbols[Index]); } private: @@ -118,8 +118,8 @@ private: uint32_t relocateGlobalIndex(uint32_t Original) const; uint32_t relocateTableIndex(uint32_t Original) const; - Symbol *createDefinedGlobal(const WasmSymbol &Sym, InputSegment *Segment, - uint32_t Address); + Symbol *createDefinedData(const WasmSymbol &Sym, InputSegment *Segment, + uint32_t Address); Symbol *createDefinedFunction(const WasmSymbol &Sym, InputFunction *Function); Symbol *createUndefined(const WasmSymbol &Sym, Symbol::Kind Kind, const WasmSignature *Signature = nullptr); @@ -137,7 +137,7 @@ private: std::vector<Symbol *> FunctionSymbols; // List of all global symbols indexed by the global index space - std::vector<Symbol *> GlobalSymbols; + std::vector<Symbol *> DataSymbols; uint32_t NumGlobalImports = 0; uint32_t NumFunctionImports = 0; diff --git a/lld/wasm/MarkLive.cpp b/lld/wasm/MarkLive.cpp index 1e00ca04ea2..dbeccee7652 100644 --- a/lld/wasm/MarkLive.cpp +++ b/lld/wasm/MarkLive.cpp @@ -83,7 +83,7 @@ void lld::wasm::markLive() { case R_WEBASSEMBLY_MEMORY_ADDR_LEB: case R_WEBASSEMBLY_MEMORY_ADDR_SLEB: case R_WEBASSEMBLY_MEMORY_ADDR_I32: - Enqueue(C->File->getGlobalSymbol(Reloc.Index)); + Enqueue(C->File->getDataSymbol(Reloc.Index)); break; } } diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp index 408b5addf8e..094b5669a00 100644 --- a/lld/wasm/SymbolTable.cpp +++ b/lld/wasm/SymbolTable.cpp @@ -81,9 +81,9 @@ static void checkSymbolTypes(const Symbol &Existing, const InputFile &F, // symbols or both are data symbols). if (isa<FunctionSymbol>(Existing) != NewIsFunction) { error("symbol type mismatch: " + Existing.getName() + "\n>>> defined as " + - (isa<FunctionSymbol>(Existing) ? "Function" : "Global") + " in " + + (isa<FunctionSymbol>(Existing) ? "Function" : "Data") + " in " + toString(Existing.getFile()) + "\n>>> defined as " + - (NewIsFunction ? "Function" : "Global") + " in " + F.getName()); + (NewIsFunction ? "Function" : "Data") + " in " + F.getName()); return; } @@ -130,13 +130,14 @@ DefinedFunction *SymbolTable::addSyntheticFunction(StringRef Name, return replaceSymbol<DefinedFunction>(S, Name, Flags, Type); } -DefinedGlobal *SymbolTable::addSyntheticGlobal(StringRef Name, uint32_t Flags) { - DEBUG(dbgs() << "addSyntheticGlobal: " << Name << "\n"); +DefinedData *SymbolTable::addSyntheticDataSymbol(StringRef Name, + uint32_t Flags) { + DEBUG(dbgs() << "addSyntheticDataSymbol: " << Name << "\n"); Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name); assert(WasInserted); - return replaceSymbol<DefinedGlobal>(S, Name, Flags); + return replaceSymbol<DefinedData>(S, Name, Flags); } static bool shouldReplace(const Symbol &Existing, InputFile *NewFile, @@ -192,15 +193,15 @@ Symbol *SymbolTable::addDefinedFunction(StringRef Name, uint32_t Flags, return S; } -Symbol *SymbolTable::addDefinedGlobal(StringRef Name, uint32_t Flags, +Symbol *SymbolTable::addDefinedData(StringRef Name, uint32_t Flags, InputFile *F, InputSegment *Segment, uint32_t Address) { - DEBUG(dbgs() << "addDefinedGlobal:" << Name << " addr:" << Address << "\n"); + DEBUG(dbgs() << "addDefinedData:" << Name << " addr:" << Address << "\n"); Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name); if (WasInserted || shouldReplace(*S, F, Flags, Segment, false)) - replaceSymbol<DefinedGlobal>(S, Name, Flags, F, Segment, Address); + replaceSymbol<DefinedData>(S, Name, Flags, F, Segment, Address); return S; } @@ -218,7 +219,7 @@ Symbol *SymbolTable::addUndefined(StringRef Name, Symbol::Kind Kind, if (IsFunction) replaceSymbol<UndefinedFunction>(S, Name, Flags, F, Type); else - replaceSymbol<UndefinedGlobal>(S, Name, Flags, F); + replaceSymbol<UndefinedData>(S, Name, Flags, F); return S; } diff --git a/lld/wasm/SymbolTable.h b/lld/wasm/SymbolTable.h index 523da4d0b77..751bd1f4924 100644 --- a/lld/wasm/SymbolTable.h +++ b/lld/wasm/SymbolTable.h @@ -49,16 +49,15 @@ public: Symbol *addDefinedFunction(StringRef Name, uint32_t Flags, InputFile *F, InputFunction *Function = nullptr); - Symbol *addDefinedGlobal(StringRef Name, uint32_t Flags, InputFile *F, - InputSegment *Segment = nullptr, - uint32_t Address = 0); + Symbol *addDefinedData(StringRef Name, uint32_t Flags, InputFile *F, + InputSegment *Segment = nullptr, uint32_t Address = 0); Symbol *addUndefined(StringRef Name, Symbol::Kind Kind, uint32_t Flags, InputFile *F, const WasmSignature *Signature = nullptr); Symbol *addUndefinedFunction(StringRef Name, const WasmSignature *Type); void addLazy(ArchiveFile *F, const Archive::Symbol *Sym); bool addComdat(StringRef Name, ObjFile *); - DefinedGlobal *addSyntheticGlobal(StringRef Name, uint32_t Flags = 0); + DefinedData *addSyntheticDataSymbol(StringRef Name, uint32_t Flags = 0); DefinedFunction *addSyntheticFunction(StringRef Name, const WasmSignature *Type, uint32_t Flags = 0); diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp index 237534ea951..e94d4009586 100644 --- a/lld/wasm/Symbols.cpp +++ b/lld/wasm/Symbols.cpp @@ -22,10 +22,10 @@ using namespace lld; using namespace lld::wasm; DefinedFunction *WasmSym::CallCtors; -DefinedGlobal *WasmSym::DsoHandle; -DefinedGlobal *WasmSym::DataEnd; -DefinedGlobal *WasmSym::HeapBase; -DefinedGlobal *WasmSym::StackPointer; +DefinedData *WasmSym::DsoHandle; +DefinedData *WasmSym::DataEnd; +DefinedData *WasmSym::HeapBase; +DefinedData *WasmSym::StackPointer; bool Symbol::hasOutputIndex() const { if (auto *F = dyn_cast<DefinedFunction>(this)) @@ -45,7 +45,7 @@ uint32_t Symbol::getOutputIndex() const { InputChunk *Symbol::getChunk() const { if (auto *F = dyn_cast<DefinedFunction>(this)) return F->Function; - if (auto *G = dyn_cast<DefinedGlobal>(this)) + if (auto *G = dyn_cast<DefinedData>(this)) return G->Segment; return nullptr; } @@ -109,12 +109,12 @@ DefinedFunction::DefinedFunction(StringRef Name, uint32_t Flags, InputFile *F, Function ? &Function->Signature : nullptr), Function(Function) {} -uint32_t DefinedGlobal::getVirtualAddress() const { +uint32_t DefinedData::getVirtualAddress() const { DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n"); return Segment ? Segment->translateVA(VirtualAddress) : VirtualAddress; } -void DefinedGlobal::setVirtualAddress(uint32_t Value) { +void DefinedData::setVirtualAddress(uint32_t Value) { DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n"); VirtualAddress = Value; } @@ -130,12 +130,12 @@ std::string lld::toString(wasm::Symbol::Kind Kind) { switch (Kind) { case wasm::Symbol::DefinedFunctionKind: return "DefinedFunction"; - case wasm::Symbol::DefinedGlobalKind: - return "DefinedGlobal"; + case wasm::Symbol::DefinedDataKind: + return "DefinedData"; case wasm::Symbol::UndefinedFunctionKind: return "UndefinedFunction"; - case wasm::Symbol::UndefinedGlobalKind: - return "UndefinedGlobal"; + case wasm::Symbol::UndefinedDataKind: + return "UndefinedData"; case wasm::Symbol::LazyKind: return "LazyKind"; } diff --git a/lld/wasm/Symbols.h b/lld/wasm/Symbols.h index 00b6bef27d2..7425ed181c0 100644 --- a/lld/wasm/Symbols.h +++ b/lld/wasm/Symbols.h @@ -32,13 +32,13 @@ class Symbol { public: enum Kind { DefinedFunctionKind, - DefinedGlobalKind, + DefinedDataKind, LazyKind, UndefinedFunctionKind, - UndefinedGlobalKind, + UndefinedDataKind, - LastDefinedKind = DefinedGlobalKind, + LastDefinedKind = DefinedDataKind, InvalidKind, }; @@ -47,7 +47,7 @@ public: bool isLazy() const { return SymbolKind == LazyKind; } bool isDefined() const { return SymbolKind <= LastDefinedKind; } bool isUndefined() const { - return SymbolKind == UndefinedGlobalKind || + return SymbolKind == UndefinedDataKind || SymbolKind == UndefinedFunctionKind; } bool isLocal() const; @@ -136,26 +136,26 @@ public: } }; -class GlobalSymbol : public Symbol { +class DataSymbol : public Symbol { public: static bool classof(const Symbol *S) { - return S->kind() == DefinedGlobalKind || S->kind() == UndefinedGlobalKind; + return S->kind() == DefinedDataKind || S->kind() == UndefinedDataKind; } protected: - GlobalSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F) + DataSymbol(StringRef Name, Kind K, uint32_t Flags, InputFile *F) : Symbol(Name, K, Flags, F) {} }; -class DefinedGlobal : public GlobalSymbol { +class DefinedData : public DataSymbol { public: - DefinedGlobal(StringRef Name, uint32_t Flags, InputFile *F = nullptr, - InputSegment *Segment = nullptr, uint32_t Address = 0) - : GlobalSymbol(Name, DefinedGlobalKind, Flags, F), Segment(Segment), + DefinedData(StringRef Name, uint32_t Flags, InputFile *F = nullptr, + InputSegment *Segment = nullptr, uint32_t Address = 0) + : DataSymbol(Name, DefinedDataKind, Flags, F), Segment(Segment), VirtualAddress(Address) {} static bool classof(const Symbol *S) { - return S->kind() == DefinedGlobalKind; + return S->kind() == DefinedDataKind; } uint32_t getVirtualAddress() const; @@ -167,12 +167,12 @@ protected: uint32_t VirtualAddress; }; -class UndefinedGlobal : public GlobalSymbol { +class UndefinedData : public DataSymbol { public: - UndefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File = nullptr) - : GlobalSymbol(Name, UndefinedGlobalKind, Flags, File) {} + UndefinedData(StringRef Name, uint32_t Flags, InputFile *File = nullptr) + : DataSymbol(Name, UndefinedDataKind, Flags, File) {} static bool classof(const Symbol *S) { - return S->kind() == UndefinedGlobalKind; + return S->kind() == UndefinedDataKind; } }; @@ -194,25 +194,25 @@ struct WasmSym { // __stack_pointer // Global that holds the address of the top of the explicit value stack in // linear memory. - static DefinedGlobal *StackPointer; + static DefinedData *StackPointer; // __data_end // Symbol marking the end of the data and bss. - static DefinedGlobal *DataEnd; + static DefinedData *DataEnd; // __heap_base // Symbol marking the end of the data, bss and explicit stack. Any linear // memory following this address is not used by the linked code and can // therefore be used as a backing store for brk()/malloc() implementations. - static DefinedGlobal *HeapBase; + static DefinedData *HeapBase; // __wasm_call_ctors // Function that directly calls all ctors in priority order. static DefinedFunction *CallCtors; // __dso_handle - // Global used in calls to __cxa_atexit to determine current DLL - static DefinedGlobal *DsoHandle; + // Symbol used in calls to __cxa_atexit to determine current DLL + static DefinedData *DsoHandle; }; // A buffer class that is large enough to hold any Symbol-derived @@ -220,10 +220,10 @@ struct WasmSym { // using the placement new. union SymbolUnion { alignas(DefinedFunction) char A[sizeof(DefinedFunction)]; - alignas(DefinedGlobal) char B[sizeof(DefinedGlobal)]; + alignas(DefinedData) char B[sizeof(DefinedData)]; alignas(LazySymbol) char C[sizeof(LazySymbol)]; alignas(UndefinedFunction) char D[sizeof(UndefinedFunction)]; - alignas(UndefinedGlobal) char E[sizeof(UndefinedFunction)]; + alignas(UndefinedData) char E[sizeof(UndefinedFunction)]; }; template <typename T, typename... ArgT> diff --git a/lld/wasm/Writer.cpp b/lld/wasm/Writer.cpp index a03fc12bd6d..ffb987ea5b7 100644 --- a/lld/wasm/Writer.cpp +++ b/lld/wasm/Writer.cpp @@ -119,9 +119,9 @@ private: std::vector<const WasmSignature *> Types; DenseMap<WasmSignature, int32_t, WasmSignatureDenseMapInfo> TypeIndices; std::vector<const FunctionSymbol *> ImportedFunctions; - std::vector<const GlobalSymbol *> ImportedGlobals; + std::vector<const DataSymbol *> ImportedGlobals; std::vector<WasmExportEntry> ExportedSymbols; - std::vector<const DefinedGlobal *> DefinedGlobals; + std::vector<const DefinedData *> DefinedDataSymbols; std::vector<InputFunction *> DefinedFunctions; std::vector<const FunctionSymbol *> IndirectFunctions; std::vector<WasmInitFunc> InitFunctions; @@ -226,14 +226,14 @@ void Writer::createMemorySection() { } void Writer::createGlobalSection() { - if (DefinedGlobals.empty()) + if (DefinedDataSymbols.empty()) return; SyntheticSection *Section = createSyntheticSection(WASM_SEC_GLOBAL); raw_ostream &OS = Section->getStream(); - writeUleb128(OS, DefinedGlobals.size(), "global count"); - for (const DefinedGlobal *Sym : DefinedGlobals) { + writeUleb128(OS, DefinedDataSymbols.size(), "global count"); + for (const DefinedData *Sym : DefinedDataSymbols) { WasmGlobal Global; Global.Type.Type = WASM_TYPE_I32; Global.Type.Mutable = Sym == WasmSym::StackPointer; @@ -621,7 +621,7 @@ void Writer::calculateImports() { if (auto *F = dyn_cast<FunctionSymbol>(Sym)) { F->setOutputIndex(ImportedFunctions.size()); ImportedFunctions.push_back(F); - } else if (auto *G = dyn_cast<GlobalSymbol>(Sym)) { + } else if (auto *G = dyn_cast<DataSymbol>(Sym)) { G->setOutputIndex(ImportedGlobals.size()); ImportedGlobals.push_back(G); } @@ -659,7 +659,7 @@ void Writer::calculateExports() { for (Symbol *Sym : File->getSymbols()) { if (!Sym->isDefined() || File != Sym->getFile()) continue; - if (isa<GlobalSymbol>(Sym)) + if (!isa<FunctionSymbol>(Sym)) continue; if (!Sym->getChunk()->Live) continue; @@ -670,7 +670,7 @@ void Writer::calculateExports() { } } - for (const Symbol *Sym : DefinedGlobals) { + for (const Symbol *Sym : DefinedDataSymbols) { // Can't export the SP right now because its mutable, and mutuable globals // are yet supported in the official binary format. // TODO(sbc): Remove this if/when the "mutable global" proposal is accepted. @@ -719,21 +719,21 @@ void Writer::calculateTypes() { } void Writer::assignIndexes() { - uint32_t GlobalIndex = ImportedGlobals.size() + DefinedGlobals.size(); + uint32_t GlobalIndex = ImportedGlobals.size() + DefinedDataSymbols.size(); uint32_t FunctionIndex = ImportedFunctions.size() + DefinedFunctions.size(); - auto AddDefinedGlobal = [&](DefinedGlobal *Sym) { + auto AddDefinedData = [&](DefinedData *Sym) { if (Sym) { - DefinedGlobals.emplace_back(Sym); + DefinedDataSymbols.emplace_back(Sym); Sym->setOutputIndex(GlobalIndex++); } }; - AddDefinedGlobal(WasmSym::StackPointer); - AddDefinedGlobal(WasmSym::HeapBase); - AddDefinedGlobal(WasmSym::DataEnd); + AddDefinedData(WasmSym::StackPointer); + AddDefinedData(WasmSym::HeapBase); + AddDefinedData(WasmSym::DataEnd); if (Config->Relocatable) - DefinedGlobals.reserve(Symtab->getSymbols().size()); + DefinedDataSymbols.reserve(Symtab->getSymbols().size()); uint32_t TableIndex = kInitialTableOffset; @@ -744,8 +744,8 @@ void Writer::assignIndexes() { // Create wasm globals for data symbols defined in this file if (File != Sym->getFile()) continue; - if (auto *G = dyn_cast<DefinedGlobal>(Sym)) - AddDefinedGlobal(G); + if (auto *G = dyn_cast<DefinedData>(Sym)) + AddDefinedData(G); } } } @@ -893,7 +893,7 @@ void Writer::run() { if (errorHandler().Verbose) { log("Defined Functions: " + Twine(DefinedFunctions.size())); - log("Defined Globals : " + Twine(DefinedGlobals.size())); + log("Defined Data Syms: " + Twine(DefinedDataSymbols.size())); log("Function Imports : " + Twine(ImportedFunctions.size())); log("Global Imports : " + Twine(ImportedGlobals.size())); log("Total Imports : " + |