diff options
author | Mathieu Chartier <mathieuc@google.com> | 2015-03-27 14:35:38 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2015-04-10 12:57:27 -0700 |
commit | c785344b87221f5e4e6473e5b762e4e61fe65dcf (patch) | |
tree | cd32ad2c2604596a18926f04d4c313dab255ecfd /runtime/thread.cc | |
parent | a29d93b380c9aeb8270e281aefbdd0c77a430d43 (diff) | |
download | art-c785344b87221f5e4e6473e5b762e4e61fe65dcf.zip art-c785344b87221f5e4e6473e5b762e4e61fe65dcf.tar.gz art-c785344b87221f5e4e6473e5b762e4e61fe65dcf.tar.bz2 |
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
Diffstat (limited to 'runtime/thread.cc')
-rw-r--r-- | runtime/thread.cc | 12 |
1 files changed, 5 insertions, 7 deletions
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 <sstream> #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<Thread*>(static_cast<uintptr_t>(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<mirror::String*>(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<mirror::String*>(group_name_field->GetObject(thread_group)); |