diff options
author | Ian Rogers <irogers@google.com> | 2013-08-13 22:10:30 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-08-13 22:30:39 -0700 |
commit | 0f40ac31134d9ae0f059d4c448165599dc8459c1 (patch) | |
tree | 2f908f5d7a51d4e7b028b307e5d43a9e794abc10 | |
parent | 97a03e3cc86002b10889562a6b5b164cd2b99e7e (diff) | |
download | art-0f40ac31134d9ae0f059d4c448165599dc8459c1.tar.gz art-0f40ac31134d9ae0f059d4c448165599dc8459c1.tar.bz2 art-0f40ac31134d9ae0f059d4c448165599dc8459c1.zip |
Fix races in small mode compiler filters setup
Fixes host tests in small art mode.
Change-Id: I2579f872583f425607f91c1e58df68b05b5098bb
-rw-r--r-- | dex2oat/dex2oat.cc | 11 | ||||
-rw-r--r-- | runtime/class_linker.cc | 4 | ||||
-rw-r--r-- | runtime/common_test.h | 4 | ||||
-rw-r--r-- | runtime/entrypoints/interpreter/interpreter_entrypoints.cc | 3 | ||||
-rw-r--r-- | runtime/interpreter/interpreter.h | 6 | ||||
-rw-r--r-- | runtime/verifier/method_verifier.cc | 11 |
6 files changed, 19 insertions, 20 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index ac2c1a9c6..25cfda6a4 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -851,7 +851,6 @@ static int dex2oat(int argc, char** argv) { options.push_back(std::make_pair("-sea_ir", reinterpret_cast<void*>(NULL))); #endif - Dex2Oat* p_dex2oat; if (!Dex2Oat::Create(&p_dex2oat, options, compiler_backend, instruction_set, thread_count)) { LOG(ERROR) << "Failed to create dex2oat"; @@ -861,6 +860,11 @@ static int dex2oat(int argc, char** argv) { // Runtime::Create acquired the mutator_lock_ that is normally given away when we Runtime::Start, // give it away now and then switch to a more managable ScopedObjectAccess. Thread::Current()->TransitionFromRunnableToSuspended(kNative); + // If we're doing the image, override the compiler filter to force full compilation. Must be + // done ahead of WellKnownClasses::Init that causes verification. + if (image && Runtime::Current()->GetCompilerFilter() == Runtime::kInterpretOnly) { + Runtime::Current()->SetCompilerFilter(Runtime::kSpeed); + } // Whilst we're in native take the opportunity to initialize well known classes. WellKnownClasses::Init(Thread::Current()->GetJniEnv()); ScopedObjectAccess soa(Thread::Current()); @@ -905,11 +909,6 @@ static int dex2oat(int argc, char** argv) { } } - // If we're doing the image, override the compiler filter to force full compilation. - if (image && Runtime::Current()->GetCompilerFilter() == Runtime::kInterpretOnly) { - Runtime::Current()->SetCompilerFilter(Runtime::kSpeed); - } - /* * If we're not in interpret-only mode, go ahead and compile small applications. Don't * bother to check if we're doing the image. diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 1e21736d6..bd36a6c39 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -70,10 +70,6 @@ namespace art { -extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, - const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result); - static void ThrowNoClassDefFoundError(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2))) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/common_test.h b/runtime/common_test.h index ced2af967..e2dda8633 100644 --- a/runtime/common_test.h +++ b/runtime/common_test.h @@ -35,6 +35,7 @@ #include "gc/heap.h" #include "gtest/gtest.h" #include "instruction_set.h" +#include "interpreter/interpreter.h" #include "mirror/class_loader.h" #include "oat_file.h" #include "object_utils.h" @@ -192,7 +193,6 @@ class CommonTest : public testing::Test { compiled_method = compiler_driver_->GetCompiledMethod(MethodReference(&dex_file, method->GetDexMethodIndex())); - CHECK(compiled_method != NULL) << PrettyMethod(method); } if (compiled_method != NULL) { const std::vector<uint8_t>& code = compiled_method->GetCode(); @@ -208,6 +208,7 @@ class CommonTest : public testing::Test { &compiled_method->GetVmapTable()[0], NULL); oat_method.LinkMethod(method); + method->SetEntryPointFromInterpreter(artInterpreterToCompiledCodeBridge); } else { const void* method_code; // No code? You must mean to go into the interpreter. @@ -221,6 +222,7 @@ class CommonTest : public testing::Test { NULL, NULL); oat_method.LinkMethod(method); + method->SetEntryPointFromInterpreter(interpreter::artInterpreterToInterpreterBridge); } } diff --git a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc index f319a0084..ecf98bc72 100644 --- a/runtime/entrypoints/interpreter/interpreter_entrypoints.cc +++ b/runtime/entrypoints/interpreter/interpreter_entrypoints.cc @@ -27,8 +27,7 @@ namespace art { extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item, - ShadowFrame* shadow_frame, JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + ShadowFrame* shadow_frame, JValue* result) { mirror::ArtMethod* method = shadow_frame->GetMethod(); // Ensure static methods are initialized. if (method->IsStatic()) { diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h index 49e8de08e..efe11fc14 100644 --- a/runtime/interpreter/interpreter.h +++ b/runtime/interpreter/interpreter.h @@ -53,6 +53,12 @@ extern "C" void artInterpreterToInterpreterBridge(Thread* self, MethodHelper& mh SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); } // namespace interpreter + +extern "C" void artInterpreterToCompiledCodeBridge(Thread* self, MethodHelper& mh, + const DexFile::CodeItem* code_item, + ShadowFrame* shadow_frame, JValue* result) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); + } // namespace art #endif // ART_RUNTIME_INTERPRETER_INTERPRETER_H_ diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index cc0559d90..dcc9f90e8 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -4095,13 +4095,10 @@ const std::vector<uint8_t>* MethodVerifier::GetDexGcMap(MethodReference ref) { DCHECK(Runtime::Current()->IsCompiler()); ReaderMutexLock mu(Thread::Current(), *dex_gc_maps_lock_); DexGcMapTable::const_iterator it = dex_gc_maps_->find(ref); - if (it == dex_gc_maps_->end()) { - LOG(WARNING) << "Didn't find GC map for: " << PrettyMethod(ref.dex_method_index, *ref.dex_file); - return NULL; - } else { - CHECK(it->second != NULL); - return it->second; - } + CHECK(it != dex_gc_maps_->end()) + << "Didn't find GC map for: " << PrettyMethod(ref.dex_method_index, *ref.dex_file); + CHECK(it->second != NULL); + return it->second; } void MethodVerifier::SetDevirtMap(MethodReference ref, |