Use static thread safety analysis when available, and fix the bugs GCC finds.
It's impossible to express the Heap locking and the ThreadList locking with
GCC, but Clang is supposed to be able to do it. This patch does what's possible
for now.
Change-Id: Ib64a890c9d27c6ce255d5003cb755c2ef1beba95
diff --git a/src/compiler.h b/src/compiler.h
index 74d3205..5a46de6 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -299,23 +299,23 @@
typedef SafeMap<const ClassReference, CompiledClass*> ClassTable;
// All class references that this compiler has compiled
mutable Mutex compiled_classes_lock_;
- ClassTable compiled_classes_;
+ ClassTable compiled_classes_ GUARDED_BY(compiled_classes_lock_);
typedef SafeMap<const MethodReference, CompiledMethod*> MethodTable;
// All method references that this compiler has compiled
mutable Mutex compiled_methods_lock_;
- MethodTable compiled_methods_;
+ MethodTable compiled_methods_ GUARDED_BY(compiled_methods_lock_);
typedef SafeMap<std::string, const CompiledInvokeStub*> InvokeStubTable;
// Invocation stubs created to allow invocation of the compiled methods
mutable Mutex compiled_invoke_stubs_lock_;
- InvokeStubTable compiled_invoke_stubs_;
+ InvokeStubTable compiled_invoke_stubs_ GUARDED_BY(compiled_invoke_stubs_lock_);
#if defined(ART_USE_LLVM_COMPILER)
typedef SafeMap<std::string, const CompiledInvokeStub*> ProxyStubTable;
// Proxy stubs created for proxy invocation delegation
mutable Mutex compiled_proxy_stubs_lock_;
- ProxyStubTable compiled_proxy_stubs_;
+ ProxyStubTable compiled_proxy_stubs_ GUARDED_BY(compiled_proxy_stubs_lock_);
#endif
bool image_;