diff options
Diffstat (limited to 'compiler/optimizing')
-rw-r--r-- | compiler/optimizing/builder.cc | 12 | ||||
-rw-r--r-- | compiler/optimizing/builder.h | 12 | ||||
-rw-r--r-- | compiler/optimizing/gvn_test.cc | 55 | ||||
-rw-r--r-- | compiler/optimizing/inliner.cc | 14 | ||||
-rw-r--r-- | compiler/optimizing/licm_test.cc | 10 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 34 | ||||
-rw-r--r-- | compiler/optimizing/optimizing_compiler.cc | 26 | ||||
-rw-r--r-- | compiler/optimizing/reference_type_propagation.cc | 3 | ||||
-rw-r--r-- | compiler/optimizing/register_allocator_test.cc | 14 |
9 files changed, 119 insertions, 61 deletions
diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 23ab94e5fe..1650fd1ced 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -1205,7 +1205,8 @@ bool HGraphBuilder::BuildInstanceFieldAccess(const Instruction& instruction, resolved_field->GetOffset(), resolved_field->IsVolatile(), field_index, - *dex_file_)); + *dex_file_, + dex_compilation_unit_->GetDexCache())); } else { current_block_->AddInstruction(new (arena_) HInstanceFieldGet( current_block_->GetLastInstruction(), @@ -1213,7 +1214,8 @@ bool HGraphBuilder::BuildInstanceFieldAccess(const Instruction& instruction, resolved_field->GetOffset(), resolved_field->IsVolatile(), field_index, - *dex_file_)); + *dex_file_, + dex_compilation_unit_->GetDexCache())); UpdateLocal(source_or_dest_reg, current_block_->GetLastInstruction()); } @@ -1334,14 +1336,16 @@ bool HGraphBuilder::BuildStaticFieldAccess(const Instruction& instruction, resolved_field->GetOffset(), resolved_field->IsVolatile(), field_index, - *dex_file_)); + *dex_file_, + dex_cache_)); } else { current_block_->AddInstruction(new (arena_) HStaticFieldGet(cls, field_type, resolved_field->GetOffset(), resolved_field->IsVolatile(), field_index, - *dex_file_)); + *dex_file_, + dex_cache_)); UpdateLocal(source_or_dest_reg, current_block_->GetLastInstruction()); } return true; diff --git a/compiler/optimizing/builder.h b/compiler/optimizing/builder.h index d6b25ee822..560ed86e50 100644 --- a/compiler/optimizing/builder.h +++ b/compiler/optimizing/builder.h @@ -40,7 +40,8 @@ class HGraphBuilder : public ValueObject { const DexFile* dex_file, CompilerDriver* driver, OptimizingCompilerStats* compiler_stats, - const uint8_t* interpreter_metadata) + const uint8_t* interpreter_metadata, + Handle<mirror::DexCache> dex_cache) : arena_(graph->GetArena()), branch_targets_(graph->GetArena(), 0), locals_(graph->GetArena(), 0), @@ -57,7 +58,8 @@ class HGraphBuilder : public ValueObject { latest_result_(nullptr), can_use_baseline_for_string_init_(true), compilation_stats_(compiler_stats), - interpreter_metadata_(interpreter_metadata) {} + interpreter_metadata_(interpreter_metadata), + dex_cache_(dex_cache) {} // Only for unit testing. HGraphBuilder(HGraph* graph, Primitive::Type return_type = Primitive::kPrimInt) @@ -77,7 +79,8 @@ class HGraphBuilder : public ValueObject { latest_result_(nullptr), can_use_baseline_for_string_init_(true), compilation_stats_(nullptr), - interpreter_metadata_(nullptr) {} + interpreter_metadata_(nullptr), + dex_cache_(NullHandle<mirror::DexCache>()) {} bool BuildGraph(const DexFile::CodeItem& code); @@ -334,6 +337,9 @@ class HGraphBuilder : public ValueObject { const uint8_t* interpreter_metadata_; + // Dex cache for dex_file_. + Handle<mirror::DexCache> dex_cache_; + DISALLOW_COPY_AND_ASSIGN(HGraphBuilder); }; diff --git a/compiler/optimizing/gvn_test.cc b/compiler/optimizing/gvn_test.cc index 42ef3ff4a5..32f45b5669 100644 --- a/compiler/optimizing/gvn_test.cc +++ b/compiler/optimizing/gvn_test.cc @@ -28,6 +28,7 @@ namespace art { TEST(GVNTest, LocalFieldElimination) { ArenaPool pool; ArenaAllocator allocator(&pool); + NullHandle<mirror::DexCache> dex_cache; HGraph* graph = CreateGraph(&allocator); HBasicBlock* entry = new (&allocator) HBasicBlock(graph); @@ -45,20 +46,23 @@ TEST(GVNTest, LocalFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); block->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimNot, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* to_remove = block->GetLastInstruction(); block->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimNot, MemberOffset(43), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* different_offset = block->GetLastInstruction(); // Kill the value. block->AddInstruction(new (&allocator) HInstanceFieldSet(parameter, @@ -67,13 +71,15 @@ TEST(GVNTest, LocalFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); block->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimNot, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* use_after_kill = block->GetLastInstruction(); block->AddInstruction(new (&allocator) HExit()); @@ -94,6 +100,7 @@ TEST(GVNTest, LocalFieldElimination) { TEST(GVNTest, GlobalFieldElimination) { ArenaPool pool; ArenaAllocator allocator(&pool); + NullHandle<mirror::DexCache> dex_cache; HGraph* graph = CreateGraph(&allocator); HBasicBlock* entry = new (&allocator) HBasicBlock(graph); @@ -110,7 +117,8 @@ TEST(GVNTest, GlobalFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); block->AddInstruction(new (&allocator) HIf(block->GetLastInstruction())); HBasicBlock* then = new (&allocator) HBasicBlock(graph); @@ -130,21 +138,24 @@ TEST(GVNTest, GlobalFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); then->AddInstruction(new (&allocator) HGoto()); else_->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimBoolean, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); else_->AddInstruction(new (&allocator) HGoto()); join->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimBoolean, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); join->AddInstruction(new (&allocator) HExit()); graph->TryBuildingSsa(); @@ -161,6 +172,7 @@ TEST(GVNTest, GlobalFieldElimination) { TEST(GVNTest, LoopFieldElimination) { ArenaPool pool; ArenaAllocator allocator(&pool); + NullHandle<mirror::DexCache> dex_cache; HGraph* graph = CreateGraph(&allocator); HBasicBlock* entry = new (&allocator) HBasicBlock(graph); @@ -178,7 +190,8 @@ TEST(GVNTest, LoopFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); block->AddInstruction(new (&allocator) HGoto()); HBasicBlock* loop_header = new (&allocator) HBasicBlock(graph); @@ -198,7 +211,8 @@ TEST(GVNTest, LoopFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* field_get_in_loop_header = loop_header->GetLastInstruction(); loop_header->AddInstruction(new (&allocator) HIf(block->GetLastInstruction())); @@ -210,14 +224,16 @@ TEST(GVNTest, LoopFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* field_set = loop_body->GetLastInstruction(); loop_body->AddInstruction(new (&allocator) HInstanceFieldGet(parameter, Primitive::kPrimBoolean, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* field_get_in_loop_body = loop_body->GetLastInstruction(); loop_body->AddInstruction(new (&allocator) HGoto()); @@ -226,7 +242,8 @@ TEST(GVNTest, LoopFieldElimination) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); HInstruction* field_get_in_exit = exit->GetLastInstruction(); exit->AddInstruction(new (&allocator) HExit()); @@ -265,6 +282,7 @@ TEST(GVNTest, LoopFieldElimination) { TEST(GVNTest, LoopSideEffects) { ArenaPool pool; ArenaAllocator allocator(&pool); + NullHandle<mirror::DexCache> dex_cache; static const SideEffects kCanTriggerGC = SideEffects::CanTriggerGC(); @@ -320,7 +338,8 @@ TEST(GVNTest, LoopSideEffects) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile())); + graph->GetDexFile(), + dex_cache)); SideEffectsAnalysis side_effects(graph); side_effects.Run(); @@ -342,7 +361,8 @@ TEST(GVNTest, LoopSideEffects) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile()), + graph->GetDexFile(), + dex_cache), outer_loop_body->GetLastInstruction()); SideEffectsAnalysis side_effects(graph); @@ -365,7 +385,8 @@ TEST(GVNTest, LoopSideEffects) { MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile()), + graph->GetDexFile(), + dex_cache), inner_loop_body->GetLastInstruction()); SideEffectsAnalysis side_effects(graph); diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 112d42e904..b5870ae914 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -182,10 +182,13 @@ bool HInliner::TryInline(HInvoke* invoke_instruction) { ArtMethod* resolved_method; if (invoke_instruction->IsInvokeStaticOrDirect()) { MethodReference ref = invoke_instruction->AsInvokeStaticOrDirect()->GetTargetMethod(); - resolved_method = class_linker->FindDexCache(soa.Self(), *ref.dex_file)->GetResolvedMethod( + mirror::DexCache* const dex_cache = (&caller_dex_file == ref.dex_file) + ? caller_compilation_unit_.GetDexCache().Get() + : class_linker->FindDexCache(soa.Self(), *ref.dex_file); + resolved_method = dex_cache->GetResolvedMethod( ref.dex_method_index, class_linker->GetImagePointerSize()); } else { - resolved_method = class_linker->FindDexCache(soa.Self(), caller_dex_file)->GetResolvedMethod( + resolved_method = caller_compilation_unit_.GetDexCache().Get()->GetResolvedMethod( method_index, class_linker->GetImagePointerSize()); } @@ -273,6 +276,7 @@ bool HInliner::TryBuildAndInline(ArtMethod* resolved_method, const DexFile& callee_dex_file = *resolved_method->GetDexFile(); uint32_t method_index = resolved_method->GetDexMethodIndex(); ClassLinker* class_linker = caller_compilation_unit_.GetClassLinker(); + Handle<mirror::DexCache> dex_cache(handles_->NewHandle(resolved_method->GetDexCache())); DexCompilationUnit dex_compilation_unit( nullptr, caller_compilation_unit_.GetClassLoader(), @@ -282,7 +286,8 @@ bool HInliner::TryBuildAndInline(ArtMethod* resolved_method, resolved_method->GetDeclaringClass()->GetDexClassDefIndex(), method_index, resolved_method->GetAccessFlags(), - compiler_driver_->GetVerifiedMethod(&callee_dex_file, method_index)); + compiler_driver_->GetVerifiedMethod(&callee_dex_file, method_index), + dex_cache); bool requires_ctor_barrier = false; @@ -326,7 +331,8 @@ bool HInliner::TryBuildAndInline(ArtMethod* resolved_method, resolved_method->GetDexFile(), compiler_driver_, &inline_stats, - resolved_method->GetQuickenedInfo()); + resolved_method->GetQuickenedInfo(), + dex_cache); if (!builder.BuildGraph(*code_item)) { VLOG(compiler) << "Method " << PrettyMethod(method_index, callee_dex_file) diff --git a/compiler/optimizing/licm_test.cc b/compiler/optimizing/licm_test.cc index 2fc66e6de4..bc4a663b86 100644 --- a/compiler/optimizing/licm_test.cc +++ b/compiler/optimizing/licm_test.cc @@ -120,13 +120,14 @@ TEST_F(LICMTest, FieldHoisting) { BuildLoop(); // Populate the loop with instructions: set/get field with different types. + NullHandle<mirror::DexCache> dex_cache; HInstruction* get_field = new (&allocator_) HInstanceFieldGet( parameter_, Primitive::kPrimLong, MemberOffset(10), - false, kUnknownFieldIndex, graph_->GetDexFile()); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); loop_body_->InsertInstructionBefore(get_field, loop_body_->GetLastInstruction()); HInstruction* set_field = new (&allocator_) HInstanceFieldSet( parameter_, constant_, Primitive::kPrimInt, MemberOffset(20), - false, kUnknownFieldIndex, graph_->GetDexFile()); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); loop_body_->InsertInstructionBefore(set_field, loop_body_->GetLastInstruction()); EXPECT_EQ(get_field->GetBlock(), loop_body_); @@ -140,13 +141,14 @@ TEST_F(LICMTest, NoFieldHoisting) { BuildLoop(); // Populate the loop with instructions: set/get field with same types. + NullHandle<mirror::DexCache> dex_cache; HInstruction* get_field = new (&allocator_) HInstanceFieldGet( parameter_, Primitive::kPrimLong, MemberOffset(10), - false, kUnknownFieldIndex, graph_->GetDexFile()); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); loop_body_->InsertInstructionBefore(get_field, loop_body_->GetLastInstruction()); HInstruction* set_field = new (&allocator_) HInstanceFieldSet( parameter_, get_field, Primitive::kPrimLong, MemberOffset(10), - false, kUnknownFieldIndex, graph_->GetDexFile()); + false, kUnknownFieldIndex, graph_->GetDexFile(), dex_cache); loop_body_->InsertInstructionBefore(set_field, loop_body_->GetLastInstruction()); EXPECT_EQ(get_field->GetBlock(), loop_body_); diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 2ed2d9ab20..1470e10081 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -58,6 +58,10 @@ class LocationSummary; class SlowPathCode; class SsaBuilder; +namespace mirror { +class DexCache; +} // namespace mirror + static const int kDefaultNumberOfBlocks = 8; static const int kDefaultNumberOfSuccessors = 2; static const int kDefaultNumberOfPredecessors = 2; @@ -4020,25 +4024,29 @@ class FieldInfo : public ValueObject { Primitive::Type field_type, bool is_volatile, uint32_t index, - const DexFile& dex_file) + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) : field_offset_(field_offset), field_type_(field_type), is_volatile_(is_volatile), index_(index), - dex_file_(dex_file) {} + dex_file_(dex_file), + dex_cache_(dex_cache) {} MemberOffset GetFieldOffset() const { return field_offset_; } Primitive::Type GetFieldType() const { return field_type_; } uint32_t GetFieldIndex() const { return index_; } const DexFile& GetDexFile() const { return dex_file_; } bool IsVolatile() const { return is_volatile_; } + Handle<mirror::DexCache> GetDexCache() const { return dex_cache_; } private: const MemberOffset field_offset_; const Primitive::Type field_type_; const bool is_volatile_; - uint32_t index_; + const uint32_t index_; const DexFile& dex_file_; + const Handle<mirror::DexCache> dex_cache_; }; class HInstanceFieldGet : public HExpression<1> { @@ -4048,11 +4056,12 @@ class HInstanceFieldGet : public HExpression<1> { MemberOffset field_offset, bool is_volatile, uint32_t field_idx, - const DexFile& dex_file) + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) : HExpression( field_type, SideEffects::FieldReadOfType(field_type, is_volatile)), - field_info_(field_offset, field_type, is_volatile, field_idx, dex_file) { + field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache) { SetRawInputAt(0, value); } @@ -4092,10 +4101,11 @@ class HInstanceFieldSet : public HTemplateInstruction<2> { MemberOffset field_offset, bool is_volatile, uint32_t field_idx, - const DexFile& dex_file) + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) : HTemplateInstruction( SideEffects::FieldWriteOfType(field_type, is_volatile)), - field_info_(field_offset, field_type, is_volatile, field_idx, dex_file), + field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache), value_can_be_null_(true) { SetRawInputAt(0, object); SetRawInputAt(1, value); @@ -4510,11 +4520,12 @@ class HStaticFieldGet : public HExpression<1> { MemberOffset field_offset, bool is_volatile, uint32_t field_idx, - const DexFile& dex_file) + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) : HExpression( field_type, SideEffects::FieldReadOfType(field_type, is_volatile)), - field_info_(field_offset, field_type, is_volatile, field_idx, dex_file) { + field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache) { SetRawInputAt(0, cls); } @@ -4551,10 +4562,11 @@ class HStaticFieldSet : public HTemplateInstruction<2> { MemberOffset field_offset, bool is_volatile, uint32_t field_idx, - const DexFile& dex_file) + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) : HTemplateInstruction( SideEffects::FieldWriteOfType(field_type, is_volatile)), - field_info_(field_offset, field_type, is_volatile, field_idx, dex_file), + field_info_(field_offset, field_type, is_volatile, field_idx, dex_file, dex_cache), value_can_be_null_(true) { SetRawInputAt(0, cls); SetRawInputAt(1, value); diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 6f251e8e6c..7044a8796a 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -243,7 +243,8 @@ class OptimizingCompiler FINAL : public Compiler { uint16_t class_def_idx, uint32_t method_idx, jobject class_loader, - const DexFile& dex_file) const OVERRIDE; + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) const OVERRIDE; CompiledMethod* TryCompile(const DexFile::CodeItem* code_item, uint32_t access_flags, @@ -251,7 +252,8 @@ class OptimizingCompiler FINAL : public Compiler { uint16_t class_def_idx, uint32_t method_idx, jobject class_loader, - const DexFile& dex_file) const; + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) const; CompiledMethod* JniCompile(uint32_t access_flags, uint32_t method_idx, @@ -638,7 +640,8 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite uint16_t class_def_idx, uint32_t method_idx, jobject class_loader, - const DexFile& dex_file) const { + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) const { UNUSED(invoke_type); std::string method_name = PrettyMethod(method_idx, dex_file); MaybeRecordStat(MethodCompilationStat::kAttemptCompilation); @@ -674,7 +677,7 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite DexCompilationUnit dex_compilation_unit( nullptr, class_loader, Runtime::Current()->GetClassLinker(), dex_file, code_item, class_def_idx, method_idx, access_flags, - compiler_driver->GetVerifiedMethod(&dex_file, method_idx)); + compiler_driver->GetVerifiedMethod(&dex_file, method_idx), dex_cache); bool requires_barrier = dex_compilation_unit.IsConstructor() && compiler_driver->RequiresConstructorBarrier(Thread::Current(), @@ -712,10 +715,7 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite const uint8_t* interpreter_metadata = nullptr; { ScopedObjectAccess soa(Thread::Current()); - StackHandleScope<4> hs(soa.Self()); - ClassLinker* class_linker = dex_compilation_unit.GetClassLinker(); - Handle<mirror::DexCache> dex_cache(hs.NewHandle(class_linker->FindDexCache( - soa.Self(), dex_file))); + StackHandleScope<1> hs(soa.Self()); Handle<mirror::ClassLoader> loader(hs.NewHandle( soa.Decode<mirror::ClassLoader*>(class_loader))); ArtMethod* art_method = compiler_driver->ResolveMethod( @@ -732,7 +732,8 @@ CompiledMethod* OptimizingCompiler::TryCompile(const DexFile::CodeItem* code_ite &dex_file, compiler_driver, compilation_stats_.get(), - interpreter_metadata); + interpreter_metadata, + dex_cache); VLOG(compiler) << "Building " << method_name; @@ -798,13 +799,14 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, uint16_t class_def_idx, uint32_t method_idx, jobject jclass_loader, - const DexFile& dex_file) const { + const DexFile& dex_file, + Handle<mirror::DexCache> dex_cache) const { CompilerDriver* compiler_driver = GetCompilerDriver(); CompiledMethod* method = nullptr; DCHECK(!compiler_driver->GetVerifiedMethod(&dex_file, method_idx)->HasRuntimeThrow()); if (compiler_driver->IsMethodVerifiedWithoutFailures(method_idx, class_def_idx, dex_file)) { method = TryCompile(code_item, access_flags, invoke_type, class_def_idx, - method_idx, jclass_loader, dex_file); + method_idx, jclass_loader, dex_file, dex_cache); } else { if (compiler_driver->GetCompilerOptions().VerifyAtRuntime()) { MaybeRecordStat(MethodCompilationStat::kNotCompiledVerifyAtRuntime); @@ -817,7 +819,7 @@ CompiledMethod* OptimizingCompiler::Compile(const DexFile::CodeItem* code_item, return method; } method = delegate_->Compile(code_item, access_flags, invoke_type, class_def_idx, method_idx, - jclass_loader, dex_file); + jclass_loader, dex_file, dex_cache); if (method != nullptr) { MaybeRecordStat(MethodCompilationStat::kCompiledQuick); diff --git a/compiler/optimizing/reference_type_propagation.cc b/compiler/optimizing/reference_type_propagation.cc index 516638b33c..b887b890b5 100644 --- a/compiler/optimizing/reference_type_propagation.cc +++ b/compiler/optimizing/reference_type_propagation.cc @@ -434,8 +434,7 @@ void RTPVisitor::UpdateFieldAccessTypeInfo(HInstruction* instr, ScopedObjectAccess soa(Thread::Current()); ClassLinker* cl = Runtime::Current()->GetClassLinker(); - mirror::DexCache* dex_cache = cl->FindDexCache(soa.Self(), info.GetDexFile(), false); - ArtField* field = cl->GetResolvedField(info.GetFieldIndex(), dex_cache); + ArtField* field = cl->GetResolvedField(info.GetFieldIndex(), info.GetDexCache().Get()); // TODO: There are certain cases where we can't resolve the field. // b/21914925 is open to keep track of a repro case for this issue. mirror::Class* klass = (field == nullptr) ? nullptr : field->GetType<false>(); diff --git a/compiler/optimizing/register_allocator_test.cc b/compiler/optimizing/register_allocator_test.cc index b7da36299d..965a8dfebf 100644 --- a/compiler/optimizing/register_allocator_test.cc +++ b/compiler/optimizing/register_allocator_test.cc @@ -472,6 +472,7 @@ static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator, HInstruction** input2) { HGraph* graph = CreateGraph(allocator); HBasicBlock* entry = new (allocator) HBasicBlock(graph); + NullHandle<mirror::DexCache> dex_cache; graph->AddBlock(entry); graph->SetEntryBlock(entry); HInstruction* parameter = new (allocator) HParameterValue(0, Primitive::kPrimNot); @@ -486,7 +487,8 @@ static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator, MemberOffset(22), false, kUnknownFieldIndex, - graph->GetDexFile()); + graph->GetDexFile(), + dex_cache); block->AddInstruction(test); block->AddInstruction(new (allocator) HIf(test)); HBasicBlock* then = new (allocator) HBasicBlock(graph); @@ -510,13 +512,15 @@ static HGraph* BuildIfElseWithPhi(ArenaAllocator* allocator, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile()); + graph->GetDexFile(), + dex_cache); *input2 = new (allocator) HInstanceFieldGet(parameter, Primitive::kPrimInt, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile()); + graph->GetDexFile(), + dex_cache); then->AddInstruction(*input1); else_->AddInstruction(*input2); join->AddInstruction(new (allocator) HExit()); @@ -613,6 +617,7 @@ static HGraph* BuildFieldReturn(ArenaAllocator* allocator, HInstruction** field, HInstruction** ret) { HGraph* graph = CreateGraph(allocator); + NullHandle<mirror::DexCache> dex_cache; HBasicBlock* entry = new (allocator) HBasicBlock(graph); graph->AddBlock(entry); graph->SetEntryBlock(entry); @@ -628,7 +633,8 @@ static HGraph* BuildFieldReturn(ArenaAllocator* allocator, MemberOffset(42), false, kUnknownFieldIndex, - graph->GetDexFile()); + graph->GetDexFile(), + dex_cache); block->AddInstruction(*field); *ret = new (allocator) HReturn(*field); block->AddInstruction(*ret); |