mirror of
https://github.com/rui314/mold.git
synced 2024-09-20 01:18:53 +03:00
temporary
This commit is contained in:
parent
3626108816
commit
6077bcf403
@ -14,6 +14,7 @@
|
||||
#include "llvm/Support/Timer.h"
|
||||
#include "tbb/blocked_range.h"
|
||||
#include "tbb/concurrent_hash_map.h"
|
||||
#include "tbb/concurrent_unordered_set.h"
|
||||
#include "tbb/parallel_for_each.h"
|
||||
#include "tbb/parallel_sort.h"
|
||||
#include "tbb/partitioner.h"
|
||||
|
23
intern.cc
23
intern.cc
@ -2,29 +2,20 @@
|
||||
|
||||
namespace tbb {
|
||||
template<>
|
||||
struct tbb_hash_compare<StringRef> {
|
||||
static size_t hash(const StringRef &k) {
|
||||
struct tbb_hash<StringRef> {
|
||||
size_t operator()(const StringRef &k) const {
|
||||
return llvm::hash_value(k);
|
||||
}
|
||||
|
||||
static bool equal(const StringRef &k1, const StringRef &k2) {
|
||||
return k1 == k2;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
typedef tbb::concurrent_hash_map<StringRef, InternedString> MapType;
|
||||
|
||||
static MapType map;
|
||||
|
||||
InternedString::InternedString(StringRef s) {
|
||||
if (s.empty())
|
||||
return;
|
||||
|
||||
MapType::accessor acc;
|
||||
map.insert(acc, s);
|
||||
if (acc->second.data() == nullptr)
|
||||
acc->second = {s.data(), s.size()};
|
||||
data_ = acc->second.data();
|
||||
size_ = acc->second.size();
|
||||
static tbb::concurrent_unordered_set<StringRef> set;
|
||||
|
||||
auto it = set.insert(s);
|
||||
data_ = it.first->data();
|
||||
size_ = it.first->size();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user