From c785344b87221f5e4e6473e5b762e4e61fe65dcf Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Fri, 27 Mar 2015 14:35:38 -0700 Subject: Move ArtField to native Add linear alloc. Moved ArtField to be native object. Changed image writer to put ArtFields after the mirror section. Savings: 2MB on low ram devices 4MB on normal devices Total PSS measurements before (normal N5, 95s after shell start): Image size: 7729152 bytes 23112 kB: .NonMoving 23212 kB: .NonMoving 22868 kB: .NonMoving 23072 kB: .NonMoving 22836 kB: .NonMoving 19618 kB: .Zygote 19850 kB: .Zygote 19623 kB: .Zygote 19924 kB: .Zygote 19612 kB: .Zygote Avg: 42745.4 kB After: Image size: 7462912 bytes 17440 kB: .NonMoving 16776 kB: .NonMoving 16804 kB: .NonMoving 17812 kB: .NonMoving 16820 kB: .NonMoving 18788 kB: .Zygote 18856 kB: .Zygote 19064 kB: .Zygote 18841 kB: .Zygote 18629 kB: .Zygote 3499 kB: .LinearAlloc 3408 kB: .LinearAlloc 3424 kB: .LinearAlloc 3600 kB: .LinearAlloc 3436 kB: .LinearAlloc Avg: 39439.4 kB No reflection performance changes. Bug: 19264997 Bug: 17643507 Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c --- runtime/thread.cc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'runtime/thread.cc') diff --git a/runtime/thread.cc b/runtime/thread.cc index af11f73..58b272b 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -32,11 +32,11 @@ #include #include "arch/context.h" +#include "art_field-inl.h" #include "base/mutex.h" #include "base/timing_logger.h" #include "base/to_str.h" #include "class_linker-inl.h" -#include "class_linker.h" #include "debugger.h" #include "dex_file-inl.h" #include "entrypoints/entrypoint_utils.h" @@ -47,10 +47,8 @@ #include "gc/heap.h" #include "gc/space/space.h" #include "handle_scope-inl.h" -#include "handle_scope.h" #include "indirect_reference_table-inl.h" #include "jni_internal.h" -#include "mirror/art_field-inl.h" #include "mirror/art_method-inl.h" #include "mirror/class_loader.h" #include "mirror/class-inl.h" @@ -173,7 +171,7 @@ void* Thread::CreateCallback(void* arg) { self->tlsPtr_.jpeer = nullptr; self->SetThreadName(self->GetThreadName(soa)->ToModifiedUtf8().c_str()); - mirror::ArtField* priorityField = soa.DecodeField(WellKnownClasses::java_lang_Thread_priority); + ArtField* priorityField = soa.DecodeField(WellKnownClasses::java_lang_Thread_priority); self->SetNativePriority(priorityField->GetInt(self->tlsPtr_.opeer)); Dbg::PostThreadStart(self); @@ -190,7 +188,7 @@ void* Thread::CreateCallback(void* arg) { Thread* Thread::FromManagedThread(const ScopedObjectAccessAlreadyRunnable& soa, mirror::Object* thread_peer) { - mirror::ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_nativePeer); + ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_nativePeer); Thread* result = reinterpret_cast(static_cast(f->GetLong(thread_peer))); // Sanity check that if we have a result it is either suspended or we hold the thread_list_lock_ // to stop it from going away. @@ -589,7 +587,7 @@ void Thread::Dump(std::ostream& os) const { } mirror::String* Thread::GetThreadName(const ScopedObjectAccessAlreadyRunnable& soa) const { - mirror::ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_name); + ArtField* f = soa.DecodeField(WellKnownClasses::java_lang_Thread_name); return (tlsPtr_.opeer != nullptr) ? reinterpret_cast(f->GetObject(tlsPtr_.opeer)) : nullptr; } @@ -794,7 +792,7 @@ void Thread::DumpState(std::ostream& os, const Thread* thread, pid_t tid) { soa.DecodeField(WellKnownClasses::java_lang_Thread_group)->GetObject(thread->tlsPtr_.opeer); if (thread_group != nullptr) { - mirror::ArtField* group_name_field = + ArtField* group_name_field = soa.DecodeField(WellKnownClasses::java_lang_ThreadGroup_name); mirror::String* group_name_string = reinterpret_cast(group_name_field->GetObject(thread_group)); -- cgit v1.1