summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2013-06-11 15:14:11 -0700
committer Ian Rogers <irogers@google.com> 2013-06-11 15:14:11 -0700
commite3359f7ad7671c5816f17145ca3a01516512e8d6 (patch)
treebfb5a78fb6c42ea5fc93638d6aaa82fdf7a201a6
parent62342ec720069cebe55f45aea2ff8512a17e7d62 (diff)
Don't recursively take ClassLinker::dex_lock_.
Fix for Bug: 9285048. Change-Id: I4bdefdc7e1de2eec6488e8d629147d9699f4d099
-rw-r--r--src/base/mutex.h2
-rw-r--r--src/class_linker.cc9
-rw-r--r--src/class_linker.h6
3 files changed, 11 insertions, 6 deletions
diff --git a/src/base/mutex.h b/src/base/mutex.h
index d6ae3dca79..e7d2e9790b 100644
--- a/src/base/mutex.h
+++ b/src/base/mutex.h
@@ -247,7 +247,7 @@ class LOCKABLE ReaderWriterMutex : public BaseMutex {
// Assert the current thread doesn't have exclusive access to the ReaderWriterMutex.
void AssertNotExclusiveHeld(const Thread* self) {
if (kDebugLocking) {
- CHECK(!IsExclusiveHeld(self));
+ CHECK(!IsExclusiveHeld(self)) << *this;
}
}
void AssertNotWriterHeld(const Thread* self) { AssertNotExclusiveHeld(self); }
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 0c5c9dad5e..5df99b058a 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -728,10 +728,9 @@ const OatFile* ClassLinker::FindOpenedOatFileFromDexLocation(const std::string&
return NULL;
}
-static const DexFile* FindDexFileInOatLocation(const std::string& dex_location,
- uint32_t dex_location_checksum,
- const std::string& oat_location)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+const DexFile* ClassLinker::FindDexFileInOatLocation(const std::string& dex_location,
+ uint32_t dex_location_checksum,
+ const std::string& oat_location) {
UniquePtr<OatFile> oat_file(OatFile::Open(oat_location, oat_location, NULL));
if (oat_file.get() == NULL) {
return NULL;
@@ -752,7 +751,7 @@ static const DexFile* FindDexFileInOatLocation(const std::string& dex_location,
if (oat_dex_file->GetDexFileLocationChecksum() != dex_location_checksum) {
return NULL;
}
- runtime->GetClassLinker()->RegisterOatFile(*oat_file.release());
+ RegisterOatFileLocked(*oat_file.release());
return oat_dex_file->OpenDexFile();
}
diff --git a/src/class_linker.h b/src/class_linker.h
index eab1fcc814..e0f297dd60 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -500,6 +500,12 @@ class ClassLinker {
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_, dex_lock_);
const OatFile* FindOpenedOatFileFromOatLocation(const std::string& oat_location)
SHARED_LOCKS_REQUIRED(dex_lock_);
+ const DexFile* FindDexFileInOatLocation(const std::string& dex_location,
+ uint32_t dex_location_checksum,
+ const std::string& oat_location)
+ EXCLUSIVE_LOCKS_REQUIRED(dex_lock_)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
+
const DexFile* VerifyAndOpenDexFileFromOatFile(const OatFile* oat_file,
const std::string& dex_location,
uint32_t dex_location_checksum)