Revert "Move LoadedModule list to a NoCtor vector and initialize on demand."
I think this may have introduced a failure on llvm-clang-lld-x86_64-debian-fast This reverts commit r314533 llvm-svn: 314552
This commit is contained in:
parent
615a3bbdad
commit
74c93de659
|
|
@ -727,7 +727,7 @@ class LoadedModule {
|
|||
// filling this information.
|
||||
class ListOfModules {
|
||||
public:
|
||||
ListOfModules() : initialized(false) {}
|
||||
ListOfModules() : modules_(kInitialCapacity) {}
|
||||
~ListOfModules() { clear(); }
|
||||
void init();
|
||||
const LoadedModule *begin() const { return modules_.begin(); }
|
||||
|
|
@ -745,15 +745,10 @@ class ListOfModules {
|
|||
for (auto &module : modules_) module.clear();
|
||||
modules_.clear();
|
||||
}
|
||||
void clearOrInit() {
|
||||
initialized ? clear() : modules_.Initialize(kInitialCapacity);
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
InternalMmapVectorNoCtor<LoadedModule> modules_;
|
||||
InternalMmapVector<LoadedModule> modules_;
|
||||
// We rarely have more than 16K loaded modules.
|
||||
static const uptr kInitialCapacity = 1 << 14;
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
// Callback type for iterating over a set of memory ranges.
|
||||
|
|
|
|||
|
|
@ -424,7 +424,7 @@ typedef ElfW(Phdr) Elf_Phdr;
|
|||
# endif
|
||||
|
||||
struct DlIteratePhdrData {
|
||||
InternalMmapVectorNoCtor<LoadedModule> *modules;
|
||||
InternalMmapVector<LoadedModule> *modules;
|
||||
bool first;
|
||||
};
|
||||
|
||||
|
|
@ -473,13 +473,13 @@ static bool requiresProcmaps() {
|
|||
#endif
|
||||
}
|
||||
|
||||
static void procmapsInit(InternalMmapVectorNoCtor<LoadedModule> *modules) {
|
||||
static void procmapsInit(InternalMmapVector<LoadedModule> *modules) {
|
||||
MemoryMappingLayout memory_mapping(false);
|
||||
memory_mapping.DumpListOfModules(modules);
|
||||
}
|
||||
|
||||
void ListOfModules::init() {
|
||||
clearOrInit();
|
||||
clear();
|
||||
if (requiresProcmaps()) {
|
||||
procmapsInit(&modules_);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -411,7 +411,7 @@ void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size,
|
|||
}
|
||||
|
||||
void ListOfModules::init() {
|
||||
clearOrInit();
|
||||
clear();
|
||||
MemoryMappingLayout memory_mapping(false);
|
||||
memory_mapping.DumpListOfModules(&modules_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ class MemoryMappingLayout {
|
|||
static void CacheMemoryMappings();
|
||||
|
||||
// Adds all mapped objects into a vector.
|
||||
void DumpListOfModules(InternalMmapVectorNoCtor<LoadedModule> *modules);
|
||||
void DumpListOfModules(InternalMmapVector<LoadedModule> *modules);
|
||||
|
||||
private:
|
||||
void LoadFromCache();
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ void MemoryMappingLayout::LoadFromCache() {
|
|||
}
|
||||
|
||||
void MemoryMappingLayout::DumpListOfModules(
|
||||
InternalMmapVectorNoCtor<LoadedModule> *modules) {
|
||||
InternalMmapVector<LoadedModule> *modules) {
|
||||
Reset();
|
||||
InternalScopedString module_name(kMaxPathLength);
|
||||
MemoryMappedSegment segment(module_name.data(), module_name.size());
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ bool MemoryMappingLayout::Next(MemoryMappedSegment *segment) {
|
|||
}
|
||||
|
||||
void MemoryMappingLayout::DumpListOfModules(
|
||||
InternalMmapVectorNoCtor<LoadedModule> *modules) {
|
||||
InternalMmapVector<LoadedModule> *modules) {
|
||||
Reset();
|
||||
InternalScopedString module_name(kMaxPathLength);
|
||||
MemoryMappedSegment segment(module_name.data(), kMaxPathLength);
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ static uptr GetPreferredBase(const char *modname) {
|
|||
}
|
||||
|
||||
void ListOfModules::init() {
|
||||
clearOrInit();
|
||||
clear();
|
||||
HANDLE cur_process = GetCurrentProcess();
|
||||
|
||||
// Query the list of modules. Start by assuming there are no more than 256
|
||||
|
|
|
|||
Loading…
Reference in New Issue