From d32ec60c8e2d9cb237feaa96e8c312f3490c2494 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 28 Oct 2020 19:49:58 +0900 Subject: [PATCH] temporary --- input_files.cc | 8 +------- main.cc | 7 ------- mold.h | 3 ++- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/input_files.cc b/input_files.cc index 2e0def48..79f2a2e1 100644 --- a/input_files.cc +++ b/input_files.cc @@ -212,9 +212,6 @@ private: std::atomic_flag &lock; }; -std::atomic_int do_not_skip; -std::atomic_int skip; - void ObjectFile::register_defined_symbols() { for (int i = 0; i < symbols.size(); i++) { const ELF64LE::Sym &esym = elf_syms[first_global + i]; @@ -231,18 +228,15 @@ void ObjectFile::register_defined_symbols() { isec = sections[shndx]; bool is_weak = (esym.getBinding() == STB_WEAK); - Spinlock lock(sym.lock); + std::lock_guard lock(sym.mu); if (!sym.file || this->priority < sym.file->priority || (sym.is_weak && !is_weak)) { - do_not_skip++; sym.file = this; sym.input_section = isec; sym.value = esym.st_value; sym.visibility = esym.getVisibility(); sym.is_weak = is_weak; - } else { - skip++; } } } diff --git a/main.cc b/main.cc index fc8cbcff..62c59fb6 100644 --- a/main.cc +++ b/main.cc @@ -435,13 +435,6 @@ int main(int argc, char **argv) { }); } - { - extern std::atomic_int do_not_skip; - extern std::atomic_int skip; - llvm::outs() << "do_not_skip=" << do_not_skip - << " skip=" << skip << "\n"; - } - // Eliminate unused archive members. files.erase(std::remove_if(files.begin(), files.end(), [](ObjectFile *file){ return !file->is_alive; }), diff --git a/mold.h b/mold.h index 75ac6312..298b6b57 100644 --- a/mold.h +++ b/mold.h @@ -21,6 +21,7 @@ #include "tbb/parallel_reduce.h" #include "tbb/parallel_sort.h" #include "tbb/partitioner.h" +#include "tbb/spin_mutex.h" #include "tbb/task_arena.h" #include "tbb/task_group.h" @@ -164,7 +165,7 @@ public: return map.insert(name, Symbol(name)); } - std::atomic_flag lock = ATOMIC_FLAG_INIT; + tbb::spin_mutex mu; StringRef name; ObjectFile *file = nullptr; InputSection *input_section = nullptr;