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 --- compiler/optimizing/builder.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'compiler/optimizing/builder.cc') diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index a912d4ccc4..8a64d81485 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -16,16 +16,13 @@ #include "builder.h" +#include "art_field-inl.h" #include "base/logging.h" #include "class_linker.h" -#include "dex_file.h" #include "dex_file-inl.h" -#include "dex_instruction.h" #include "dex_instruction-inl.h" #include "driver/compiler_driver-inl.h" #include "driver/compiler_options.h" -#include "mirror/art_field.h" -#include "mirror/art_field-inl.h" #include "mirror/class_loader.h" #include "mirror/dex_cache.h" #include "nodes.h" @@ -656,11 +653,10 @@ bool HGraphBuilder::BuildInstanceFieldAccess(const Instruction& instruction, uint16_t field_index = instruction.VRegC_22c(); ScopedObjectAccess soa(Thread::Current()); - StackHandleScope<1> hs(soa.Self()); - Handle resolved_field(hs.NewHandle( - compiler_driver_->ComputeInstanceFieldInfo(field_index, dex_compilation_unit_, is_put, soa))); + ArtField* resolved_field = + compiler_driver_->ComputeInstanceFieldInfo(field_index, dex_compilation_unit_, is_put, soa); - if (resolved_field.Get() == nullptr) { + if (resolved_field == nullptr) { MaybeRecordStat(MethodCompilationStat::kNotCompiledUnresolvedField); return false; } @@ -728,15 +724,15 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, uint16_t field_index = instruction.VRegB_21c(); ScopedObjectAccess soa(Thread::Current()); - StackHandleScope<5> hs(soa.Self()); + StackHandleScope<4> hs(soa.Self()); Handle dex_cache(hs.NewHandle( dex_compilation_unit_->GetClassLinker()->FindDexCache(*dex_compilation_unit_->GetDexFile()))); Handle class_loader(hs.NewHandle( soa.Decode(dex_compilation_unit_->GetClassLoader()))); - Handle resolved_field(hs.NewHandle(compiler_driver_->ResolveField( - soa, dex_cache, class_loader, dex_compilation_unit_, field_index, true))); + ArtField* resolved_field = compiler_driver_->ResolveField( + soa, dex_cache, class_loader, dex_compilation_unit_, field_index, true); - if (resolved_field.Get() == nullptr) { + if (resolved_field == nullptr) { MaybeRecordStat(MethodCompilationStat::kNotCompiledUnresolvedField); return false; } @@ -758,7 +754,7 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, std::pair pair = compiler_driver_->IsFastStaticField( outer_dex_cache.Get(), referrer_class.Get(), - resolved_field.Get(), + resolved_field, field_index, &storage_index); bool can_easily_access = is_put ? pair.second : pair.first; -- cgit v1.2.3-59-g8ed1b