Various GCC 3.6 and clang build fixes.
Remove #error in common_test.h that fires with clang build and replace with
runtime error.
Fix bit rot caused by not compiling with Wthread-safety.
Fix clang build issues in compiler relating to missing header file definitions
in object files.
Other minor build and tidying issues.
Change-Id: Ife829ab0664581936155be524de46e6181c750b0
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 6029c83..63d01a9 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -726,7 +726,8 @@
static const DexFile* FindDexFileInOatLocation(const std::string& dex_location,
uint32_t dex_location_checksum,
- const std::string& oat_location) {
+ const std::string& oat_location)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
UniquePtr<OatFile> oat_file(OatFile::Open(oat_location, oat_location, NULL));
if (oat_file.get() == NULL) {
return NULL;
diff --git a/src/class_linker.h b/src/class_linker.h
index 3039d55..d41373c 100644
--- a/src/class_linker.h
+++ b/src/class_linker.h
@@ -30,13 +30,13 @@
namespace art {
namespace mirror {
-class ClassLoader;
-class DexCache;
-class DexCacheTest_Open_Test;
-class IfTable;
-template<class T> class ObjectArray;
-class StackTraceElement;
-}
+ class ClassLoader;
+ class DexCache;
+ class DexCacheTest_Open_Test;
+ class IfTable;
+ template<class T> class ObjectArray;
+ class StackTraceElement;
+} // namespace mirror
class ImageSpace;
class InternTable;
class ObjectLock;
@@ -247,10 +247,12 @@
// created oat file.
const DexFile* FindOrCreateOatFileForDexLocation(const std::string& dex_location,
const std::string& oat_location)
- LOCKS_EXCLUDED(dex_lock_);
+ LOCKS_EXCLUDED(dex_lock_)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
const DexFile* FindOrCreateOatFileForDexLocationLocked(const std::string& dex_location,
const std::string& oat_location)
- EXCLUSIVE_LOCKS_REQUIRED(dex_lock_);
+ EXCLUSIVE_LOCKS_REQUIRED(dex_lock_)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Find a DexFile within an OatFile given a DexFile location. Note
// that this returns null if the location checksum of the DexFile
// does not match the OatFile.
@@ -318,7 +320,8 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Get the oat code for a method from a method index.
- const void* GetOatCodeFor(const DexFile& dex_file, uint32_t method_idx);
+ const void* GetOatCodeFor(const DexFile& dex_file, uint32_t method_idx)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
pid_t GetClassesLockOwner(); // For SignalCatcher.
pid_t GetDexLockOwner(); // For SignalCatcher.
@@ -404,7 +407,8 @@
void FixupStaticTrampolines(mirror::Class* klass) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Finds the associated oat class for a dex_file and descriptor
- const OatFile::OatClass* GetOatClass(const DexFile& dex_file, const char* descriptor);
+ const OatFile::OatClass* GetOatClass(const DexFile& dex_file, const char* descriptor)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Attempts to insert a class into a class table. Returns NULL if
// the class was inserted, otherwise returns an existing class with
@@ -482,9 +486,11 @@
}
const OatFile* FindOpenedOatFileForDexFile(const DexFile& dex_file)
- LOCKS_EXCLUDED(dex_lock_);
+ LOCKS_EXCLUDED(dex_lock_)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
const OatFile* FindOpenedOatFileFromDexLocation(const std::string& dex_location)
- EXCLUSIVE_LOCKS_REQUIRED(dex_lock_);
+ EXCLUSIVE_LOCKS_REQUIRED(dex_lock_)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
const OatFile* FindOpenedOatFileFromOatLocation(const std::string& oat_location)
EXCLUSIVE_LOCKS_REQUIRED(dex_lock_);
const DexFile* VerifyAndOpenDexFileFromOatFile(const OatFile* oat_file,
diff --git a/src/common_test.h b/src/common_test.h
index 0aac36b..a40537f 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -116,28 +116,6 @@
return dst.release();
}
-static inline const DexFile* OpenDexFileBase64(const char* base64,
- const std::string& location) {
- // decode base64
- CHECK(base64 != NULL);
- size_t length;
- UniquePtr<byte[]> dex_bytes(DecodeBase64(base64, &length));
- CHECK(dex_bytes.get() != NULL);
-
- // write to provided file
- UniquePtr<File> file(OS::OpenFile(location.c_str(), true));
- CHECK(file.get() != NULL);
- if (!file->WriteFully(dex_bytes.get(), length)) {
- PLOG(FATAL) << "Failed to write base64 as dex file";
- }
- file.reset();
-
- // read dex file
- const DexFile* dex_file = DexFile::Open(location, location);
- CHECK(dex_file != NULL);
- return dex_file;
-}
-
class ScratchFile {
public:
ScratchFile() {
@@ -265,11 +243,8 @@
// Only uses __builtin___clear_cache if GCC >= 4.3.3
#if GCC_VERSION >= 40303
__builtin___clear_cache(reinterpret_cast<void*>(base), reinterpret_cast<void*>(base + len));
-#elif defined(__APPLE__)
- // Currently, only Mac OS builds use GCC 4.2.*. Those host builds do not
- // need to generate clear_cache on x86.
#else
-#error unsupported
+ LOG(FATAL) << "UNIMPLEMENTED: cache flush";
#endif
}
@@ -311,7 +286,13 @@
ASSERT_EQ(mkdir_result, 0);
java_lang_dex_file_ = DexFile::Open(GetLibCoreDexFileName(), GetLibCoreDexFileName());
+ if (java_lang_dex_file_ == NULL) {
+ LOG(FATAL) << "Could not open .dex file '" << GetLibCoreDexFileName() << "'\n";
+ }
conscrypt_file_ = DexFile::Open(GetConscryptFileName(), GetConscryptFileName());
+ if (conscrypt_file_ == NULL) {
+ LOG(FATAL) << "Could not open .dex file '" << GetConscryptFileName() << "'\n";
+ }
boot_class_path_.push_back(java_lang_dex_file_);
boot_class_path_.push_back(conscrypt_file_);
@@ -440,7 +421,7 @@
return GetAndroidRoot();
}
- const DexFile* OpenTestDexFile(const char* name) {
+ const DexFile* OpenTestDexFile(const char* name) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
CHECK(name != NULL);
std::string filename;
if (IsHost()) {
@@ -458,8 +439,7 @@
return dex_file;
}
- jobject LoadDex(const char* dex_name)
- SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ jobject LoadDex(const char* dex_name) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
const DexFile* dex_file = OpenTestDexFile(dex_name);
CHECK(dex_file != NULL);
class_linker_->RegisterDexFile(*dex_file);
@@ -474,7 +454,8 @@
return class_loader;
}
- void CompileClass(mirror::ClassLoader* class_loader, const char* class_name) {
+ void CompileClass(mirror::ClassLoader* class_loader, const char* class_name)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
std::string class_descriptor(DotToDescriptor(class_name));
mirror::Class* klass = class_linker_->FindClass(class_descriptor.c_str(), class_loader);
CHECK(klass != NULL) << "Class not found " << class_name;
diff --git a/src/compiler/dex/compiler_internals.h b/src/compiler/dex/compiler_internals.h
index 70e81d0..c680f1b 100644
--- a/src/compiler/dex/compiler_internals.h
+++ b/src/compiler/dex/compiler_internals.h
@@ -29,8 +29,6 @@
#include "mir_graph.h"
#include "compiler_ir.h"
#include "frontend.h"
-#include "gc/card_table.h"
-#include "mirror/dex_cache.h"
#include "monitor.h"
#include "thread.h"
#include "utils.h"
diff --git a/src/compiler/dex/quick/arm/int_arm.cc b/src/compiler/dex/quick/arm/int_arm.cc
index 4133aea..586a3a4 100644
--- a/src/compiler/dex/quick/arm/int_arm.cc
+++ b/src/compiler/dex/quick/arm/int_arm.cc
@@ -18,6 +18,7 @@
#include "arm_lir.h"
#include "codegen_arm.h"
+#include "mirror/array.h"
#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/src/compiler/dex/quick/gen_common.cc b/src/compiler/dex/quick/gen_common.cc
index c4c7536..15aa904 100644
--- a/src/compiler/dex/quick/gen_common.cc
+++ b/src/compiler/dex/quick/gen_common.cc
@@ -16,6 +16,7 @@
#include "compiler/dex/compiler_ir.h"
#include "compiler/dex/compiler_internals.h"
+#include "mirror/array.h"
#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/src/compiler/dex/quick/gen_invoke.cc b/src/compiler/dex/quick/gen_invoke.cc
index 58831bf..afcd9ef 100644
--- a/src/compiler/dex/quick/gen_invoke.cc
+++ b/src/compiler/dex/quick/gen_invoke.cc
@@ -16,6 +16,8 @@
#include "compiler/dex/compiler_ir.h"
#include "invoke_type.h"
+#include "mirror/array.h"
+#include "mirror/string.h"
#include "oat/runtime/oat_support_entrypoints.h"
#include "x86/codegen_x86.h"
diff --git a/src/compiler/dex/quick/mips/int_mips.cc b/src/compiler/dex/quick/mips/int_mips.cc
index d65d08a..fbff397 100644
--- a/src/compiler/dex/quick/mips/int_mips.cc
+++ b/src/compiler/dex/quick/mips/int_mips.cc
@@ -18,6 +18,7 @@
#include "codegen_mips.h"
#include "mips_lir.h"
+#include "mirror/array.h"
#include "oat/runtime/oat_support_entrypoints.h"
namespace art {
diff --git a/src/compiler/dex/quick/x86/int_x86.cc b/src/compiler/dex/quick/x86/int_x86.cc
index 0430778..b2ee949 100644
--- a/src/compiler/dex/quick/x86/int_x86.cc
+++ b/src/compiler/dex/quick/x86/int_x86.cc
@@ -17,6 +17,7 @@
/* This file contains codegen for the X86 ISA */
#include "codegen_x86.h"
+#include "mirror/array.h"
#include "x86_lir.h"
namespace art {
diff --git a/src/compiler/driver/dex_compilation_unit.h b/src/compiler/driver/dex_compilation_unit.h
index a9bb64f..0b90aaa 100644
--- a/src/compiler/driver/dex_compilation_unit.h
+++ b/src/compiler/driver/dex_compilation_unit.h
@@ -28,7 +28,7 @@
class DexCache;
} // namespace mirror
class ClassLinker;
-class CompilationUnit;
+struct CompilationUnit;
class DexCompilationUnit {
public:
diff --git a/src/debugger.cc b/src/debugger.cc
index c92e43c..d7fac43 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -2378,11 +2378,12 @@
// cause suspension if the thread is the current thread.
class ScopedThreadSuspension {
public:
- ScopedThreadSuspension(Thread* self, JDWP::ObjectId thread_id) :
+ ScopedThreadSuspension(Thread* self, JDWP::ObjectId thread_id)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) :
thread_(NULL),
error_(JDWP::ERR_NONE),
self_suspend_(false),
- other_suspend_(false) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
+ other_suspend_(false) {
ScopedObjectAccessUnchecked soa(self);
{
MutexLock mu(soa.Self(), *Locks::thread_list_lock_);
diff --git a/src/dex2oat.cc b/src/dex2oat.cc
index 37d2996..292e41c 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -444,6 +444,8 @@
static void OpenClassPathFiles(const std::string& class_path, std::vector<const DexFile*>& dex_files) {
std::vector<std::string> parsed;
Split(class_path, ':', parsed);
+ // Take Locks::mutator_lock_ so that lock ordering on the ClassLinker::dex_lock_ is maintained.
+ ScopedObjectAccess soa(Thread::Current());
for (size_t i = 0; i < parsed.size(); ++i) {
if (DexFilesContains(dex_files, parsed[i])) {
continue;
@@ -498,7 +500,7 @@
const char* dex_location = dex_locations[i];
const DexFile* dex_file = DexFile::Open(dex_filename, dex_location);
if (dex_file == NULL) {
- LOG(WARNING) << "could not open .dex from file " << dex_filename;
+ LOG(WARNING) << "Could not open .dex from file '" << dex_filename << "'\n";
++failure_count;
} else {
dex_files.push_back(dex_file);
diff --git a/src/dex_file.h b/src/dex_file.h
index 88dd5fc..6e34b57 100644
--- a/src/dex_file.h
+++ b/src/dex_file.h
@@ -345,7 +345,8 @@
// For .dex files, this is the header checksum.
// For zip files, this is the classes.dex zip entry CRC32 checksum.
// Return true if the checksum could be found, false otherwise.
- static bool GetChecksum(const std::string& filename, uint32_t& checksum);
+ static bool GetChecksum(const std::string& filename, uint32_t& checksum)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
// Opens .dex file, guessing the container format based on file extension
static const DexFile* Open(const std::string& filename,
diff --git a/src/dex_file_test.cc b/src/dex_file_test.cc
index f075fea..e7899ec 100644
--- a/src/dex_file_test.cc
+++ b/src/dex_file_test.cc
@@ -24,6 +24,7 @@
class DexFileTest : public CommonTest {};
TEST_F(DexFileTest, Open) {
+ ScopedObjectAccess soa(Thread::Current());
const DexFile* dex(OpenTestDexFile("Nested"));
ASSERT_TRUE(dex != NULL);
}
@@ -54,6 +55,29 @@
"AAACAAAAQAEAAAEgAAACAAAAVAEAAAYgAAACAAAAiAEAAAEQAAABAAAAqAEAAAIgAAAPAAAArgEA"
"AAMgAAACAAAAiAIAAAQgAAADAAAAlAIAAAAgAAACAAAAqwIAAAAQAAABAAAAxAIAAA==";
+static const DexFile* OpenDexFileBase64(const char* base64,
+ const std::string& location) {
+ // decode base64
+ CHECK(base64 != NULL);
+ size_t length;
+ UniquePtr<byte[]> dex_bytes(DecodeBase64(base64, &length));
+ CHECK(dex_bytes.get() != NULL);
+
+ // write to provided file
+ UniquePtr<File> file(OS::OpenFile(location.c_str(), true));
+ CHECK(file.get() != NULL);
+ if (!file->WriteFully(dex_bytes.get(), length)) {
+ PLOG(FATAL) << "Failed to write base64 as dex file";
+ }
+ file.reset();
+
+ // read dex file
+ ScopedObjectAccess soa(Thread::Current());
+ const DexFile* dex_file = DexFile::Open(location, location);
+ CHECK(dex_file != NULL);
+ return dex_file;
+}
+
TEST_F(DexFileTest, Header) {
ScratchFile tmp;
UniquePtr<const DexFile> raw(OpenDexFileBase64(kRawDex, tmp.GetFilename()));
@@ -86,17 +110,20 @@
}
TEST_F(DexFileTest, GetLocationChecksum) {
+ ScopedObjectAccess soa(Thread::Current());
const DexFile* raw(OpenTestDexFile("Main"));
EXPECT_NE(raw->GetHeader().checksum_, raw->GetLocationChecksum());
}
TEST_F(DexFileTest, GetChecksum) {
uint32_t checksum;
+ ScopedObjectAccess soa(Thread::Current());
EXPECT_TRUE(DexFile::GetChecksum(GetLibCoreDexFileName(), checksum));
EXPECT_EQ(java_lang_dex_file_->GetLocationChecksum(), checksum);
}
TEST_F(DexFileTest, ClassDefs) {
+ ScopedObjectAccess soa(Thread::Current());
const DexFile* raw(OpenTestDexFile("Nested"));
ASSERT_TRUE(raw != NULL);
EXPECT_EQ(2U, raw->NumClassDefs());
@@ -109,6 +136,7 @@
}
TEST_F(DexFileTest, CreateMethodSignature) {
+ ScopedObjectAccess soa(Thread::Current());
const DexFile* raw(OpenTestDexFile("CreateMethodSignature"));
ASSERT_TRUE(raw != NULL);
EXPECT_EQ(1U, raw->NumClassDefs());
@@ -164,6 +192,7 @@
}
TEST_F(DexFileTest, FindStringId) {
+ ScopedObjectAccess soa(Thread::Current());
const DexFile* raw(OpenTestDexFile("CreateMethodSignature"));
ASSERT_TRUE(raw != NULL);
EXPECT_EQ(1U, raw->NumClassDefs());
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index ab0abb2..03618da 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -385,7 +385,8 @@
static void DoInvoke(Thread* self, MethodHelper& mh, ShadowFrame& shadow_frame,
const Instruction* inst, InvokeType type, bool is_range,
- JValue* result) {
+ JValue* result)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c();
Object* receiver;
if (type == kStatic) {
@@ -579,7 +580,8 @@
}
}
-static inline String* ResolveString(Thread* self, MethodHelper& mh, uint32_t string_idx) {
+static inline String* ResolveString(Thread* self, MethodHelper& mh, uint32_t string_idx)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Class* java_lang_string_class = String::GetJavaLangString();
if (UNLIKELY(!java_lang_string_class->IsInitialized())) {
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
@@ -649,7 +651,8 @@
uint32_t dex_pc,
const uint16_t* insns,
SirtRef<Object>& this_object_ref,
- instrumentation::Instrumentation* instrumentation) {
+ instrumentation::Instrumentation* instrumentation)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
self->VerifyStack();
ThrowLocation throw_location;
mirror::Throwable* exception = self->GetException(&throw_location);
@@ -688,7 +691,8 @@
static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
__attribute__ ((cold, noreturn, noinline));
-static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh) {
+static void UnexpectedOpcode(const Instruction* inst, MethodHelper& mh)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
LOG(FATAL) << "Unexpected instruction: " << inst->DumpString(&mh.GetDexFile());
exit(0); // Unreachable, keep GCC happy.
}
diff --git a/src/mirror/object_test.cc b/src/mirror/object_test.cc
index 8e9032d..abf6c29 100644
--- a/src/mirror/object_test.cc
+++ b/src/mirror/object_test.cc
@@ -442,7 +442,6 @@
EXPECT_TRUE(mh2.HasSameNameAndSignature(&mh));
}
-
TEST_F(ObjectTest, StringHashCode) {
ScopedObjectAccess soa(Thread::Current());
SirtRef<String> empty(soa.Self(), String::AllocFromModifiedUtf8(soa.Self(), ""));
diff --git a/src/mirror/string.h b/src/mirror/string.h
index ef74fed..8109dcb 100644
--- a/src/mirror/string.h
+++ b/src/mirror/string.h
@@ -151,13 +151,6 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(String);
};
-// TODO: remove? only used in a unit test of itself.
-struct StringHashCode {
- int32_t operator()(String* string) const {
- return string->GetHashCode();
- }
-};
-
class MANAGED StringClass : public Class {
private:
CharArray* ASCII_;
diff --git a/src/native/dalvik_system_DexFile.cc b/src/native/dalvik_system_DexFile.cc
index d703f83..32056ca 100644
--- a/src/native/dalvik_system_DexFile.cc
+++ b/src/native/dalvik_system_DexFile.cc
@@ -212,22 +212,30 @@
// Check if we have an oat file next to the dex file.
std::string oat_filename(OatFile::DexFilenameToOatFilename(filename.c_str()));
UniquePtr<const OatFile> oat_file(OatFile::Open(oat_filename, oat_filename, NULL));
- if (oat_file.get() != NULL && oat_file->GetOatDexFile(filename.c_str()) != NULL) {
- uint32_t location_checksum;
- // If we have no classes.dex checksum such as in a user build, assume up-to-date.
- if (!DexFile::GetChecksum(filename.c_str(), location_checksum)) {
- if (debug_logging) {
- LOG(INFO) << "DexFile_isDexOptNeeded ignoring precompiled stripped file: " << filename.c_str();
- }
- return JNI_FALSE;
- }
+ if (oat_file.get() != NULL) {
ScopedObjectAccess soa(env);
- if (ClassLinker::VerifyOatFileChecksums(oat_file.get(), filename.c_str(), location_checksum)) {
+ const art::OatFile::OatDexFile* oat_dex_file = oat_file->GetOatDexFile(filename.c_str());
+ if (oat_dex_file == NULL) {
if (debug_logging) {
- LOG(INFO) << "DexFile_isDexOptNeeded precompiled file " << oat_filename
- << " is up-to-date checksum compared to " << filename.c_str();
+ LOG(INFO) << "DexFile_isDexOptNeeded GetOatDexFile failed";
}
- return JNI_FALSE;
+ } else {
+ uint32_t location_checksum;
+ // If we have no classes.dex checksum such as in a user build, assume up-to-date.
+ if (!DexFile::GetChecksum(filename.c_str(), location_checksum)) {
+ if (debug_logging) {
+ LOG(INFO) << "DexFile_isDexOptNeeded ignoring precompiled stripped file: "
+ << filename.c_str();
+ }
+ return JNI_FALSE;
+ }
+ if (ClassLinker::VerifyOatFileChecksums(oat_file.get(), filename.c_str(), location_checksum)) {
+ if (debug_logging) {
+ LOG(INFO) << "DexFile_isDexOptNeeded precompiled file " << oat_filename
+ << " is up-to-date checksum compared to " << filename.c_str();
+ }
+ return JNI_FALSE;
+ }
}
}
@@ -265,13 +273,13 @@
}
}
+ ScopedObjectAccess soa(env);
uint32_t location_checksum;
if (!DexFile::GetChecksum(filename.c_str(), location_checksum)) {
LOG(ERROR) << "DexFile_isDexOptNeeded failed to compute checksum of " << filename.c_str();
return JNI_TRUE;
}
- ScopedObjectAccess soa(env);
if (!ClassLinker::VerifyOatFileChecksums(oat_file.get(), filename.c_str(), location_checksum)) {
LOG(INFO) << "DexFile_isDexOptNeeded cache file " << cache_location
<< " has out-of-date checksum compared to " << filename.c_str();
diff --git a/src/oat/runtime/argument_visitor.h b/src/oat/runtime/argument_visitor.h
index 4fb16e0..4ab05b9 100644
--- a/src/oat/runtime/argument_visitor.h
+++ b/src/oat/runtime/argument_visitor.h
@@ -63,7 +63,7 @@
virtual void Visit() = 0;
- bool IsParamAReference() const {
+ bool IsParamAReference() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return caller_mh_.IsParamAReference(param_index_);
}
@@ -174,7 +174,7 @@
virtual void Visit() = 0;
- bool IsParamAReference() const {
+ bool IsParamAReference() const SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
return caller_mh_.IsParamAReference(param_index_);
}
diff --git a/src/oat_file.h b/src/oat_file.h
index c0bf21f..80a2920 100644
--- a/src/oat_file.h
+++ b/src/oat_file.h
@@ -32,7 +32,7 @@
class ElfFile;
class MemMap;
class OatMethodOffsets;
-struct OatHeader;
+class OatHeader;
class OatFile {
public:
@@ -197,7 +197,8 @@
};
const OatDexFile* GetOatDexFile(const std::string& dex_file_location,
- bool warn_if_not_found = true) const;
+ bool exception_if_not_found = true) const
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
std::vector<const OatDexFile*> GetOatDexFiles() const;
size_t Size() const {
diff --git a/src/thread.cc b/src/thread.cc
index 8487078..66b1cfa 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -839,7 +839,8 @@
int frame_count;
};
-static bool ShouldShowNativeStack(const Thread* thread) {
+static bool ShouldShowNativeStack(const Thread* thread)
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
ThreadState state = thread->GetState();
// In native code somewhere in the VM (one of the kWaitingFor* states)? That's interesting.
@@ -923,6 +924,7 @@
CHECK(is_started_);
is_started_ = false;
CHECK_PTHREAD_CALL(pthread_key_delete, (Thread::pthread_key_self_), "self key");
+ MutexLock mu(Thread::Current(), *Locks::thread_suspend_count_lock_);
if (resume_cond_ != NULL) {
delete resume_cond_;
resume_cond_ = NULL;
diff --git a/src/verifier/method_verifier.h b/src/verifier/method_verifier.h
index b7e1cf2..ab7e3cc 100644
--- a/src/verifier/method_verifier.h
+++ b/src/verifier/method_verifier.h
@@ -583,8 +583,10 @@
// Devirtualization map.
typedef SafeMap<const uint32_t, CompilerDriver::MethodReference> PcToConreteMethod;
- typedef SafeMap<const CompilerDriver::MethodReference, const PcToConreteMethod*> DevirtualizationMapTable;
- MethodVerifier::PcToConreteMethod* GenerateDevirtMap();
+ typedef SafeMap<const CompilerDriver::MethodReference, const PcToConreteMethod*>
+ DevirtualizationMapTable;
+ MethodVerifier::PcToConreteMethod* GenerateDevirtMap()
+ SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
static Mutex* devirt_maps_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
static DevirtualizationMapTable* devirt_maps_ GUARDED_BY(devirt_maps_lock_);
diff --git a/src/verifier/reg_type_cache-inl.h b/src/verifier/reg_type_cache-inl.h
index 0c6e8d0..f6b0056 100644
--- a/src/verifier/reg_type_cache-inl.h
+++ b/src/verifier/reg_type_cache-inl.h
@@ -24,7 +24,7 @@
namespace art {
namespace verifier {
template <class Type>
-Type* RegTypeCache::CreatePrimitiveTypeInstance(mirror::ClassLoader* loader, std::string descriptor) {
+Type* RegTypeCache::CreatePrimitiveTypeInstance(std::string descriptor) {
mirror::Class* klass = NULL;
// Try loading the class from linker.
if (!descriptor.empty()) {
diff --git a/src/verifier/reg_type_cache.cc b/src/verifier/reg_type_cache.cc
index aac7e37..e914d1e 100644
--- a/src/verifier/reg_type_cache.cc
+++ b/src/verifier/reg_type_cache.cc
@@ -266,18 +266,18 @@
}
void RegTypeCache::CreatePrimitiveTypes() {
- CreatePrimitiveTypeInstance<UndefinedType>(NULL, "");
- CreatePrimitiveTypeInstance<ConflictType>(NULL, "");
- CreatePrimitiveTypeInstance<BooleanType>(NULL, "Z");
- CreatePrimitiveTypeInstance<ByteType>(NULL, "B");
- CreatePrimitiveTypeInstance<ShortType>(NULL, "S");
- CreatePrimitiveTypeInstance<CharType>(NULL, "C");
- CreatePrimitiveTypeInstance<IntegerType>(NULL, "I");
- CreatePrimitiveTypeInstance<LongLoType>(NULL, "J");
- CreatePrimitiveTypeInstance<LongHiType>(NULL, "J");
- CreatePrimitiveTypeInstance<FloatType>(NULL, "F");
- CreatePrimitiveTypeInstance<DoubleLoType>(NULL, "D");
- CreatePrimitiveTypeInstance<DoubleHiType>(NULL, "D");
+ CreatePrimitiveTypeInstance<UndefinedType>("");
+ CreatePrimitiveTypeInstance<ConflictType>("");
+ CreatePrimitiveTypeInstance<BooleanType>("Z");
+ CreatePrimitiveTypeInstance<ByteType>("B");
+ CreatePrimitiveTypeInstance<ShortType>("S");
+ CreatePrimitiveTypeInstance<CharType>("C");
+ CreatePrimitiveTypeInstance<IntegerType>("I");
+ CreatePrimitiveTypeInstance<LongLoType>("J");
+ CreatePrimitiveTypeInstance<LongHiType>("J");
+ CreatePrimitiveTypeInstance<FloatType>("F");
+ CreatePrimitiveTypeInstance<DoubleLoType>("D");
+ CreatePrimitiveTypeInstance<DoubleHiType>("D");
}
const RegType& RegTypeCache::FromUnresolvedMerge(const RegType& left, const RegType& right) {
diff --git a/src/verifier/reg_type_cache.h b/src/verifier/reg_type_cache.h
index 41d3c69..602c950 100644
--- a/src/verifier/reg_type_cache.h
+++ b/src/verifier/reg_type_cache.h
@@ -55,7 +55,7 @@
const RegType& From(mirror::ClassLoader* loader, std::string descriptor, bool precise)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
template <class Type>
- static Type* CreatePrimitiveTypeInstance(mirror::ClassLoader*, std::string)
+ static Type* CreatePrimitiveTypeInstance(std::string descriptor)
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
void FillPrimitiveTypes() SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
const RegType& FromClass(mirror::Class* klass, bool precise)