diff options
author | 2016-04-14 18:07:55 +0100 | |
---|---|---|
committer | 2016-04-14 18:45:01 +0100 | |
commit | 27bb86edf60e2f9ca2c1075c0c86b9e79374f1d0 (patch) | |
tree | 5e2cb0caa0b4456fd55c93f6c863bb3b26d5cd31 /compiler/optimizing/inliner.cc | |
parent | 0108f3d945cd5483217d7bf1df75ab5108d4555c (diff) |
Use dex cache from compilation unit in RTP.
Avoid calling the costly ClassLinker::FindDexCache() from
reference type propagation when the dex cache from the
compilation unit will do, i.e. almost always. Compiling
the Nexus 5 boot image on host under perf(1) shows that
the FindDexCache() hits drop from about 0.2% to almost
nothing, though enabling inlining for the boot image will
increase it a bit to 0.03% due to unavoidable calls from
the inliner.
Also clean up the ScopedObjectAccess usage a bit.
Change-Id: I426a5f9f5da9e64fad2ea57654240789a48d3871
Diffstat (limited to 'compiler/optimizing/inliner.cc')
-rw-r--r-- | compiler/optimizing/inliner.cc | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 77e0cbc600..d60298b954 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -411,7 +411,10 @@ bool HInliner::TryInlineMonomorphicCall(HInvoke* invoke_instruction, // Run type propagation to get the guard typed, and eventually propagate the // type of the receiver. - ReferenceTypePropagation rtp_fixup(graph_, handles_, /* is_first_run */ false); + ReferenceTypePropagation rtp_fixup(graph_, + outer_compilation_unit_.GetDexCache(), + handles_, + /* is_first_run */ false); rtp_fixup.Run(); MaybeRecordStat(kInlinedMonomorphicCall); @@ -532,7 +535,10 @@ bool HInliner::TryInlinePolymorphicCall(HInvoke* invoke_instruction, MaybeRecordStat(kInlinedPolymorphicCall); // Run type propagation to get the guards typed. - ReferenceTypePropagation rtp_fixup(graph_, handles_, /* is_first_run */ false); + ReferenceTypePropagation rtp_fixup(graph_, + outer_compilation_unit_.GetDexCache(), + handles_, + /* is_first_run */ false); rtp_fixup.Run(); return true; } @@ -709,7 +715,10 @@ bool HInliner::TryInlinePolymorphicCallToSameTarget(HInvoke* invoke_instruction, deoptimize->CopyEnvironmentFrom(invoke_instruction->GetEnvironment()); // Run type propagation to get the guard typed. - ReferenceTypePropagation rtp_fixup(graph_, handles_, /* is_first_run */ false); + ReferenceTypePropagation rtp_fixup(graph_, + outer_compilation_unit_.GetDexCache(), + handles_, + /* is_first_run */ false); rtp_fixup.Run(); MaybeRecordStat(kInlinedPolymorphicCall); @@ -971,7 +980,8 @@ HInstanceFieldGet* HInliner::CreateInstanceFieldGet(Handle<mirror::DexCache> dex // dex pc for the associated stack map. 0 is bogus but valid. Bug: 26854537. /* dex_pc */ 0); if (iget->GetType() == Primitive::kPrimNot) { - ReferenceTypePropagation rtp(graph_, handles_, /* is_first_run */ false); + // Use the same dex_cache that we used for field lookup as the hint_dex_cache. + ReferenceTypePropagation rtp(graph_, dex_cache, handles_, /* is_first_run */ false); rtp.Visit(iget); } return iget; @@ -1319,13 +1329,19 @@ void HInliner::FixUpReturnReferenceType(HInvoke* invoke_instruction, if (invoke_rti.IsStrictSupertypeOf(return_rti) || (return_rti.IsExact() && !invoke_rti.IsExact()) || !return_replacement->CanBeNull()) { - ReferenceTypePropagation(graph_, handles_, /* is_first_run */ false).Run(); + ReferenceTypePropagation(graph_, + outer_compilation_unit_.GetDexCache(), + handles_, + /* is_first_run */ false).Run(); } } } else if (return_replacement->IsInstanceOf()) { if (do_rtp) { // Inlining InstanceOf into an If may put a tighter bound on reference types. - ReferenceTypePropagation(graph_, handles_, /* is_first_run */ false).Run(); + ReferenceTypePropagation(graph_, + outer_compilation_unit_.GetDexCache(), + handles_, + /* is_first_run */ false).Run(); } } } |