diff options
-rw-r--r-- | compiler/optimizing/inliner.cc | 6 | ||||
-rw-r--r-- | compiler/optimizing/load_store_elimination.cc | 3 | ||||
-rw-r--r-- | compiler/optimizing/reference_type_propagation.cc | 38 | ||||
-rw-r--r-- | compiler/optimizing/reference_type_propagation.h | 3 | ||||
-rw-r--r-- | compiler/optimizing/reference_type_propagation_test.cc | 7 | ||||
-rw-r--r-- | compiler/optimizing/ssa_builder.cc | 1 |
6 files changed, 13 insertions, 45 deletions
diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index f73c0d38e4..2b8c04b4a5 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -802,7 +802,6 @@ bool HInliner::TryInlineMonomorphicCall( // Run type propagation to get the guard typed, and eventually propagate the // type of the receiver. ReferenceTypePropagation rtp_fixup(graph_, - outer_compilation_unit_.GetClassLoader(), outer_compilation_unit_.GetDexCache(), /* is_first_run= */ false); rtp_fixup.Run(); @@ -1024,7 +1023,6 @@ bool HInliner::TryInlinePolymorphicCall( // Run type propagation to get the guards typed. ReferenceTypePropagation rtp_fixup(graph_, - outer_compilation_unit_.GetClassLoader(), outer_compilation_unit_.GetDexCache(), /* is_first_run= */ false); rtp_fixup.Run(); @@ -1215,7 +1213,6 @@ bool HInliner::TryInlinePolymorphicCallToSameTarget( // Run type propagation to get the guard typed. ReferenceTypePropagation rtp_fixup(graph_, - outer_compilation_unit_.GetClassLoader(), outer_compilation_unit_.GetDexCache(), /* is_first_run= */ false); rtp_fixup.Run(); @@ -1232,7 +1229,6 @@ void HInliner::MaybeRunReferenceTypePropagation(HInstruction* replacement, // Actual return value has a more specific type than the method's declared // return type. Run RTP again on the outer graph to propagate it. ReferenceTypePropagation(graph_, - outer_compilation_unit_.GetClassLoader(), outer_compilation_unit_.GetDexCache(), /* is_first_run= */ false).Run(); } @@ -1684,7 +1680,6 @@ HInstanceFieldGet* HInliner::CreateInstanceFieldGet(uint32_t field_index, Handle<mirror::DexCache> dex_cache = graph_->GetHandleCache()->NewHandle(referrer->GetDexCache()); ReferenceTypePropagation rtp(graph_, - outer_compilation_unit_.GetClassLoader(), dex_cache, /* is_first_run= */ false); rtp.Visit(iget); @@ -1807,7 +1802,6 @@ void HInliner::SubstituteArguments(HGraph* callee_graph, // are more specific than the declared ones, run RTP again on the inner graph. if (run_rtp || ArgumentTypesMoreSpecific(invoke_instruction, resolved_method)) { ReferenceTypePropagation(callee_graph, - outer_compilation_unit_.GetClassLoader(), dex_compilation_unit.GetDexCache(), /* is_first_run= */ false).Run(); } diff --git a/compiler/optimizing/load_store_elimination.cc b/compiler/optimizing/load_store_elimination.cc index 9b8f07e969..5e2e4eecde 100644 --- a/compiler/optimizing/load_store_elimination.cc +++ b/compiler/optimizing/load_store_elimination.cc @@ -1764,7 +1764,6 @@ static HInstruction* FindOrConstructNonLoopPhi( if (type == DataType::Type::kReference) { // Update reference type information. Pass invalid handles, these are not used for Phis. ReferenceTypePropagation rtp_fixup(block->GetGraph(), - Handle<mirror::ClassLoader>(), Handle<mirror::DexCache>(), /* is_first_run= */ false); rtp_fixup.Visit(phi); @@ -2352,7 +2351,6 @@ bool LSEVisitor::MaterializeLoopPhis(ArrayRef<const size_t> phi_placeholder_inde } // Update reference type information. Pass invalid handles, these are not used for Phis. ReferenceTypePropagation rtp_fixup(GetGraph(), - Handle<mirror::ClassLoader>(), Handle<mirror::DexCache>(), /* is_first_run= */ false); rtp_fixup.Visit(ArrayRef<HInstruction* const>(phis)); @@ -3013,7 +3011,6 @@ class PartialLoadStoreEliminationHelper { return; } ReferenceTypePropagation rtp_fixup(GetGraph(), - Handle<mirror::ClassLoader>(), Handle<mirror::DexCache>(), /* is_first_run= */ false); rtp_fixup.Visit(ArrayRef<HInstruction* const>(new_ref_phis_)); diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc index e6024b08cb..3bfacde612 100644 --- a/compiler/optimizing/reference_type_propagation.cc +++ b/compiler/optimizing/reference_type_propagation.cc @@ -43,16 +43,12 @@ static inline ObjPtr<mirror::DexCache> FindDexCacheWithHint( class ReferenceTypePropagation::RTPVisitor : public HGraphDelegateVisitor { public: - RTPVisitor(HGraph* graph, - Handle<mirror::ClassLoader> class_loader, - Handle<mirror::DexCache> hint_dex_cache, - bool is_first_run) - : HGraphDelegateVisitor(graph), - class_loader_(class_loader), - hint_dex_cache_(hint_dex_cache), - allocator_(graph->GetArenaStack()), - worklist_(allocator_.Adapter(kArenaAllocReferenceTypePropagation)), - is_first_run_(is_first_run) { + RTPVisitor(HGraph* graph, Handle<mirror::DexCache> hint_dex_cache, bool is_first_run) + : HGraphDelegateVisitor(graph), + hint_dex_cache_(hint_dex_cache), + allocator_(graph->GetArenaStack()), + worklist_(allocator_.Adapter(kArenaAllocReferenceTypePropagation)), + is_first_run_(is_first_run) { worklist_.reserve(kDefaultWorklistSize); } @@ -110,7 +106,6 @@ class ReferenceTypePropagation::RTPVisitor : public HGraphDelegateVisitor { static constexpr size_t kDefaultWorklistSize = 8; - Handle<mirror::ClassLoader> class_loader_; Handle<mirror::DexCache> hint_dex_cache_; // Use local allocator for allocating memory. @@ -122,15 +117,10 @@ class ReferenceTypePropagation::RTPVisitor : public HGraphDelegateVisitor { }; ReferenceTypePropagation::ReferenceTypePropagation(HGraph* graph, - Handle<mirror::ClassLoader> class_loader, Handle<mirror::DexCache> hint_dex_cache, bool is_first_run, const char* name) - : HOptimization(graph, name), - class_loader_(class_loader), - hint_dex_cache_(hint_dex_cache), - is_first_run_(is_first_run) { -} + : HOptimization(graph, name), hint_dex_cache_(hint_dex_cache), is_first_run_(is_first_run) {} void ReferenceTypePropagation::ValidateTypes() { // TODO: move this to the graph checker. Note: There may be no Thread for gtests. @@ -167,18 +157,12 @@ void ReferenceTypePropagation::ValidateTypes() { } void ReferenceTypePropagation::Visit(HInstruction* instruction) { - RTPVisitor visitor(graph_, - class_loader_, - hint_dex_cache_, - is_first_run_); + RTPVisitor visitor(graph_, hint_dex_cache_, is_first_run_); instruction->Accept(&visitor); } void ReferenceTypePropagation::Visit(ArrayRef<HInstruction* const> instructions) { - RTPVisitor visitor(graph_, - class_loader_, - hint_dex_cache_, - is_first_run_); + RTPVisitor visitor(graph_, hint_dex_cache_, is_first_run_); for (HInstruction* instruction : instructions) { if (instruction->IsPhi()) { // Need to force phis to recalculate null-ness. @@ -349,7 +333,7 @@ static void BoundTypeForClassCheck(HInstruction* check) { } bool ReferenceTypePropagation::Run() { - RTPVisitor visitor(graph_, class_loader_, hint_dex_cache_, is_first_run_); + RTPVisitor visitor(graph_, hint_dex_cache_, is_first_run_); // To properly propagate type info we need to visit in the dominator-based order. // Reverse post order guarantees a node's dominators are visited first. @@ -583,7 +567,7 @@ void ReferenceTypePropagation::RTPVisitor::UpdateReferenceTypeInfo(HInstruction* ScopedObjectAccess soa(Thread::Current()); ObjPtr<mirror::DexCache> dex_cache = FindDexCacheWithHint(soa.Self(), dex_file, hint_dex_cache_); ObjPtr<mirror::Class> klass = Runtime::Current()->GetClassLinker()->LookupResolvedType( - type_idx, dex_cache, class_loader_.Get()); + type_idx, dex_cache, dex_cache->GetClassLoader()); SetClassAsTypeInfo(instr, klass, is_exact); } diff --git a/compiler/optimizing/reference_type_propagation.h b/compiler/optimizing/reference_type_propagation.h index 889a8465e0..e2e178a9d8 100644 --- a/compiler/optimizing/reference_type_propagation.h +++ b/compiler/optimizing/reference_type_propagation.h @@ -31,7 +31,6 @@ namespace art { class ReferenceTypePropagation : public HOptimization { public: ReferenceTypePropagation(HGraph* graph, - Handle<mirror::ClassLoader> class_loader, Handle<mirror::DexCache> hint_dex_cache, bool is_first_run, const char* name = kReferenceTypePropagationPassName); @@ -73,8 +72,6 @@ class ReferenceTypePropagation : public HOptimization { void ValidateTypes(); - Handle<mirror::ClassLoader> class_loader_; - // Note: hint_dex_cache_ is usually, but not necessarily, the dex cache associated with // graph_->GetDexFile(). Since we may look up also in other dex files, it's used only // as a hint, to reduce the number of calls to the costly ClassLinker::FindDexCache(). diff --git a/compiler/optimizing/reference_type_propagation_test.cc b/compiler/optimizing/reference_type_propagation_test.cc index d1bcab083c..839b1c6e43 100644 --- a/compiler/optimizing/reference_type_propagation_test.cc +++ b/compiler/optimizing/reference_type_propagation_test.cc @@ -47,11 +47,8 @@ class ReferenceTypePropagationTestBase : public SuperTest, public OptimizingUnit void SetupPropagation(VariableSizedHandleScope* handles) { graph_ = CreateGraph(handles); - propagation_ = new (GetAllocator()) ReferenceTypePropagation(graph_, - Handle<mirror::ClassLoader>(), - Handle<mirror::DexCache>(), - true, - "test_prop"); + propagation_ = new (GetAllocator()) + ReferenceTypePropagation(graph_, Handle<mirror::DexCache>(), true, "test_prop"); } // Relay method to merge type in reference type propagation. diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index 67ee83c9dd..a36b74bba9 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -538,7 +538,6 @@ GraphAnalysisResult SsaBuilder::BuildSsa() { // Compute type of reference type instructions. The pass assumes that // NullConstant has been fixed up. ReferenceTypePropagation(graph_, - class_loader_, dex_cache_, /* is_first_run= */ true).Run(); |