diff options
author | 2015-09-02 14:54:11 -0700 | |
---|---|---|
committer | 2015-09-03 13:27:19 -0700 | |
commit | 736b560f2d2c89b63dc895888c671b5519afa4c8 (patch) | |
tree | d5aee7ac36f458a5f6e6d75fceb19f8963a71db5 /compiler/dex/mir_optimization.cc | |
parent | fe3879e6011f629d0dd6b04fab00b9496bd4ea08 (diff) |
Reduce how often we call FindDexCache
Before host boot.oat -j4 optimizing compile:
real 1m17.792s
user 3m26.140s
sys 0m8.340s
After:
real 1m12.324s
user 3m22.718s
sys 0m8.320s
Change-Id: If18e9e79e06cdf1676692e5efacb682bf93889c3
Diffstat (limited to 'compiler/dex/mir_optimization.cc')
-rw-r--r-- | compiler/dex/mir_optimization.cc | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/compiler/dex/mir_optimization.cc b/compiler/dex/mir_optimization.cc index 80b7ac1e5b..eb4915b821 100644 --- a/compiler/dex/mir_optimization.cc +++ b/compiler/dex/mir_optimization.cc @@ -17,6 +17,7 @@ #include "base/bit_vector-inl.h" #include "base/logging.h" #include "base/scoped_arena_containers.h" +#include "class_linker-inl.h" #include "dataflow_iterator-inl.h" #include "dex/verified_method.h" #include "dex_flags.h" @@ -30,6 +31,7 @@ #include "quick/dex_file_method_inliner.h" #include "quick/dex_file_to_method_inliner_map.h" #include "stack.h" +#include "thread-inl.h" #include "type_inference.h" #include "utils.h" @@ -1469,13 +1471,23 @@ void MIRGraph::ComputeInlineIFieldLoweringInfo(uint16_t field_idx, MIR* invoke, const MirMethodLoweringInfo& method_info = GetMethodLoweringInfo(invoke); MethodReference target = method_info.GetTargetMethod(); - DexCompilationUnit inlined_unit( - cu_, cu_->class_loader, cu_->class_linker, *target.dex_file, - nullptr /* code_item not used */, 0u /* class_def_idx not used */, target.dex_method_index, - 0u /* access_flags not used */, nullptr /* verified_method not used */); + ScopedObjectAccess soa(Thread::Current()); + StackHandleScope<1> hs(soa.Self()); + Handle<mirror::DexCache> dex_cache( + hs.NewHandle(cu_->class_linker->FindDexCache(hs.Self(), *target.dex_file))); + DexCompilationUnit inlined_unit(cu_, + cu_->class_loader, + cu_->class_linker, + *target.dex_file, + nullptr /* code_item not used */, + 0u /* class_def_idx not used */, + target.dex_method_index, + 0u /* access_flags not used */, + nullptr /* verified_method not used */, + dex_cache); DexMemAccessType type = IGetOrIPutMemAccessType(iget_or_iput->dalvikInsn.opcode); MirIFieldLoweringInfo inlined_field_info(field_idx, type, false); - MirIFieldLoweringInfo::Resolve(cu_->compiler_driver, &inlined_unit, &inlined_field_info, 1u); + MirIFieldLoweringInfo::Resolve(soa, cu_->compiler_driver, &inlined_unit, &inlined_field_info, 1u); DCHECK(inlined_field_info.IsResolved()); uint32_t field_info_index = ifield_lowering_infos_.size(); |