summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmark/scoped-primitive-array/scoped_primitive_array.cc2
-rw-r--r--compiler/compiler.h4
-rw-r--r--compiler/driver/compiler_driver.cc76
-rw-r--r--compiler/driver/compiler_driver.h28
-rw-r--r--compiler/jit/jit_compiler.cc6
-rw-r--r--compiler/jit/jit_logger.cc14
-rw-r--r--compiler/jit/jit_logger.h10
-rw-r--r--compiler/jni/jni_compiler_test.cc4
-rw-r--r--compiler/optimizing/optimizing_compiler.cc13
-rw-r--r--dalvikvm/dalvikvm.cc6
-rw-r--r--dex2oat/dex2oat.cc2
-rw-r--r--oatdump/oatdump.cc4
-rw-r--r--runtime/atomic.h2
-rw-r--r--runtime/base/mutex.cc25
-rw-r--r--runtime/class_linker.cc16
-rw-r--r--runtime/class_loader_context.cc2
-rw-r--r--runtime/common_runtime_test.cc8
-rw-r--r--runtime/common_throws.cc2
-rw-r--r--runtime/debugger.cc8
-rw-r--r--runtime/gc/heap.cc8
-rw-r--r--runtime/gc/reference_processor.cc2
-rw-r--r--runtime/interpreter/interpreter.cc2
-rw-r--r--runtime/interpreter/unstarted_runtime.cc2
-rw-r--r--runtime/java_vm_ext.cc4
-rw-r--r--runtime/jit/jit_code_cache.cc25
-rw-r--r--runtime/jni_internal.cc6
-rw-r--r--runtime/jni_internal_test.cc2
-rw-r--r--runtime/native/dalvik_system_DexFile.cc6
-rw-r--r--runtime/native/dalvik_system_VMDebug.cc4
-rw-r--r--runtime/native/dalvik_system_VMRuntime.cc6
-rw-r--r--runtime/native/dalvik_system_ZygoteHooks.cc6
-rw-r--r--runtime/native/java_lang_Class.cc11
-rw-r--r--runtime/native/java_lang_String.cc4
-rw-r--r--runtime/native/java_lang_StringFactory.cc7
-rw-r--r--runtime/native/java_lang_Thread.cc7
-rw-r--r--runtime/native/java_lang_VMClassLoader.cc7
-rw-r--r--runtime/native/libcore_util_CharsetUtils.cc7
-rw-r--r--runtime/native/native_util.h2
-rw-r--r--runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc5
-rw-r--r--runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc7
-rw-r--r--runtime/non_debuggable_classes.cc2
-rw-r--r--runtime/openjdkjvm/OpenjdkJvm.cc6
-rw-r--r--runtime/openjdkjvmti/events-inl.h2
-rw-r--r--runtime/openjdkjvmti/events.cc4
-rw-r--r--runtime/openjdkjvmti/jvmti_weak_table-inl.h2
-rw-r--r--runtime/openjdkjvmti/ti_breakpoint.cc2
-rw-r--r--runtime/openjdkjvmti/ti_class.cc10
-rw-r--r--runtime/openjdkjvmti/ti_class_loader.cc2
-rw-r--r--runtime/openjdkjvmti/ti_method.cc2
-rw-r--r--runtime/openjdkjvmti/ti_phase.cc2
-rw-r--r--runtime/openjdkjvmti/ti_properties.cc4
-rw-r--r--runtime/openjdkjvmti/ti_redefine.cc4
-rw-r--r--runtime/openjdkjvmti/ti_search.cc4
-rw-r--r--runtime/openjdkjvmti/ti_stack.cc4
-rw-r--r--runtime/openjdkjvmti/ti_thread.cc4
-rw-r--r--runtime/reflection.cc2
-rw-r--r--runtime/reflection_test.cc2
-rw-r--r--runtime/runtime.cc7
-rw-r--r--runtime/runtime_callbacks_test.cc2
-rw-r--r--runtime/thread.cc16
-rw-r--r--runtime/thread_list.cc4
-rw-r--r--runtime/trace.cc6
-rw-r--r--runtime/well_known_classes.cc2
-rw-r--r--test/570-checker-osr/osr.cc2
-rw-r--r--test/595-profile-saving/profile-saving.cc2
-rw-r--r--test/647-jni-get-field-id/get_field_id.cc2
-rw-r--r--test/common/runtime_state.cc2
-rwxr-xr-xtest/testrunner/testrunner.py44
68 files changed, 255 insertions, 254 deletions
diff --git a/benchmark/scoped-primitive-array/scoped_primitive_array.cc b/benchmark/scoped-primitive-array/scoped_primitive_array.cc
index 1664157297..005cae4ac9 100644
--- a/benchmark/scoped-primitive-array/scoped_primitive_array.cc
+++ b/benchmark/scoped-primitive-array/scoped_primitive_array.cc
@@ -15,7 +15,7 @@
*/
#include "jni.h"
-#include "ScopedPrimitiveArray.h"
+#include "nativehelper/ScopedPrimitiveArray.h"
extern "C" JNIEXPORT jlong JNICALL Java_ScopedPrimitiveArrayBenchmark_measureByteArray(
JNIEnv* env, jclass, int reps, jbyteArray arr) {
diff --git a/compiler/compiler.h b/compiler/compiler.h
index cd4c59101e..ba89cb1aed 100644
--- a/compiler/compiler.h
+++ b/compiler/compiler.h
@@ -25,6 +25,7 @@ namespace art {
namespace jit {
class JitCodeCache;
+ class JitLogger;
} // namespace jit
namespace mirror {
class ClassLoader;
@@ -76,7 +77,8 @@ class Compiler {
virtual bool JitCompile(Thread* self ATTRIBUTE_UNUSED,
jit::JitCodeCache* code_cache ATTRIBUTE_UNUSED,
ArtMethod* method ATTRIBUTE_UNUSED,
- bool osr ATTRIBUTE_UNUSED)
+ bool osr ATTRIBUTE_UNUSED,
+ jit::JitLogger* jit_logger ATTRIBUTE_UNUSED)
REQUIRES_SHARED(Locks::mutator_lock_) {
return false;
}
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 83d7a3d4cc..f3718c467b 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -41,31 +41,31 @@
#include "compiler.h"
#include "compiler_callbacks.h"
#include "compiler_driver-inl.h"
-#include "dex_compilation_unit.h"
-#include "dex_file-inl.h"
-#include "dex_instruction-inl.h"
#include "dex/dex_to_dex_compiler.h"
#include "dex/verification_results.h"
#include "dex/verified_method.h"
+#include "dex_compilation_unit.h"
+#include "dex_file-inl.h"
+#include "dex_instruction-inl.h"
#include "driver/compiler_options.h"
-#include "intrinsics_enum.h"
-#include "jni_internal.h"
-#include "object_lock.h"
-#include "runtime.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap.h"
#include "gc/space/image_space.h"
#include "gc/space/space.h"
-#include "mirror/class_loader.h"
+#include "handle_scope-inl.h"
+#include "intrinsics_enum.h"
+#include "jni_internal.h"
#include "mirror/class-inl.h"
+#include "mirror/class_loader.h"
#include "mirror/dex_cache-inl.h"
#include "mirror/object-inl.h"
#include "mirror/object-refvisitor-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/throwable.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "object_lock.h"
+#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "handle_scope-inl.h"
#include "thread.h"
#include "thread_list.h"
#include "thread_pool.h"
@@ -75,8 +75,8 @@
#include "utils/dex_cache_arrays_layout-inl.h"
#include "utils/swap_space.h"
#include "vdex_file.h"
-#include "verifier/method_verifier.h"
#include "verifier/method_verifier-inl.h"
+#include "verifier/method_verifier.h"
#include "verifier/verifier_deps.h"
#include "verifier/verifier_enums.h"
@@ -291,7 +291,6 @@ CompilerDriver::CompilerDriver(
instruction_set_(instruction_set == kArm ? kThumb2 : instruction_set),
instruction_set_features_(instruction_set_features),
requires_constructor_barrier_lock_("constructor barrier lock"),
- compiled_classes_lock_("compiled classes lock"),
non_relative_linker_patch_count_(0u),
image_classes_(image_classes),
classes_to_compile_(compiled_classes),
@@ -1947,7 +1946,12 @@ bool CompilerDriver::FastVerify(jobject jclass_loader,
if (compiler_only_verifies) {
// Just update the compiled_classes_ map. The compiler doesn't need to resolve
// the type.
- compiled_classes_.Overwrite(ClassReference(dex_file, i), mirror::Class::kStatusVerified);
+ DexFileReference ref(dex_file, i);
+ mirror::Class::Status existing = mirror::Class::kStatusNotReady;
+ DCHECK(compiled_classes_.Get(ref, &existing)) << ref.dex_file->GetLocation();
+ ClassStateTable::InsertResult result =
+ compiled_classes_.Insert(ref, existing, mirror::Class::kStatusVerified);
+ CHECK_EQ(result, ClassStateTable::kInsertResultSuccess);
} else {
// Update the class status, so later compilation stages know they don't need to verify
// the class.
@@ -1978,6 +1982,13 @@ bool CompilerDriver::FastVerify(jobject jclass_loader,
void CompilerDriver::Verify(jobject jclass_loader,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings) {
+ // Always add the dex files to compiled_classes_. This happens for all compiler filters.
+ for (const DexFile* dex_file : dex_files) {
+ if (!compiled_classes_.HaveDexFile(dex_file)) {
+ compiled_classes_.AddDexFile(dex_file, dex_file->NumClassDefs());
+ }
+ }
+
if (FastVerify(jclass_loader, dex_files, timings)) {
return;
}
@@ -2202,6 +2213,9 @@ void CompilerDriver::SetVerifiedDexFile(jobject class_loader,
size_t thread_count,
TimingLogger* timings) {
TimingLogger::ScopedTiming t("Verify Dex File", timings);
+ if (!compiled_classes_.HaveDexFile(&dex_file)) {
+ compiled_classes_.AddDexFile(&dex_file, dex_file.NumClassDefs());
+ }
ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
ParallelCompilationManager context(class_linker, class_loader, this, &dex_file, dex_files,
thread_pool);
@@ -2248,12 +2262,13 @@ class InitializeClassVisitor : public CompilationVisitor {
const bool is_app_image = manager_->GetCompiler()->GetCompilerOptions().IsAppImage();
mirror::Class::Status old_status = klass->GetStatus();
+ // Don't initialize classes in boot space when compiling app image
+ if (is_app_image && klass->IsBootStrapClassLoaded()) {
+ // Also return early and don't store the class status in the recorded class status.
+ return;
+ }
// Only try to initialize classes that were successfully verified.
if (klass->IsVerified()) {
- // Don't initialize classes in boot space when compiling app image
- if (is_app_image && klass->IsBootStrapClassLoaded()) {
- return;
- }
// Attempt to initialize the class but bail if we either need to initialize the super-class
// or static fields.
manager_->GetClassLinker()->EnsureInitialized(soa.Self(), klass, false, false);
@@ -2860,12 +2875,12 @@ void CompilerDriver::AddCompiledMethod(const MethodReference& method_ref,
bool CompilerDriver::GetCompiledClass(ClassReference ref, mirror::Class::Status* status) const {
DCHECK(status != nullptr);
- MutexLock mu(Thread::Current(), compiled_classes_lock_);
- ClassStateTable::const_iterator it = compiled_classes_.find(ref);
- if (it == compiled_classes_.end()) {
+ // The table doesn't know if something wasn't inserted. For this case it will return
+ // kStatusNotReady. To handle this, just assume anything not verified is not compiled.
+ if (!compiled_classes_.Get(DexFileReference(ref.first, ref.second), status) ||
+ *status < mirror::Class::kStatusVerified) {
return false;
}
- *status = it->second;
return true;
}
@@ -2886,15 +2901,20 @@ void CompilerDriver::RecordClassStatus(ClassReference ref, mirror::Class::Status
<< " of " << status;
}
- MutexLock mu(Thread::Current(), compiled_classes_lock_);
- auto it = compiled_classes_.find(ref);
- if (it == compiled_classes_.end()) {
- compiled_classes_.Overwrite(ref, status);
- } else if (status > it->second) {
+ ClassStateTable::InsertResult result;
+ do {
+ DexFileReference dex_ref(ref.first, ref.second);
+ mirror::Class::Status existing = mirror::Class::kStatusNotReady;
+ CHECK(compiled_classes_.Get(dex_ref, &existing)) << dex_ref.dex_file->GetLocation();
+ if (existing >= status) {
+ // Existing status is already better than we expect, break.
+ break;
+ }
// Update the status if we now have a greater one. This happens with vdex,
// which records a class is verified, but does not resolve it.
- it->second = status;
- }
+ result = compiled_classes_.Insert(dex_ref, existing, status);
+ CHECK(result != ClassStateTable::kInsertResultInvalidDexFile);
+ } while (result != ClassStateTable::kInsertResultSuccess);
}
CompiledMethod* CompilerDriver::GetCompiledMethod(MethodReference ref) const {
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h
index a3272d331d..93234cbdc4 100644
--- a/compiler/driver/compiler_driver.h
+++ b/compiler/driver/compiler_driver.h
@@ -117,12 +117,12 @@ class CompilerDriver {
void CompileAll(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings)
- REQUIRES(!Locks::mutator_lock_, !compiled_classes_lock_, !dex_to_dex_references_lock_);
+ REQUIRES(!Locks::mutator_lock_, !dex_to_dex_references_lock_);
// Compile a single Method.
void CompileOne(Thread* self, ArtMethod* method, TimingLogger* timings)
REQUIRES_SHARED(Locks::mutator_lock_)
- REQUIRES(!compiled_classes_lock_, !dex_to_dex_references_lock_);
+ REQUIRES(!dex_to_dex_references_lock_);
VerificationResults* GetVerificationResults() const;
@@ -153,8 +153,7 @@ class CompilerDriver {
std::unique_ptr<const std::vector<uint8_t>> CreateQuickResolutionTrampoline() const;
std::unique_ptr<const std::vector<uint8_t>> CreateQuickToInterpreterBridge() const;
- bool GetCompiledClass(ClassReference ref, mirror::Class::Status* status) const
- REQUIRES(!compiled_classes_lock_);
+ bool GetCompiledClass(ClassReference ref, mirror::Class::Status* status) const;
CompiledMethod* GetCompiledMethod(MethodReference ref) const;
size_t GetNonRelativeLinkerPatchCount() const;
@@ -337,8 +336,7 @@ class CompilerDriver {
// according to the profile file.
bool ShouldVerifyClassBasedOnProfile(const DexFile& dex_file, uint16_t class_idx) const;
- void RecordClassStatus(ClassReference ref, mirror::Class::Status status)
- REQUIRES(!compiled_classes_lock_);
+ void RecordClassStatus(ClassReference ref, mirror::Class::Status status);
// Checks if the specified method has been verified without failures. Returns
// false if the method is not in the verification results (GetVerificationResults).
@@ -387,7 +385,7 @@ class CompilerDriver {
void PreCompile(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings)
- REQUIRES(!Locks::mutator_lock_, !compiled_classes_lock_);
+ REQUIRES(!Locks::mutator_lock_);
void LoadImageClasses(TimingLogger* timings) REQUIRES(!Locks::mutator_lock_);
@@ -408,12 +406,9 @@ class CompilerDriver {
// Do fast verification through VerifierDeps if possible. Return whether
// verification was successful.
- // NO_THREAD_SAFETY_ANALYSIS as the method accesses a guarded value in a
- // single-threaded way.
bool FastVerify(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
- TimingLogger* timings)
- NO_THREAD_SAFETY_ANALYSIS;
+ TimingLogger* timings);
void Verify(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
@@ -441,12 +436,12 @@ class CompilerDriver {
void InitializeClasses(jobject class_loader,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings)
- REQUIRES(!Locks::mutator_lock_, !compiled_classes_lock_);
+ REQUIRES(!Locks::mutator_lock_);
void InitializeClasses(jobject class_loader,
const DexFile& dex_file,
const std::vector<const DexFile*>& dex_files,
TimingLogger* timings)
- REQUIRES(!Locks::mutator_lock_, !compiled_classes_lock_);
+ REQUIRES(!Locks::mutator_lock_);
void UpdateImageClasses(TimingLogger* timings) REQUIRES(!Locks::mutator_lock_);
@@ -484,10 +479,9 @@ class CompilerDriver {
std::map<ClassReference, bool> requires_constructor_barrier_
GUARDED_BY(requires_constructor_barrier_lock_);
- using ClassStateTable = SafeMap<const ClassReference, mirror::Class::Status>;
- // All class references that this compiler has compiled.
- mutable Mutex compiled_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
- ClassStateTable compiled_classes_ GUARDED_BY(compiled_classes_lock_);
+ // All class references that this compiler has compiled. Indexed by class defs.
+ using ClassStateTable = AtomicDexRefMap<mirror::Class::Status>;
+ ClassStateTable compiled_classes_;
typedef AtomicDexRefMap<CompiledMethod*> MethodTable;
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc
index 28a3f1edae..5fdf9ff07c 100644
--- a/compiler/jit/jit_compiler.cc
+++ b/compiler/jit/jit_compiler.cc
@@ -184,10 +184,8 @@ bool JitCompiler::CompileMethod(Thread* self, ArtMethod* method, bool osr) {
{
TimingLogger::ScopedTiming t2("Compiling", &logger);
JitCodeCache* const code_cache = runtime->GetJit()->GetCodeCache();
- success = compiler_driver_->GetCompiler()->JitCompile(self, code_cache, method, osr);
- if (success && (jit_logger_ != nullptr)) {
- jit_logger_->WriteLog(code_cache, method, osr);
- }
+ success = compiler_driver_->GetCompiler()->JitCompile(
+ self, code_cache, method, osr, jit_logger_.get());
}
// Trim maps to reduce memory usage.
diff --git a/compiler/jit/jit_logger.cc b/compiler/jit/jit_logger.cc
index aa4f66773a..2199b64139 100644
--- a/compiler/jit/jit_logger.cc
+++ b/compiler/jit/jit_logger.cc
@@ -50,11 +50,8 @@ void JitLogger::OpenPerfMapLog() {
}
}
-void JitLogger::WritePerfMapLog(JitCodeCache* code_cache, ArtMethod* method, bool osr) {
+void JitLogger::WritePerfMapLog(const void* ptr, size_t code_size, ArtMethod* method) {
if (perf_file_ != nullptr) {
- const void* ptr = osr ? code_cache->LookupOsrMethodHeader(method)->GetCode()
- : method->GetEntryPointFromQuickCompiledCode();
- size_t code_size = code_cache->GetMemorySizeOfCodePointer(ptr);
std::string method_name = method->PrettyMethod();
std::ostringstream stream;
@@ -270,11 +267,8 @@ void JitLogger::OpenJitDumpLog() {
WriteJitDumpHeader();
}
-void JitLogger::WriteJitDumpLog(JitCodeCache* code_cache, ArtMethod* method, bool osr) {
+void JitLogger::WriteJitDumpLog(const void* ptr, size_t code_size, ArtMethod* method) {
if (jit_dump_file_ != nullptr) {
- const void* code = osr ? code_cache->LookupOsrMethodHeader(method)->GetCode()
- : method->GetEntryPointFromQuickCompiledCode();
- size_t code_size = code_cache->GetMemorySizeOfCodePointer(code);
std::string method_name = method->PrettyMethod();
PerfJitCodeLoad jit_code;
@@ -285,7 +279,7 @@ void JitLogger::WriteJitDumpLog(JitCodeCache* code_cache, ArtMethod* method, boo
jit_code.process_id_ = static_cast<uint32_t>(getpid());
jit_code.thread_id_ = static_cast<uint32_t>(art::GetTid());
jit_code.vma_ = 0x0;
- jit_code.code_address_ = reinterpret_cast<uint64_t>(code);
+ jit_code.code_address_ = reinterpret_cast<uint64_t>(ptr);
jit_code.code_size_ = code_size;
jit_code.code_id_ = code_index_++;
@@ -297,7 +291,7 @@ void JitLogger::WriteJitDumpLog(JitCodeCache* code_cache, ArtMethod* method, boo
// Use UNUSED() here to avoid compiler warnings.
UNUSED(jit_dump_file_->WriteFully(reinterpret_cast<const char*>(&jit_code), sizeof(jit_code)));
UNUSED(jit_dump_file_->WriteFully(method_name.c_str(), method_name.size() + 1));
- UNUSED(jit_dump_file_->WriteFully(code, code_size));
+ UNUSED(jit_dump_file_->WriteFully(ptr, code_size));
WriteJitDumpDebugInfo();
}
diff --git a/compiler/jit/jit_logger.h b/compiler/jit/jit_logger.h
index 460864e8a9..19be9aa88e 100644
--- a/compiler/jit/jit_logger.h
+++ b/compiler/jit/jit_logger.h
@@ -94,10 +94,10 @@ class JitLogger {
OpenJitDumpLog();
}
- void WriteLog(JitCodeCache* code_cache, ArtMethod* method, bool osr)
+ void WriteLog(const void* ptr, size_t code_size, ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_) {
- WritePerfMapLog(code_cache, method, osr);
- WriteJitDumpLog(code_cache, method, osr);
+ WritePerfMapLog(ptr, code_size, method);
+ WriteJitDumpLog(ptr, code_size, method);
}
void CloseLog() {
@@ -108,13 +108,13 @@ class JitLogger {
private:
// For perf-map profiling
void OpenPerfMapLog();
- void WritePerfMapLog(JitCodeCache* code_cache, ArtMethod* method, bool osr)
+ void WritePerfMapLog(const void* ptr, size_t code_size, ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_);
void ClosePerfMapLog();
// For perf-inject profiling
void OpenJitDumpLog();
- void WriteJitDumpLog(JitCodeCache* code_cache, ArtMethod* method, bool osr)
+ void WriteJitDumpLog(const void* ptr, size_t code_size, ArtMethod* method)
REQUIRES_SHARED(Locks::mutator_lock_);
void CloseJitDumpLog();
diff --git a/compiler/jni/jni_compiler_test.cc b/compiler/jni/jni_compiler_test.cc
index 6ce7d75da6..6c7baf02b3 100644
--- a/compiler/jni/jni_compiler_test.cc
+++ b/compiler/jni/jni_compiler_test.cc
@@ -32,12 +32,12 @@
#include "mem_map.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
-#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
+#include "mirror/object_array-inl.h"
#include "mirror/stack_trace_element.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "nativeloader/native_loader.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread.h"
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 890ba674b5..b76a0df861 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -76,6 +76,7 @@
#include "jit/debugger_interface.h"
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
+#include "jit/jit_logger.h"
#include "jni/quick/jni_compiler.h"
#include "licm.h"
#include "load_store_analysis.h"
@@ -334,7 +335,11 @@ class OptimizingCompiler FINAL : public Compiler {
}
}
- bool JitCompile(Thread* self, jit::JitCodeCache* code_cache, ArtMethod* method, bool osr)
+ bool JitCompile(Thread* self,
+ jit::JitCodeCache* code_cache,
+ ArtMethod* method,
+ bool osr,
+ jit::JitLogger* jit_logger)
OVERRIDE
REQUIRES_SHARED(Locks::mutator_lock_);
@@ -1136,7 +1141,8 @@ bool CanEncodeInlinedMethodInStackMap(const DexFile& caller_dex_file, ArtMethod*
bool OptimizingCompiler::JitCompile(Thread* self,
jit::JitCodeCache* code_cache,
ArtMethod* method,
- bool osr) {
+ bool osr,
+ jit::JitLogger* jit_logger) {
StackHandleScope<3> hs(self);
Handle<mirror::ClassLoader> class_loader(hs.NewHandle(
method->GetDeclaringClass()->GetClassLoader()));
@@ -1272,6 +1278,9 @@ bool OptimizingCompiler::JitCompile(Thread* self,
}
Runtime::Current()->GetJit()->AddMemoryUsage(method, arena.BytesUsed());
+ if (jit_logger != nullptr) {
+ jit_logger->WriteLog(code, code_allocator.GetSize(), method);
+ }
return true;
}
diff --git a/dalvikvm/dalvikvm.cc b/dalvikvm/dalvikvm.cc
index 85debe4d38..dcb49a0375 100644
--- a/dalvikvm/dalvikvm.cc
+++ b/dalvikvm/dalvikvm.cc
@@ -21,10 +21,10 @@
#include <algorithm>
#include <memory>
-#include "jni.h"
#include "JniInvocation.h"
-#include "ScopedLocalRef.h"
-#include "toStringArray.h"
+#include "jni.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/toStringArray.h"
namespace art {
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index c4b099cbac..0ef496f6c8 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -76,13 +76,13 @@
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "oat_file.h"
#include "oat_file_assistant.h"
#include "oat_writer.h"
#include "os.h"
#include "runtime.h"
#include "runtime_options.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "utils.h"
#include "vdex_file.h"
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index ae26e7dfcf..0a95d49973 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -34,8 +34,8 @@
#include "art_method-inl.h"
#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
-#include "class_linker.h"
#include "class_linker-inl.h"
+#include "class_linker.h"
#include "debug/elf_debug_writer.h"
#include "debug/method_debug_info.h"
#include "dex_file-inl.h"
@@ -57,13 +57,13 @@
#include "mirror/dex_cache-inl.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "oat.h"
#include "oat_file-inl.h"
#include "oat_file_manager.h"
#include "os.h"
#include "safe_map.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "stack.h"
#include "stack_map.h"
#include "string_reference.h"
diff --git a/runtime/atomic.h b/runtime/atomic.h
index 25dd1a3a5e..09eae40a6b 100644
--- a/runtime/atomic.h
+++ b/runtime/atomic.h
@@ -187,7 +187,7 @@ class QuasiAtomic {
template<typename T>
class PACKED(sizeof(T)) Atomic : public std::atomic<T> {
public:
- Atomic<T>() : std::atomic<T>(0) { }
+ Atomic<T>() : std::atomic<T>(T()) { }
explicit Atomic<T>(T value) : std::atomic<T>(value) { }
diff --git a/runtime/base/mutex.cc b/runtime/base/mutex.cc
index a472b67fcd..03dda12f24 100644
--- a/runtime/base/mutex.cc
+++ b/runtime/base/mutex.cc
@@ -233,8 +233,27 @@ void BaseMutex::CheckSafeToWait(Thread* self) {
for (int i = kLockLevelCount - 1; i >= 0; --i) {
if (i != level_) {
BaseMutex* held_mutex = self->GetHeldMutex(static_cast<LockLevel>(i));
- // We expect waits to happen while holding the thread list suspend thread lock.
- if (held_mutex != nullptr) {
+ // We allow the thread to wait even if the user_code_suspension_lock_ is held so long as we
+ // are some thread's resume_cond_ (level_ == kThreadSuspendCountLock). This just means that
+ // gc or some other internal process is suspending the thread while it is trying to suspend
+ // some other thread. So long as the current thread is not being suspended by a
+ // SuspendReason::kForUserCode (which needs the user_code_suspension_lock_ to clear) this is
+ // fine.
+ if (held_mutex == Locks::user_code_suspension_lock_ && level_ == kThreadSuspendCountLock) {
+ // No thread safety analysis is fine since we have both the user_code_suspension_lock_
+ // from the line above and the ThreadSuspendCountLock since it is our level_. We use this
+ // lambda to avoid having to annotate the whole function as NO_THREAD_SAFETY_ANALYSIS.
+ auto is_suspending_for_user_code = [self]() NO_THREAD_SAFETY_ANALYSIS {
+ return self->GetUserCodeSuspendCount() != 0;
+ };
+ if (is_suspending_for_user_code()) {
+ LOG(ERROR) << "Holding \"" << held_mutex->name_ << "\" "
+ << "(level " << LockLevel(i) << ") while performing wait on "
+ << "\"" << name_ << "\" (level " << level_ << ") "
+ << "with SuspendReason::kForUserCode pending suspensions";
+ bad_mutexes_held = true;
+ }
+ } else if (held_mutex != nullptr) {
LOG(ERROR) << "Holding \"" << held_mutex->name_ << "\" "
<< "(level " << LockLevel(i) << ") while performing wait on "
<< "\"" << name_ << "\" (level " << level_ << ")";
@@ -243,7 +262,7 @@ void BaseMutex::CheckSafeToWait(Thread* self) {
}
}
if (gAborting == 0) { // Avoid recursive aborts.
- CHECK(!bad_mutexes_held);
+ CHECK(!bad_mutexes_held) << this;
}
}
}
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 969a67bfd1..a9237ef303 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -53,15 +53,15 @@
#include "entrypoints/entrypoint_utils.h"
#include "entrypoints/runtime_asm_entrypoints.h"
#include "experimental_flags.h"
-#include "gc_root-inl.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap-inl.h"
#include "gc/accounting/space_bitmap-inl.h"
-#include "gc/heap.h"
#include "gc/heap-visit-objects-inl.h"
+#include "gc/heap.h"
#include "gc/scoped_gc_critical_section.h"
#include "gc/space/image_space.h"
#include "gc/space/space-inl.h"
+#include "gc_root-inl.h"
#include "handle_scope-inl.h"
#include "image-inl.h"
#include "imt_conflict_table.h"
@@ -76,37 +76,37 @@
#include "leb128.h"
#include "linear_alloc.h"
#include "mirror/call_site.h"
-#include "mirror/class.h"
#include "mirror/class-inl.h"
+#include "mirror/class.h"
#include "mirror/class_ext.h"
#include "mirror/class_loader.h"
-#include "mirror/dex_cache.h"
#include "mirror/dex_cache-inl.h"
+#include "mirror/dex_cache.h"
#include "mirror/emulated_stack_frame.h"
#include "mirror/field.h"
#include "mirror/iftable-inl.h"
#include "mirror/method.h"
-#include "mirror/method_type.h"
#include "mirror/method_handle_impl.h"
#include "mirror/method_handles_lookup.h"
+#include "mirror/method_type.h"
#include "mirror/object-inl.h"
-#include "mirror/object_array-inl.h"
#include "mirror/object-refvisitor-inl.h"
+#include "mirror/object_array-inl.h"
#include "mirror/proxy.h"
#include "mirror/reference-inl.h"
#include "mirror/stack_trace_element.h"
#include "mirror/string-inl.h"
#include "native/dalvik_system_DexFile.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "oat.h"
-#include "oat_file.h"
#include "oat_file-inl.h"
+#include "oat_file.h"
#include "oat_file_assistant.h"
#include "oat_file_manager.h"
#include "object_lock.h"
#include "os.h"
#include "runtime.h"
#include "runtime_callbacks.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-inl.h"
#include "thread_list.h"
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index 90346f0686..eab3b86d3d 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -45,7 +45,7 @@ ClassLoaderContext::ClassLoaderContext()
: special_shared_library_(false),
dex_files_open_attempted_(false),
dex_files_open_result_(false),
- owns_the_dex_files_(false) {}
+ owns_the_dex_files_(true) {}
ClassLoaderContext::ClassLoaderContext(bool owns_the_dex_files)
: special_shared_library_(false),
diff --git a/runtime/common_runtime_test.cc b/runtime/common_runtime_test.cc
index aae997327c..a425224cb5 100644
--- a/runtime/common_runtime_test.cc
+++ b/runtime/common_runtime_test.cc
@@ -20,30 +20,30 @@
#include <dirent.h>
#include <dlfcn.h>
#include <fcntl.h>
-#include <ScopedLocalRef.h>
+#include "nativehelper/ScopedLocalRef.h"
#include <stdlib.h>
#include "../../external/icu/icu4c/source/common/unicode/uvernum.h"
#include "android-base/stringprintf.h"
#include "art_field-inl.h"
-#include "base/macros.h"
#include "base/logging.h"
+#include "base/macros.h"
#include "base/stl_util.h"
#include "base/unix_file/fd_file.h"
#include "class_linker.h"
#include "compiler_callbacks.h"
#include "dex_file-inl.h"
-#include "gc_root-inl.h"
#include "gc/heap.h"
+#include "gc_root-inl.h"
#include "gtest/gtest.h"
#include "handle_scope-inl.h"
#include "interpreter/unstarted_runtime.h"
#include "java_vm_ext.h"
#include "jni_internal.h"
+#include "mem_map.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
-#include "mem_map.h"
#include "native/dalvik_system_DexFile.h"
#include "noop_compiler_callbacks.h"
#include "os.h"
diff --git a/runtime/common_throws.cc b/runtime/common_throws.cc
index 6758d75e47..a46f531d93 100644
--- a/runtime/common_throws.cc
+++ b/runtime/common_throws.cc
@@ -19,7 +19,6 @@
#include <sstream>
#include "android-base/stringprintf.h"
-#include "ScopedLocalRef.h"
#include "art_field-inl.h"
#include "art_method-inl.h"
@@ -32,6 +31,7 @@
#include "mirror/method_type.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "obj_ptr-inl.h"
#include "thread.h"
#include "verifier/method_verifier.h"
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 778b92851b..5a87ae8420 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -30,8 +30,8 @@
#include "base/enums.h"
#include "base/strlcpy.h"
#include "base/time_utils.h"
-#include "class_linker.h"
#include "class_linker-inl.h"
+#include "class_linker.h"
#include "dex_file-inl.h"
#include "dex_file_annotations.h"
#include "dex_instruction.h"
@@ -47,19 +47,19 @@
#include "jdwp/object_registry.h"
#include "jni_internal.h"
#include "jvalue-inl.h"
-#include "mirror/class.h"
#include "mirror/class-inl.h"
+#include "mirror/class.h"
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/string-inl.h"
#include "mirror/throwable.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedPrimitiveArray.h"
#include "obj_ptr-inl.h"
#include "reflection.h"
#include "safe_map.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedPrimitiveArray.h"
#include "stack.h"
#include "thread_list.h"
#include "utf.h"
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index 6ab98273ce..f1685b252c 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -37,6 +37,7 @@
#include "cutils/sched_policy.h"
#include "debugger.h"
#include "dex_file-inl.h"
+#include "entrypoints/quick/quick_alloc_entrypoints.h"
#include "gc/accounting/card_table-inl.h"
#include "gc/accounting/heap_bitmap-inl.h"
#include "gc/accounting/mod_union_table-inl.h"
@@ -61,9 +62,9 @@
#include "gc/space/zygote_space.h"
#include "gc/task_processor.h"
#include "gc/verification.h"
-#include "entrypoints/quick/quick_alloc_entrypoints.h"
#include "gc_pause_listener.h"
#include "gc_root.h"
+#include "handle_scope-inl.h"
#include "heap-inl.h"
#include "heap-visit-objects-inl.h"
#include "image.h"
@@ -71,18 +72,17 @@
#include "java_vm_ext.h"
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
-#include "obj_ptr-inl.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
#include "mirror/object-refvisitor-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/reference-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "obj_ptr-inl.h"
#include "os.h"
#include "reflection.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
-#include "handle_scope-inl.h"
#include "thread_list.h"
#include "verify_object-inl.h"
#include "well_known_classes.h"
diff --git a/runtime/gc/reference_processor.cc b/runtime/gc/reference_processor.cc
index 52da7632f0..42b31ab140 100644
--- a/runtime/gc/reference_processor.cc
+++ b/runtime/gc/reference_processor.cc
@@ -22,10 +22,10 @@
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
#include "mirror/reference-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "object_callbacks.h"
#include "reference_processor-inl.h"
#include "reflection.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "task_processor.h"
#include "utils.h"
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index 85cf73b044..9cb74f7c36 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -27,8 +27,8 @@
#include "jvalue-inl.h"
#include "mirror/string-inl.h"
#include "mterp/mterp.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "stack.h"
#include "thread-inl.h"
#include "unstarted_runtime.h"
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index 152cce4c60..11eb4e0dc1 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -27,7 +27,6 @@
#include <unordered_map>
#include "android-base/stringprintf.h"
-#include "ScopedLocalRef.h"
#include "art_method-inl.h"
#include "base/casts.h"
@@ -48,6 +47,7 @@
#include "mirror/object-inl.h"
#include "mirror/object_array-inl.h"
#include "mirror/string-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "nth_caller_visitor.h"
#include "reflection.h"
#include "thread-inl.h"
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 2ad3b29f17..267f9fdc99 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -34,17 +34,17 @@
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
#include "nativebridge/native_bridge.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "nativeloader/native_loader.h"
#include "object_callbacks.h"
#include "parsed_options.h"
#include "runtime-inl.h"
#include "runtime_options.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "sigchain.h"
-#include "ti/agent.h"
#include "thread-inl.h"
#include "thread_list.h"
+#include "ti/agent.h"
namespace art {
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 8295f464af..7082083b6d 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -90,7 +90,6 @@ static MemMap* SplitMemMap(MemMap* existing_map,
return new_map;
}
-
JitCodeCache* JitCodeCache::Create(size_t initial_capacity,
size_t max_capacity,
bool generate_debug_info,
@@ -101,14 +100,15 @@ JitCodeCache* JitCodeCache::Create(size_t initial_capacity,
// Generating debug information is for using the Linux perf tool on
// host which does not work with ashmem.
- bool use_ashmem = !generate_debug_info;
+ // Also, target linux does not support ashmem.
+ bool use_ashmem = !generate_debug_info && !kIsTargetLinux;
// With 'perf', we want a 1-1 mapping between an address and a method.
bool garbage_collect_code = !generate_debug_info;
// We only use two mappings (separating rw from rx) if we are able to use ashmem.
// See the above comment for debug information and not using ashmem.
- bool use_two_mappings = !generate_debug_info;
+ bool use_two_mappings = use_ashmem;
// We need to have 32 bit offsets from method headers in code cache which point to things
// in the data cache. If the maps are more than 4G apart, having multiple maps wouldn't work.
@@ -802,12 +802,27 @@ uint8_t* JitCodeCache::CommitCodeInternal(Thread* self,
//
// For reference, this behavior is caused by this commit:
// https://android.googlesource.com/kernel/msm/+/3fbe6bc28a6b9939d0650f2f17eb5216c719950c
- FlushInstructionCache(reinterpret_cast<char*>(code_ptr),
- reinterpret_cast<char*>(code_ptr + code_size));
if (writable_ptr != code_ptr) {
+ // When there are two mappings of the JIT code cache, RX and
+ // RW, flush the RW version first as we've just dirtied the
+ // cache lines with new code. Flushing the RX version first
+ // can cause a permission fault as the those addresses are not
+ // writable, but can appear dirty in the cache. There is a lot
+ // of potential subtlety here depending on how the cache is
+ // indexed and tagged.
+ //
+ // Flushing the RX version after the RW version is just
+ // invalidating cachelines in the instruction cache. This is
+ // necessary as the instruction cache will often have a
+ // different set of cache lines present and because the JIT
+ // code cache can start a new function at any boundary within
+ // a cache-line.
FlushDataCache(reinterpret_cast<char*>(writable_ptr),
reinterpret_cast<char*>(writable_ptr + code_size));
}
+ FlushInstructionCache(reinterpret_cast<char*>(code_ptr),
+ reinterpret_cast<char*>(code_ptr + code_size));
+
DCHECK(!Runtime::Current()->IsAotCompiler());
if (has_should_deoptimize_flag) {
writable_method_header->SetHasShouldDeoptimizeFlag();
diff --git a/runtime/jni_internal.cc b/runtime/jni_internal.cc
index dbad614416..40b40d7a7a 100644
--- a/runtime/jni_internal.cc
+++ b/runtime/jni_internal.cc
@@ -34,12 +34,12 @@
#include "class_linker-inl.h"
#include "dex_file-inl.h"
#include "fault_handler.h"
-#include "gc_root.h"
#include "gc/accounting/card_table-inl.h"
+#include "gc_root.h"
#include "indirect_reference_table-inl.h"
#include "interpreter/interpreter.h"
-#include "jni_env_ext.h"
#include "java_vm_ext.h"
+#include "jni_env_ext.h"
#include "jvalue-inl.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
@@ -49,12 +49,12 @@
#include "mirror/object_array-inl.h"
#include "mirror/string-inl.h"
#include "mirror/throwable.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "parsed_options.h"
#include "reflection.h"
#include "runtime.h"
#include "safe_map.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "thread.h"
#include "utf.h"
#include "well_known_classes.h"
diff --git a/runtime/jni_internal_test.cc b/runtime/jni_internal_test.cc
index e1e4f9c7d6..728b7c7708 100644
--- a/runtime/jni_internal_test.cc
+++ b/runtime/jni_internal_test.cc
@@ -24,8 +24,8 @@
#include "java_vm_ext.h"
#include "jni_env_ext.h"
#include "mirror/string-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
namespace art {
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index ad009668bf..f6a836079e 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -19,7 +19,6 @@
#include <sstream>
#include "android-base/stringprintf.h"
-#include "nativehelper/jni_macros.h"
#include "base/logging.h"
#include "base/stl_util.h"
@@ -32,14 +31,15 @@
#include "mirror/object-inl.h"
#include "mirror/string.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "oat_file.h"
#include "oat_file_assistant.h"
#include "oat_file_manager.h"
#include "os.h"
#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
#include "utils.h"
#include "well_known_classes.h"
#include "zip_archive.h"
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
index e1eae21df9..3357fa7a45 100644
--- a/runtime/native/dalvik_system_VMDebug.cc
+++ b/runtime/native/dalvik_system_VMDebug.cc
@@ -40,8 +40,8 @@
#include "mirror/class.h"
#include "mirror/object_array-inl.h"
#include "native_util.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "scoped_fast_native_object_access-inl.h"
#include "trace.h"
#include "well_known_classes.h"
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index fed9c1cf5b..4f5ec8c2ae 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -22,15 +22,14 @@
extern "C" void android_set_application_target_sdk_version(uint32_t version);
#endif
#include <limits.h>
-#include <ScopedUtfChars.h>
+#include "nativehelper/ScopedUtfChars.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
-#include "toStringArray.h"
+#include "nativehelper/toStringArray.h"
#pragma GCC diagnostic pop
#include "android-base/stringprintf.h"
-#include "nativehelper/jni_macros.h"
#include "art_method-inl.h"
#include "arch/instruction_set.h"
@@ -53,6 +52,7 @@ extern "C" void android_set_application_target_sdk_version(uint32_t version);
#include "mirror/dex_cache-inl.h"
#include "mirror/object-inl.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
#include "runtime.h"
#include "scoped_fast_native_object_access-inl.h"
#include "scoped_thread_state_change-inl.h"
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
index 31aeba06f9..2e4db7a7fa 100644
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
@@ -19,7 +19,6 @@
#include <stdlib.h>
#include "android-base/stringprintf.h"
-#include "nativehelper/jni_macros.h"
#include "arch/instruction_set.h"
#include "art_method-inl.h"
@@ -27,11 +26,12 @@
#include "java_vm_ext.h"
#include "jit/jit.h"
#include "jni_internal.h"
-#include "JNIHelp.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/JNIHelp.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "non_debuggable_classes.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedUtfChars.h"
#include "stack.h"
#include "thread-current-inl.h"
#include "thread_list.h"
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
index d3377be393..1a19940993 100644
--- a/runtime/native/java_lang_Class.cc
+++ b/runtime/native/java_lang_Class.cc
@@ -18,8 +18,6 @@
#include <iostream>
-#include "nativehelper/jni_macros.h"
-
#include "art_field-inl.h"
#include "art_method-inl.h"
#include "base/enums.h"
@@ -28,7 +26,6 @@
#include "dex_file-inl.h"
#include "dex_file_annotations.h"
#include "jni_internal.h"
-#include "nth_caller_visitor.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
#include "mirror/field-inl.h"
@@ -37,12 +34,14 @@
#include "mirror/object_array-inl.h"
#include "mirror/string-inl.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
+#include "nth_caller_visitor.h"
#include "obj_ptr-inl.h"
#include "reflection.h"
-#include "scoped_thread_state_change-inl.h"
#include "scoped_fast_native_object_access-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
+#include "scoped_thread_state_change-inl.h"
#include "utf.h"
#include "well_known_classes.h"
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
index ac0d6337b2..e2de141808 100644
--- a/runtime/native/java_lang_String.cc
+++ b/runtime/native/java_lang_String.cc
@@ -22,12 +22,12 @@
#include "jni_internal.h"
#include "mirror/array.h"
#include "mirror/object-inl.h"
-#include "mirror/string.h"
#include "mirror/string-inl.h"
+#include "mirror/string.h"
#include "native_util.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "scoped_fast_native_object_access-inl.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "verify_object.h"
namespace art {
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
index 9c2e91843e..2db9a5cc22 100644
--- a/runtime/native/java_lang_StringFactory.cc
+++ b/runtime/native/java_lang_StringFactory.cc
@@ -16,17 +16,16 @@
#include "java_lang_StringFactory.h"
-#include "nativehelper/jni_macros.h"
-
#include "common_throws.h"
#include "jni_internal.h"
#include "mirror/object-inl.h"
#include "mirror/string.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedPrimitiveArray.h"
#include "scoped_fast_native_object_access-inl.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedPrimitiveArray.h"
namespace art {
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 4ce72edd7b..4fbbb72631 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -16,16 +16,15 @@
#include "java_lang_Thread.h"
-#include "nativehelper/jni_macros.h"
-
#include "common_throws.h"
#include "jni_internal.h"
-#include "monitor.h"
#include "mirror/object.h"
+#include "monitor.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "scoped_fast_native_object_access-inl.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedUtfChars.h"
#include "thread.h"
#include "thread_list.h"
#include "verify_object.h"
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
index 57c313e933..4034e8c837 100644
--- a/runtime/native/java_lang_VMClassLoader.cc
+++ b/runtime/native/java_lang_VMClassLoader.cc
@@ -16,17 +16,16 @@
#include "java_lang_VMClassLoader.h"
-#include "nativehelper/jni_macros.h"
-
#include "class_linker.h"
#include "jni_internal.h"
#include "mirror/class_loader.h"
#include "mirror/object-inl.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "obj_ptr.h"
#include "scoped_fast_native_object_access-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
#include "well_known_classes.h"
#include "zip_archive.h"
diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc
index 38634e6d0c..c6985482b6 100644
--- a/runtime/native/libcore_util_CharsetUtils.cc
+++ b/runtime/native/libcore_util_CharsetUtils.cc
@@ -18,14 +18,13 @@
#include <string.h>
-#include "nativehelper/jni_macros.h"
-
#include "jni_internal.h"
-#include "mirror/string.h"
#include "mirror/string-inl.h"
+#include "mirror/string.h"
#include "native_util.h"
+#include "nativehelper/ScopedPrimitiveArray.h"
+#include "nativehelper/jni_macros.h"
#include "scoped_fast_native_object_access-inl.h"
-#include "ScopedPrimitiveArray.h"
#include "unicode/utf16.h"
diff --git a/runtime/native/native_util.h b/runtime/native/native_util.h
index 98384e0178..593b3ca444 100644
--- a/runtime/native/native_util.h
+++ b/runtime/native/native_util.h
@@ -21,7 +21,7 @@
#include "android-base/logging.h"
#include "base/macros.h"
-#include "ScopedLocalRef.h"
+#include "nativehelper/ScopedLocalRef.h"
namespace art {
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
index 925b90931c..c3e74bd112 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
@@ -16,14 +16,13 @@
#include "org_apache_harmony_dalvik_ddmc_DdmServer.h"
-#include "nativehelper/jni_macros.h"
-
#include "base/logging.h"
#include "debugger.h"
#include "jni_internal.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedPrimitiveArray.h"
#include "scoped_fast_native_object_access-inl.h"
-#include "ScopedPrimitiveArray.h"
namespace art {
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
index 125d737958..8c42973509 100644
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
@@ -16,17 +16,16 @@
#include "org_apache_harmony_dalvik_ddmc_DdmVmInternal.h"
-#include "nativehelper/jni_macros.h"
-
#include "base/logging.h"
#include "base/mutex.h"
#include "debugger.h"
#include "gc/heap.h"
#include "jni_internal.h"
#include "native_util.h"
+#include "nativehelper/jni_macros.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedPrimitiveArray.h"
#include "scoped_fast_native_object_access-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedPrimitiveArray.h"
#include "thread_list.h"
namespace art {
diff --git a/runtime/non_debuggable_classes.cc b/runtime/non_debuggable_classes.cc
index 9cc7e60fa8..871ffba2a4 100644
--- a/runtime/non_debuggable_classes.cc
+++ b/runtime/non_debuggable_classes.cc
@@ -19,8 +19,8 @@
#include "base/logging.h"
#include "jni_internal.h"
#include "mirror/class-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "obj_ptr-inl.h"
-#include "ScopedLocalRef.h"
#include "thread-current-inl.h"
namespace art {
diff --git a/runtime/openjdkjvm/OpenjdkJvm.cc b/runtime/openjdkjvm/OpenjdkJvm.cc
index 6a8f2cedca..c1b2636f70 100644
--- a/runtime/openjdkjvm/OpenjdkJvm.cc
+++ b/runtime/openjdkjvm/OpenjdkJvm.cc
@@ -53,12 +53,12 @@
#include "mirror/string-inl.h"
#include "monitor.h"
#include "native/scoped_fast_native_object_access-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "runtime.h"
+#include "scoped_thread_state_change-inl.h"
#include "thread.h"
#include "thread_list.h"
-#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
#include "verify_object.h"
#undef LOG_TAG
diff --git a/runtime/openjdkjvmti/events-inl.h b/runtime/openjdkjvmti/events-inl.h
index f30d7cecb3..43177ab845 100644
--- a/runtime/openjdkjvmti/events-inl.h
+++ b/runtime/openjdkjvmti/events-inl.h
@@ -21,7 +21,7 @@
#include "events.h"
#include "jni_internal.h"
-#include "ScopedLocalRef.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "ti_breakpoint.h"
#include "art_jvmti.h"
diff --git a/runtime/openjdkjvmti/events.cc b/runtime/openjdkjvmti/events.cc
index f749daa918..7a930d4163 100644
--- a/runtime/openjdkjvmti/events.cc
+++ b/runtime/openjdkjvmti/events.cc
@@ -31,9 +31,9 @@
#include "events-inl.h"
+#include "art_field-inl.h"
#include "art_jvmti.h"
#include "art_method-inl.h"
-#include "art_field-inl.h"
#include "base/logging.h"
#include "gc/allocation_listener.h"
#include "gc/gc_pause_listener.h"
@@ -45,8 +45,8 @@
#include "jni_internal.h"
#include "mirror/class.h"
#include "mirror/object-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-inl.h"
#include "thread_list.h"
diff --git a/runtime/openjdkjvmti/jvmti_weak_table-inl.h b/runtime/openjdkjvmti/jvmti_weak_table-inl.h
index 64ab3e7b2e..a640acbe98 100644
--- a/runtime/openjdkjvmti/jvmti_weak_table-inl.h
+++ b/runtime/openjdkjvmti/jvmti_weak_table-inl.h
@@ -44,8 +44,8 @@
#include "jvmti_allocator.h"
#include "mirror/class.h"
#include "mirror/object.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
namespace openjdkjvmti {
diff --git a/runtime/openjdkjvmti/ti_breakpoint.cc b/runtime/openjdkjvmti/ti_breakpoint.cc
index 6d0e2c60c1..f5116a8080 100644
--- a/runtime/openjdkjvmti/ti_breakpoint.cc
+++ b/runtime/openjdkjvmti/ti_breakpoint.cc
@@ -42,9 +42,9 @@
#include "mirror/class-inl.h"
#include "mirror/object_array-inl.h"
#include "modifiers.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "runtime_callbacks.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "thread-current-inl.h"
#include "thread_list.h"
#include "ti_phase.h"
diff --git a/runtime/openjdkjvmti/ti_class.cc b/runtime/openjdkjvmti/ti_class.cc
index 99dfcfe665..954b5d1d03 100644
--- a/runtime/openjdkjvmti/ti_class.cc
+++ b/runtime/openjdkjvmti/ti_class.cc
@@ -39,14 +39,14 @@
#include "art_jvmti.h"
#include "base/array_ref.h"
#include "base/macros.h"
-#include "class_table-inl.h"
#include "class_linker.h"
+#include "class_table-inl.h"
#include "common_throws.h"
#include "dex_file_annotations.h"
#include "events-inl.h"
#include "fixed_up_dex_file.h"
-#include "gc/heap.h"
#include "gc/heap-visit-objects-inl.h"
+#include "gc/heap.h"
#include "gc_root.h"
#include "handle.h"
#include "jni_env_ext-inl.h"
@@ -54,16 +54,16 @@
#include "mirror/array-inl.h"
#include "mirror/class-inl.h"
#include "mirror/class_ext.h"
-#include "mirror/object_array-inl.h"
-#include "mirror/object_reference.h"
#include "mirror/object-inl.h"
#include "mirror/object-refvisitor-inl.h"
+#include "mirror/object_array-inl.h"
+#include "mirror/object_reference.h"
#include "mirror/reference.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "primitive.h"
#include "reflection.h"
#include "runtime.h"
#include "runtime_callbacks.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
#include "thread_list.h"
diff --git a/runtime/openjdkjvmti/ti_class_loader.cc b/runtime/openjdkjvmti/ti_class_loader.cc
index 205046c894..e81e4bc803 100644
--- a/runtime/openjdkjvmti/ti_class_loader.cc
+++ b/runtime/openjdkjvmti/ti_class_loader.cc
@@ -51,9 +51,9 @@
#include "mirror/class.h"
#include "mirror/class_ext.h"
#include "mirror/object.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "object_lock.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
#include "transform.h"
namespace openjdkjvmti {
diff --git a/runtime/openjdkjvmti/ti_method.cc b/runtime/openjdkjvmti/ti_method.cc
index 9b5b964a4d..ab434d7d9a 100644
--- a/runtime/openjdkjvmti/ti_method.cc
+++ b/runtime/openjdkjvmti/ti_method.cc
@@ -39,9 +39,9 @@
#include "jni_internal.h"
#include "mirror/object_array-inl.h"
#include "modifiers.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "runtime_callbacks.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "thread-current-inl.h"
#include "thread_list.h"
#include "ti_phase.h"
diff --git a/runtime/openjdkjvmti/ti_phase.cc b/runtime/openjdkjvmti/ti_phase.cc
index 3c8bdc61d0..8893c9b4aa 100644
--- a/runtime/openjdkjvmti/ti_phase.cc
+++ b/runtime/openjdkjvmti/ti_phase.cc
@@ -34,9 +34,9 @@
#include "art_jvmti.h"
#include "base/macros.h"
#include "events-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "runtime.h"
#include "runtime_callbacks.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
#include "thread_list.h"
diff --git a/runtime/openjdkjvmti/ti_properties.cc b/runtime/openjdkjvmti/ti_properties.cc
index e399b484ec..c412814d8d 100644
--- a/runtime/openjdkjvmti/ti_properties.cc
+++ b/runtime/openjdkjvmti/ti_properties.cc
@@ -35,8 +35,8 @@
#include <vector>
#include "jni.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "art_jvmti.h"
#include "runtime.h"
diff --git a/runtime/openjdkjvmti/ti_redefine.cc b/runtime/openjdkjvmti/ti_redefine.cc
index debee913ee..e68a6575d5 100644
--- a/runtime/openjdkjvmti/ti_redefine.cc
+++ b/runtime/openjdkjvmti/ti_redefine.cc
@@ -36,8 +36,8 @@
#include "android-base/stringprintf.h"
#include "art_field-inl.h"
-#include "art_method-inl.h"
#include "art_jvmti.h"
+#include "art_method-inl.h"
#include "base/array_ref.h"
#include "base/logging.h"
#include "class_linker-inl.h"
@@ -60,10 +60,10 @@
#include "mirror/class-inl.h"
#include "mirror/class_ext.h"
#include "mirror/object.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "non_debuggable_classes.h"
#include "object_lock.h"
#include "runtime.h"
-#include "ScopedLocalRef.h"
#include "ti_breakpoint.h"
#include "ti_class_loader.h"
#include "transform.h"
diff --git a/runtime/openjdkjvmti/ti_search.cc b/runtime/openjdkjvmti/ti_search.cc
index 6e0196edc3..50a01fcd55 100644
--- a/runtime/openjdkjvmti/ti_search.cc
+++ b/runtime/openjdkjvmti/ti_search.cc
@@ -43,14 +43,14 @@
#include "mirror/class-inl.h"
#include "mirror/object.h"
#include "mirror/string.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "obj_ptr-inl.h"
#include "runtime.h"
#include "runtime_callbacks.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "ti_phase.h"
#include "thread-current-inl.h"
#include "thread_list.h"
+#include "ti_phase.h"
#include "well_known_classes.h"
namespace openjdkjvmti {
diff --git a/runtime/openjdkjvmti/ti_stack.cc b/runtime/openjdkjvmti/ti_stack.cc
index edb6ffe241..ff2de8dac6 100644
--- a/runtime/openjdkjvmti/ti_stack.cc
+++ b/runtime/openjdkjvmti/ti_stack.cc
@@ -37,8 +37,8 @@
#include <vector>
#include "art_field-inl.h"
-#include "art_method-inl.h"
#include "art_jvmti.h"
+#include "art_method-inl.h"
#include "barrier.h"
#include "base/bit_utils.h"
#include "base/enums.h"
@@ -50,8 +50,8 @@
#include "jni_internal.h"
#include "mirror/class.h"
#include "mirror/dex_cache.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "stack.h"
#include "thread-current-inl.h"
#include "thread_list.h"
diff --git a/runtime/openjdkjvmti/ti_thread.cc b/runtime/openjdkjvmti/ti_thread.cc
index fe0e3bbf44..f16b419ab7 100644
--- a/runtime/openjdkjvmti/ti_thread.cc
+++ b/runtime/openjdkjvmti/ti_thread.cc
@@ -43,14 +43,14 @@
#include "mirror/class.h"
#include "mirror/object-inl.h"
#include "mirror/string.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "obj_ptr.h"
-#include "ti_phase.h"
#include "runtime.h"
#include "runtime_callbacks.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
#include "thread_list.h"
+#include "ti_phase.h"
#include "well_known_classes.h"
namespace openjdkjvmti {
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index 532da2b16e..6f1d15c767 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -28,10 +28,10 @@
#include "mirror/class-inl.h"
#include "mirror/executable.h"
#include "mirror/object_array-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "nth_caller_visitor.h"
#include "scoped_thread_state_change-inl.h"
#include "stack_reference.h"
-#include "ScopedLocalRef.h"
#include "well_known_classes.h"
namespace art {
diff --git a/runtime/reflection_test.cc b/runtime/reflection_test.cc
index 1ba4b7b9d1..5eb75ed8b0 100644
--- a/runtime/reflection_test.cc
+++ b/runtime/reflection_test.cc
@@ -18,13 +18,13 @@
#include <float.h>
#include <limits.h>
-#include "ScopedLocalRef.h"
#include "art_method-inl.h"
#include "base/enums.h"
#include "common_compiler_test.h"
#include "java_vm_ext.h"
#include "jni_internal.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
namespace art {
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index bf9e4051ae..adad7033f9 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -39,8 +39,6 @@
#include "android-base/strings.h"
-#include "JniConstants.h"
-#include "ScopedLocalRef.h"
#include "arch/arm/quick_method_frame_info_arm.h"
#include "arch/arm/registers_arm.h"
#include "arch/arm64/quick_method_frame_info_arm64.h"
@@ -87,6 +85,7 @@
#include "java_vm_ext.h"
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
+#include "jit/profile_saver.h"
#include "jni_internal.h"
#include "linear_alloc.h"
#include "mirror/array.h"
@@ -133,17 +132,17 @@
#include "native/sun_misc_Unsafe.h"
#include "native_bridge_art_interface.h"
#include "native_stack_dump.h"
+#include "nativehelper/JniConstants.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "oat_file.h"
#include "oat_file_manager.h"
#include "object_callbacks.h"
#include "os.h"
#include "parsed_options.h"
-#include "jit/profile_saver.h"
#include "quick/quick_method_frame_info.h"
#include "reflection.h"
#include "runtime_callbacks.h"
#include "runtime_options.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "sigchain.h"
#include "signal_catcher.h"
diff --git a/runtime/runtime_callbacks_test.cc b/runtime/runtime_callbacks_test.cc
index 640f9ce848..0ea3180143 100644
--- a/runtime/runtime_callbacks_test.cc
+++ b/runtime/runtime_callbacks_test.cc
@@ -34,10 +34,10 @@
#include "mem_map.h"
#include "mirror/class-inl.h"
#include "mirror/class_loader.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "obj_ptr.h"
#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "thread-inl.h"
#include "thread_list.h"
#include "well_known_classes.h"
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 004b68e204..9d4f116182 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -34,16 +34,16 @@
#include "android-base/stringprintf.h"
-#include "arch/context.h"
#include "arch/context-inl.h"
+#include "arch/context.h"
#include "art_field-inl.h"
#include "art_method-inl.h"
#include "base/bit_utils.h"
#include "base/memory_tool.h"
#include "base/mutex.h"
+#include "base/systrace.h"
#include "base/timing_logger.h"
#include "base/to_str.h"
-#include "base/systrace.h"
#include "class_linker-inl.h"
#include "debugger.h"
#include "dex_file-inl.h"
@@ -58,38 +58,38 @@
#include "gc_root.h"
#include "handle_scope-inl.h"
#include "indirect_reference_table-inl.h"
+#include "interpreter/interpreter.h"
#include "interpreter/shadow_frame.h"
#include "java_frame_root_info.h"
#include "java_vm_ext.h"
#include "jni_internal.h"
-#include "mirror/class_loader.h"
#include "mirror/class-inl.h"
+#include "mirror/class_loader.h"
#include "mirror/object_array-inl.h"
#include "mirror/stack_trace_element.h"
#include "monitor.h"
#include "native_stack_dump.h"
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "nth_caller_visitor.h"
#include "oat_quick_method_header.h"
#include "obj_ptr-inl.h"
#include "object_lock.h"
-#include "quick_exception_handler.h"
#include "quick/quick_method_frame_info.h"
+#include "quick_exception_handler.h"
#include "read_barrier-inl.h"
#include "reflection.h"
#include "runtime.h"
#include "runtime_callbacks.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
-#include "ScopedUtfChars.h"
#include "stack.h"
#include "stack_map.h"
-#include "thread_list.h"
#include "thread-inl.h"
+#include "thread_list.h"
#include "utils.h"
#include "verifier/method_verifier.h"
#include "verify_object.h"
#include "well_known_classes.h"
-#include "interpreter/interpreter.h"
#if ART_USE_FUTEXES
#include "linux/futex.h"
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc
index 9c938ffe18..f1a7b65c7c 100644
--- a/runtime/thread_list.cc
+++ b/runtime/thread_list.cc
@@ -18,8 +18,8 @@
#include <backtrace/BacktraceMap.h>
#include <dirent.h>
-#include <ScopedLocalRef.h>
-#include <ScopedUtfChars.h>
+#include "nativehelper/ScopedLocalRef.h"
+#include "nativehelper/ScopedUtfChars.h"
#include <sys/types.h>
#include <unistd.h>
diff --git a/runtime/trace.cc b/runtime/trace.cc
index cabd1620a7..36532c6d52 100644
--- a/runtime/trace.cc
+++ b/runtime/trace.cc
@@ -32,20 +32,20 @@
#include "common_throws.h"
#include "debugger.h"
#include "dex_file-inl.h"
+#include "entrypoints/quick/quick_entrypoints.h"
#include "gc/scoped_gc_critical_section.h"
#include "instrumentation.h"
#include "mirror/class-inl.h"
#include "mirror/dex_cache-inl.h"
-#include "mirror/object_array-inl.h"
#include "mirror/object-inl.h"
+#include "mirror/object_array-inl.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "os.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedLocalRef.h"
#include "stack.h"
#include "thread.h"
#include "thread_list.h"
#include "utils.h"
-#include "entrypoints/quick/quick_entrypoints.h"
namespace art {
diff --git a/runtime/well_known_classes.cc b/runtime/well_known_classes.cc
index f72fdb4b2a..1c14cf2150 100644
--- a/runtime/well_known_classes.cc
+++ b/runtime/well_known_classes.cc
@@ -27,8 +27,8 @@
#include "jni_internal.h"
#include "mirror/class.h"
#include "mirror/throwable.h"
+#include "nativehelper/ScopedLocalRef.h"
#include "obj_ptr-inl.h"
-#include "ScopedLocalRef.h"
#include "scoped_thread_state_change-inl.h"
#include "thread-current-inl.h"
diff --git a/test/570-checker-osr/osr.cc b/test/570-checker-osr/osr.cc
index 45ead6b204..faec3c3534 100644
--- a/test/570-checker-osr/osr.cc
+++ b/test/570-checker-osr/osr.cc
@@ -18,9 +18,9 @@
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
#include "jit/profiling_info.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "oat_quick_method_header.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedUtfChars.h"
#include "stack.h"
#include "stack_map.h"
diff --git a/test/595-profile-saving/profile-saving.cc b/test/595-profile-saving/profile-saving.cc
index ae3dad80d0..06e3fb48fc 100644
--- a/test/595-profile-saving/profile-saving.cc
+++ b/test/595-profile-saving/profile-saving.cc
@@ -23,10 +23,10 @@
#include "method_reference.h"
#include "mirror/class-inl.h"
#include "mirror/executable.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "oat_file_assistant.h"
#include "oat_file_manager.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedUtfChars.h"
#include "thread.h"
namespace art {
diff --git a/test/647-jni-get-field-id/get_field_id.cc b/test/647-jni-get-field-id/get_field_id.cc
index 2056cfb549..139e4b6d8b 100644
--- a/test/647-jni-get-field-id/get_field_id.cc
+++ b/test/647-jni-get-field-id/get_field_id.cc
@@ -16,7 +16,7 @@
#include "jni.h"
-#include "ScopedUtfChars.h"
+#include "nativehelper/ScopedUtfChars.h"
namespace art {
diff --git a/test/common/runtime_state.cc b/test/common/runtime_state.cc
index d8e5b571bd..7c0ed691b6 100644
--- a/test/common/runtime_state.cc
+++ b/test/common/runtime_state.cc
@@ -25,10 +25,10 @@
#include "jit/jit_code_cache.h"
#include "jit/profiling_info.h"
#include "mirror/class-inl.h"
+#include "nativehelper/ScopedUtfChars.h"
#include "oat_quick_method_header.h"
#include "runtime.h"
#include "scoped_thread_state_change-inl.h"
-#include "ScopedUtfChars.h"
#include "thread-current-inl.h"
namespace art {
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py
index 2c64b566b8..68e1856adb 100755
--- a/test/testrunner/testrunner.py
+++ b/test/testrunner/testrunner.py
@@ -50,7 +50,6 @@ import itertools
import json
import multiprocessing
import os
-import operator
import re
import subprocess
import sys
@@ -76,11 +75,9 @@ ADDRESS_SIZES = set()
OPTIMIZING_COMPILER_TYPES = set()
JVMTI_TYPES = set()
ADDRESS_SIZES_TARGET = {'host': set(), 'target': set()}
-TIME_STATS = {}
# timeout for individual tests.
# TODO: make it adjustable per tests and for buildbots
timeout = 3000 # 50 minutes
-global_timeout = 14100 # 235 minutes (The go/ab timeout is 14500)
# DISABLED_TEST_CONTAINER holds information about the disabled tests. It is a map
# that has key as the test name (like 001-HelloWorld), and value as set of
@@ -358,7 +355,7 @@ def run_tests(tests):
# stops creating any any thread and wait for all the exising threads
# to end.
while threading.active_count() > 2:
- time.sleep(1)
+ time.sleep(0.1)
return
test_name = 'test-art-'
test_name += target + '-run-test-'
@@ -509,13 +506,11 @@ def run_test(command, test, test_variant, test_name):
test_skipped = True
else:
test_skipped = False
- start_recording_time(test_name)
if gdb:
proc = subprocess.Popen(command.split(), stderr=subprocess.STDOUT, universal_newlines=True)
else:
proc = subprocess.Popen(command.split(), stderr=subprocess.STDOUT, stdout = subprocess.PIPE,
universal_newlines=True)
- stop_recording_time(test_name)
script_output = proc.communicate(timeout=timeout)[0]
test_passed = not proc.wait()
@@ -734,7 +729,6 @@ def print_text(output):
sys.stdout.flush()
def print_analysis():
- print_mutex.acquire()
if not verbose:
# Without --verbose, the testrunner erases passing test info. It
# does that by overriding the printed text with white spaces all across
@@ -768,7 +762,6 @@ def print_analysis():
print_text(COLOR_ERROR + '----------' + COLOR_NORMAL + '\n')
for failed_test in sorted([test_info[0] for test_info in failed_tests]):
print_text(('%s\n' % (failed_test)))
- print_mutex.release()
def parse_test_name(test_name):
@@ -997,33 +990,7 @@ def parse_option():
return test
-def start_recording_time(key):
- """To begin recording time for the event associated with the key.
- """
- TIME_STATS[key] = -(time.time())
-
-def stop_recording_time(key):
- """To stop timer for the event associated with the key.
- """
- TIME_STATS[key] = time.time() + TIME_STATS[key]
-
-def print_time_info():
- """Print time information for different invocation.
- """
- print_mutex.acquire()
- print_text('\nTIME INFO\n')
- for key in TIME_STATS:
- # Handle unfinised jobs.
- if TIME_STATS[key] < 0:
- TIME_STATS[key] = time.time() + TIME_STATS[key]
-
- info_list = sorted(TIME_STATS.items(), key=operator.itemgetter(1), reverse=True)
- for time_info_tuple in info_list:
- print_text('%s : %.2f sec\n' % (time_info_tuple[0], time_info_tuple[1]))
- print_mutex.release()
-
def main():
- start_time = time.time()
gather_test_info()
user_requested_test = parse_option()
setup_test_env()
@@ -1039,10 +1006,8 @@ def main():
build_command += ' ' + build_targets
# Add 'dist' to avoid Jack issues b/36169180.
build_command += ' dist'
- start_recording_time(build_command)
if subprocess.call(build_command.split()):
sys.exit(1)
- stop_recording_time(build_command)
if user_requested_test:
test_runner_thread = threading.Thread(target=run_tests, args=(user_requested_test,))
else:
@@ -1051,13 +1016,6 @@ def main():
try:
test_runner_thread.start()
while threading.active_count() > 1:
- if (time.time() - start_time > global_timeout):
- # to ensure that the run ends before the go/ab bots
- # time out the invocation.
- print_text("FAILED: timeout reached")
- print_time_info()
- print_analysis()
- sys.exit(1)
time.sleep(0.1)
print_analysis()
except Exception as e: