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
}}}
(cherry picked from commit 6356df46fb0ebff5467d3103b97c3c871940e402)
Change-Id: I26a9c91f133370161ab4679e36d9a02315d28847
diff --git a/src/runtime.cc b/src/runtime.cc
index 37c9dce..74f6652 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -111,10 +111,7 @@
delete class_linker_;
delete heap_;
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
- verifier::MethodVerifier::DeleteInferredRegCategoryMaps();
-#endif
- verifier::MethodVerifier::DeleteGcMaps();
+ verifier::MethodVerifier::Shutdown();
delete intern_table_;
delete java_vm_;
Thread::Shutdown();
@@ -658,11 +655,7 @@
thread_list_ = new ThreadList;
intern_table_ = new InternTable;
- verifier::MethodVerifier::InitGcMaps();
-
-#if defined(ART_USE_LLVM_COMPILER) || defined(ART_USE_GREENLAND_COMPILER)
- verifier::MethodVerifier::InitInferredRegCategoryMaps();
-#endif
+ verifier::MethodVerifier::Init();
heap_ = new Heap(options->heap_initial_size_,
options->heap_growth_limit_,