summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2013-05-20 20:29:14 -0700
committer Ian Rogers <irogers@google.com> 2013-05-20 21:16:03 -0700
commit33e9566255c426e7a2c8fca5b8a1b6a94a5d352c (patch)
tree80965d3d329c09ec5a574863a356562e42f639ff
parent34d64cba998cb86867109db351113e6f7c9293f7 (diff)
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
-rw-r--r--src/class_linker.cc3
-rw-r--r--src/class_linker.h32
-rw-r--r--src/common_test.h41
-rw-r--r--src/compiler/dex/compiler_internals.h2
-rw-r--r--src/compiler/dex/quick/arm/int_arm.cc1
-rw-r--r--src/compiler/dex/quick/gen_common.cc1
-rw-r--r--src/compiler/dex/quick/gen_invoke.cc2
-rw-r--r--src/compiler/dex/quick/mips/int_mips.cc1
-rw-r--r--src/compiler/dex/quick/x86/int_x86.cc1
-rw-r--r--src/compiler/driver/dex_compilation_unit.h2
-rw-r--r--src/debugger.cc5
-rw-r--r--src/dex2oat.cc4
-rw-r--r--src/dex_file.h3
-rw-r--r--src/dex_file_test.cc29
-rw-r--r--src/interpreter/interpreter.cc12
-rw-r--r--src/mirror/object_test.cc1
-rw-r--r--src/mirror/string.h7
-rw-r--r--src/native/dalvik_system_DexFile.cc36
-rw-r--r--src/oat/runtime/argument_visitor.h4
-rw-r--r--src/oat_file.h5
-rw-r--r--src/thread.cc4
-rw-r--r--src/verifier/method_verifier.h6
-rw-r--r--src/verifier/reg_type_cache-inl.h2
-rw-r--r--src/verifier/reg_type_cache.cc24
-rw-r--r--src/verifier/reg_type_cache.h2
25 files changed, 132 insertions, 98 deletions
diff --git a/src/class_linker.cc b/src/class_linker.cc
index 6029c830dc..63d01a9690 100644
--- a/src/class_linker.cc
+++ b/src/class_linker.cc
@@ -726,7 +726,8 @@ const OatFile* ClassLinker::FindOpenedOatFileFromDexLocation(const std::string&
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 3039d55f7a..d41373c7d7 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 @@ class ClassLinker {
// 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 @@ class ClassLinker {
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 @@ class ClassLinker {
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 @@ class ClassLinker {
}
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 0aac36bfce..a40537f8b5 100644
--- a/src/common_test.h
+++ b/src/common_test.h
@@ -116,28 +116,6 @@ byte* DecodeBase64(const char* src, size_t* dst_size) {
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 @@ class CommonTest : public testing::Test {
// 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 @@ class CommonTest : public testing::Test {
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 @@ class CommonTest : public testing::Test {
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 @@ class CommonTest : public testing::Test {
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 @@ class CommonTest : public testing::Test {
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 70e81d0359..c680f1bc67 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 4133aea6aa..586a3a49b5 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 c4c7536ad5..15aa904f46 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 58831bf7ed..afcd9efb7d 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 d65d08a979..fbff397bd9 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 043077889f..b2ee949f22 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 a9bb64feeb..0b90aaafdf 100644
--- a/src/compiler/driver/dex_compilation_unit.h
+++ b/src/compiler/driver/dex_compilation_unit.h
@@ -28,7 +28,7 @@ class ClassLoader;
class DexCache;
} // namespace mirror
class ClassLinker;
-class CompilationUnit;
+struct CompilationUnit;
class DexCompilationUnit {
public:
diff --git a/src/debugger.cc b/src/debugger.cc
index c92e43c734..d7fac4300b 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -2378,11 +2378,12 @@ void Dbg::UnwatchLocation(const JDWP::JdwpLocation* location) {
// 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 37d29961a7..292e41c6d7 100644
--- a/src/dex2oat.cc
+++ b/src/dex2oat.cc
@@ -444,6 +444,8 @@ class Dex2Oat {
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 @@ static size_t OpenDexFiles(const std::vector<const char*>& dex_filenames,
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 88dd5fce4e..6e34b5737f 100644
--- a/src/dex_file.h
+++ b/src/dex_file.h
@@ -345,7 +345,8 @@ class DexFile {
// 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 f075feafcb..e7899ecf31 100644
--- a/src/dex_file_test.cc
+++ b/src/dex_file_test.cc
@@ -24,6 +24,7 @@ namespace art {
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 @@ static const char kRawDex[] =
"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, Header) {
}
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, ClassDefs) {
}
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, CreateMethodSignature) {
}
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 ab0abb2e45..03618da4a8 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -385,7 +385,8 @@ static void DoMonitorExit(Thread* self, Object* ref) NO_THREAD_SAFETY_ANALYSIS {
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 void DoFieldPut(Thread* self, ShadowFrame& shadow_frame,
}
}
-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 @@ static inline const Instruction* FindNextInstructionFollowingException(Thread* s
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 inline const Instruction* FindNextInstructionFollowingException(Thread* s
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 8e9032d891..abf6c2968f 100644
--- a/src/mirror/object_test.cc
+++ b/src/mirror/object_test.cc
@@ -442,7 +442,6 @@ TEST_F(ObjectTest, DescriptorCompare) {
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 ef74fed93c..8109dcb9a9 100644
--- a/src/mirror/string.h
+++ b/src/mirror/string.h
@@ -151,13 +151,6 @@ class MANAGED String : public Object {
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 d703f83513..32056ca576 100644
--- a/src/native/dalvik_system_DexFile.cc
+++ b/src/native/dalvik_system_DexFile.cc
@@ -212,22 +212,30 @@ static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename
// 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";
+ }
+ } 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;
}
- return JNI_FALSE;
}
}
@@ -265,13 +273,13 @@ static jboolean DexFile_isDexOptNeeded(JNIEnv* env, jclass, jstring javaFilename
}
}
+ 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 4fb16e0241..4ab05b9e4d 100644
--- a/src/oat/runtime/argument_visitor.h
+++ b/src/oat/runtime/argument_visitor.h
@@ -63,7 +63,7 @@ class PortableArgumentVisitor {
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 @@ class QuickArgumentVisitor {
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 c0bf21f194..80a2920c8f 100644
--- a/src/oat_file.h
+++ b/src/oat_file.h
@@ -32,7 +32,7 @@ namespace art {
class ElfFile;
class MemMap;
class OatMethodOffsets;
-struct OatHeader;
+class OatHeader;
class OatFile {
public:
@@ -197,7 +197,8 @@ class OatFile {
};
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 84870780a3..66b1cfa026 100644
--- a/src/thread.cc
+++ b/src/thread.cc
@@ -839,7 +839,8 @@ struct StackDumpVisitor : public StackVisitor {
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 @@ void Thread::Shutdown() {
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 b7e1cf2257..ab7e3cc8dc 100644
--- a/src/verifier/method_verifier.h
+++ b/src/verifier/method_verifier.h
@@ -583,8 +583,10 @@ class MethodVerifier {
// 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 0c6e8d0f7e..f6b0056536 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 aac7e37403..e914d1e679 100644
--- a/src/verifier/reg_type_cache.cc
+++ b/src/verifier/reg_type_cache.cc
@@ -266,18 +266,18 @@ void RegTypeCache::ShutDown() {
}
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 41d3c6967d..602c95086b 100644
--- a/src/verifier/reg_type_cache.h
+++ b/src/verifier/reg_type_cache.h
@@ -55,7 +55,7 @@ class RegTypeCache {
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)