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/verifier/method_verifier_test.cc b/src/verifier/method_verifier_test.cc
index 5c23e9f..e52feb3 100644
--- a/src/verifier/method_verifier_test.cc
+++ b/src/verifier/method_verifier_test.cc
@@ -27,7 +27,8 @@
class MethodVerifierTest : public CommonTest {
protected:
- void VerifyClass(const std::string& descriptor) {
+ void VerifyClass(const std::string& descriptor)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_) {
ASSERT_TRUE(descriptor != NULL);
Class* klass = class_linker_->FindSystemClass(descriptor.c_str());
@@ -36,7 +37,8 @@
ASSERT_TRUE(MethodVerifier::VerifyClass(klass, error_msg) == MethodVerifier::kNoFailure) << error_msg;
}
- void VerifyDexFile(const DexFile* dex) {
+ void VerifyDexFile(const DexFile* dex)
+ SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_) {
ASSERT_TRUE(dex != NULL);
// Verify all the classes defined in this file
@@ -49,12 +51,14 @@
};
TEST_F(MethodVerifierTest, LibCore) {
+ ScopedObjectAccess soa(Thread::Current());
VerifyDexFile(java_lang_dex_file_);
}
TEST_F(MethodVerifierTest, IntMath) {
- SirtRef<ClassLoader> class_loader(LoadDex("IntMath"));
- Class* klass = class_linker_->FindClass("LIntMath;", class_loader.get());
+ ScopedObjectAccess soa(Thread::Current());
+ jobject class_loader = LoadDex("IntMath");
+ Class* klass = class_linker_->FindClass("LIntMath;", soa.Decode<ClassLoader*>(class_loader));
std::string error_msg;
ASSERT_TRUE(MethodVerifier::VerifyClass(klass, error_msg) == MethodVerifier::kNoFailure) << error_msg;
}