This is a follow-up to
https://android-review.googlesource.com/343265
where we replaced Atomic<> with std::atomic<> because
Atomic<> was hiding std::atomic<>::operator=(). However,
while the default constructor of Atomic<> initializes the
value, the default constructor of std::atomic<> does not.
Test: m valgrind-test-art-host
Bug:
34053922
Change-Id: Iff2b38a7b28ee2d114991b60e3c40a33425bfc48
class OptimizingCompilerStats {
public:
- OptimizingCompilerStats() {}
+ OptimizingCompilerStats() {
+ // The std::atomic<> default constructor leaves values uninitialized, so initialize them now.
+ Reset();
+ }
void RecordStat(MethodCompilationStat stat, uint32_t count = 1) {
compile_stats_[stat] += count;