Make tsan happy.
tsan was unhappy with our static Mutex, claiming a race between the constructor
writing the 'rank_' field and Mutex::Lock reading it. My understanding of the
GCC static initialization acquire/release code is that it includes memory
barriers that should make this safe, so I'm reaching out to the tsan guys. In
the meantime, let's just make this MethodVerifier lock & collection like the
other MethodVerifier locks & collections.
WARNING: Possible data race during read of size 4 at 0x1A42F09C: {{{
T2 (Compiler Worker) (L{}):
#0 art::Mutex::Lock /home/enh/local-disk/clean-dalvik-dev/art/src/mutex.cc:89
#1 art::verifier::MethodVerifier::IsClassRejected /usr/local/google/home/enh/clean-dalvik-dev/art/src/mutex.h:77
#2 art::Compiler::CompileClass /home/enh/local-disk/clean-dalvik-dev/art/src/compiler.cc:1420
#3 art::WorkerThread::Go /home/enh/local-disk/clean-dalvik-dev/art/src/compiler.cc:1013
Concurrent write(s) happened at (OR AFTER) these points:
T1 (Compiler Worker) (L{}):
#0 art::Mutex::Mutex /home/enh/local-disk/clean-dalvik-dev/art/src/mutex.cc:67
#1 art::verifier::MethodVerifier::IsClassRejected /home/enh/local-disk/clean-dalvik-dev/art/src/verifier/method_verifier.cc:3334
#2 art::Compiler::CompileClass /home/enh/local-disk/clean-dalvik-dev/art/src/compiler.cc:1420
#3 art::WorkerThread::Go /home/enh/local-disk/clean-dalvik-dev/art/src/compiler.cc:1013
Address 0x1A42F09C is 28 bytes inside data symbol "_ZZN3art8verifierL22GetRejectedClassesLockEvE21rejected_classes_lock"
Race verifier data: 0x1A198B1E,0x1A198025
}}}
Change-Id: I09f84b8e59564f6b457f7a1d31d1c9cccaeefed8
4 files changed