Global lock levels.
Introduce the notion of the mutators/GC being a shared-exclusive (aka
reader-writer) lock. Introduce globally ordered locks, analysable by
annotalysis, statically at compile time. Add locking attributes to
methods.
More subtly, remove the heap_lock_ and split between various locks that
are held for smaller periods (where work doesn't get blocked). Remove
buggy Dalvik style thread transitions. Make GC use CMS in all cases when
concurrent is enabled. Fix bug where suspend counts rather than debug
suspend counts were sent to JDWP. Move the PathClassLoader to
WellKnownClasses. In debugger refactor calls to send request and
possibly suspend. Break apart different VmWait thread states. Move
identity hash code to a shared method.
Change-Id: Icdbfc3ce3fcccd14341860ac7305d8e97b51f5c6
diff --git a/src/utils.h b/src/utils.h
index a31588b..851c6b1 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -167,30 +167,36 @@
std::string PrettyDescriptor(const String* descriptor);
std::string PrettyDescriptor(const std::string& descriptor);
std::string PrettyDescriptor(Primitive::Type type);
-std::string PrettyDescriptor(const Class* klass);
+std::string PrettyDescriptor(const Class* klass)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
// Returns a human-readable signature for 'f'. Something like "a.b.C.f" or
// "int a.b.C.f" (depending on the value of 'with_type').
-std::string PrettyField(const Field* f, bool with_type = true);
+std::string PrettyField(const Field* f, bool with_type = true)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
std::string PrettyField(uint32_t field_idx, const DexFile& dex_file, bool with_type = true);
// Returns a human-readable signature for 'm'. Something like "a.b.C.m" or
// "a.b.C.m(II)V" (depending on the value of 'with_signature').
-std::string PrettyMethod(const Method* m, bool with_signature = true);
+std::string PrettyMethod(const Method* m, bool with_signature = true)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
std::string PrettyMethod(uint32_t method_idx, const DexFile& dex_file, bool with_signature = true);
// Returns a human-readable form of the name of the *class* of the given object.
// So given an instance of java.lang.String, the output would
// be "java.lang.String". Given an array of int, the output would be "int[]".
// Given String.class, the output would be "java.lang.Class<java.lang.String>".
-std::string PrettyTypeOf(const Object* obj);
+std::string PrettyTypeOf(const Object* obj)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
// Returns a human-readable form of the name of the given class.
// Given String.class, the output would be "java.lang.Class<java.lang.String>".
-std::string PrettyClass(const Class* c);
+std::string PrettyClass(const Class* c)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
// Returns a human-readable form of the name of the given class with its class loader.
-std::string PrettyClassAndClassLoader(const Class* c);
+std::string PrettyClassAndClassLoader(const Class* c)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
// Returns a human-readable size string such as "1MB".
std::string PrettySize(size_t size_in_bytes);
@@ -223,9 +229,11 @@
bool IsValidMemberName(const char* s);
// Returns the JNI native function name for the non-overloaded method 'm'.
-std::string JniShortName(const Method* m);
+std::string JniShortName(const Method* m)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
// Returns the JNI native function name for the overloaded method 'm'.
-std::string JniLongName(const Method* m);
+std::string JniLongName(const Method* m)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
bool ReadFileToString(const std::string& file_name, std::string* result);