Revert "[JITLink] Use MapVector to stabilize iteration order"
This reverts commit f8f4235612 and replaces the
MapVector with a sorted vector in the debug dump: We only need to sort the
sections for debug dumping, and don't want LinkGraph API clients assuming
anything about the section iteration order.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/MapVector.h"
|
||||
#include "llvm/ADT/FunctionExtras.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h"
|
||||
@@ -854,7 +853,7 @@ private:
|
||||
|
||||
class LinkGraph {
|
||||
private:
|
||||
using SectionMap = MapVector<StringRef, std::unique_ptr<Section>>;
|
||||
using SectionMap = DenseMap<StringRef, std::unique_ptr<Section>>;
|
||||
using ExternalSymbolMap = StringMap<Symbol *>;
|
||||
using AbsoluteSymbolSet = DenseSet<Symbol *>;
|
||||
using BlockSet = DenseSet<Block *>;
|
||||
@@ -1596,7 +1595,7 @@ private:
|
||||
unsigned PointerSize;
|
||||
llvm::endianness Endianness;
|
||||
GetEdgeKindNameFunction GetEdgeKindName = nullptr;
|
||||
MapVector<StringRef, std::unique_ptr<Section>> Sections;
|
||||
DenseMap<StringRef, std::unique_ptr<Section>> Sections;
|
||||
ExternalSymbolMap ExternalSymbols;
|
||||
AbsoluteSymbolSet AbsoluteSymbols;
|
||||
orc::shared::AllocActions AAs;
|
||||
|
||||
@@ -291,11 +291,18 @@ void LinkGraph::dump(raw_ostream &OS) {
|
||||
return false;
|
||||
});
|
||||
|
||||
for (auto &Sec : sections()) {
|
||||
OS << "section " << Sec.getName() << ":\n\n";
|
||||
std::vector<Section *> SortedSections;
|
||||
for (auto &Sec : sections())
|
||||
SortedSections.push_back(&Sec);
|
||||
llvm::sort(SortedSections, [](const Section *LHS, const Section *RHS) {
|
||||
return LHS->getName() < RHS->getName();
|
||||
});
|
||||
|
||||
for (auto *Sec : SortedSections) {
|
||||
OS << "section " << Sec->getName() << ":\n\n";
|
||||
|
||||
std::vector<Block *> SortedBlocks;
|
||||
llvm::copy(Sec.blocks(), std::back_inserter(SortedBlocks));
|
||||
llvm::copy(Sec->blocks(), std::back_inserter(SortedBlocks));
|
||||
llvm::sort(SortedBlocks, [](const Block *LHS, const Block *RHS) {
|
||||
return LHS->getAddress() < RHS->getAddress();
|
||||
});
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
# parent block is dead.
|
||||
#
|
||||
# CHECK: Link graph
|
||||
# CHECK-DAG: section parent:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-DAG: section child:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-DAG: section parent:
|
||||
# CHECK-EMPTY:
|
||||
|
||||
--- !COFF
|
||||
header:
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#
|
||||
# CHECK: section .func:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: section .xdata:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: section .pdata:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK: section .xdata:
|
||||
# CHECK-EMPTY:
|
||||
|
||||
.text
|
||||
|
||||
Reference in New Issue
Block a user