Summary:
These four SpinMutex ctors was the only code executed in the ctor for
the static __asan::Allocator instance (same for the other sanitizers
allocators), which is supposed to be fully linker-initialized.
Also, when the global ctor for this allocator instance is executed,
this instance might already be initialized by __asan_init called from
.preinit_array.
Issue: https://github.com/google/sanitizers/issues/194
Reviewers: morehouse, eugenis, cryptoad
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D48142
llvm-svn: 334660
struct Stats {
uptr n_allocs, n_frees, currently_allocated, max_allocated, by_size_log[64];
} stats;
- SpinMutex mutex_;
+ StaticSpinMutex mutex_;
};
}
private:
- mutable SpinMutex mu_;
+ mutable StaticSpinMutex mu_;
};
atomic_store_relaxed(&max_size_, size);
atomic_store_relaxed(&min_size_, size / 10 * 9); // 90% of max size.
atomic_store_relaxed(&max_cache_size_, cache_size);
+
+ cache_mutex_.Init();
+ recycle_mutex_.Init();
}
uptr GetSize() const { return atomic_load_relaxed(&max_size_); }
atomic_uintptr_t min_size_;
atomic_uintptr_t max_cache_size_;
char pad1_[kCacheLineSize];
- SpinMutex cache_mutex_;
- SpinMutex recycle_mutex_;
+ StaticSpinMutex cache_mutex_;
+ StaticSpinMutex recycle_mutex_;
Cache cache_;
char pad2_[kCacheLineSize];