diff options
author | Vladimir Marko <vmarko@google.com> | 2020-05-12 13:58:51 +0100 |
---|---|---|
committer | Vladimir Marko <vmarko@google.com> | 2020-05-13 08:00:22 +0000 |
commit | 02ca05a5a6e3f5028c6c2987a81be481d07bc617 (patch) | |
tree | a364c4a46c573fdfddf607b0e78e5fd3f455c17f /compiler/optimizing/instruction_builder.cc | |
parent | 5868adaefe72cc8bcdcd8325c40f712375a506d1 (diff) |
Move HandleCache to HGraph.
This avoids passing the `VariableSizedHandleScope*` argument
around and eliminates HGraph::inexact_object_rti_ and its
initialization. The latter shall allow running Optimizing
gtests that do not require type information without creating
a Runtime in future. (To be implemented in a separate CL.)
Test: m test-art-host-gtest
Test: testrunner.py --host --optmizing
Test: aosp_taimen-userdebug boots.
Change-Id: I36fe9bc556c6d610d644c8c14cc74c9985a14d64
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index ea3d3c0427..768bc2465c 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -52,11 +52,9 @@ HInstructionBuilder::HInstructionBuilder(HGraph* graph, CodeGenerator* code_generator, ArrayRef<const uint8_t> interpreter_metadata, OptimizingCompilerStats* compiler_stats, - VariableSizedHandleScope* handles, ScopedArenaAllocator* local_allocator) : allocator_(graph->GetAllocator()), graph_(graph), - handles_(handles), dex_file_(dex_file), code_item_accessor_(accessor), return_type_(return_type), @@ -1436,7 +1434,7 @@ HClinitCheck* HInstructionBuilder::ProcessClinitCheckForInvoke( if (IsInitialized(klass)) { *clinit_check_requirement = HInvokeStaticOrDirect::ClinitCheckRequirement::kNone; } else { - Handle<mirror::Class> h_klass = handles_->NewHandle(klass); + Handle<mirror::Class> h_klass = graph_->GetHandleCache()->NewHandle(klass); HLoadClass* cls = BuildLoadClass(h_klass->GetDexTypeIndex(), h_klass->GetDexFile(), h_klass, @@ -1957,7 +1955,8 @@ void HInstructionBuilder::BuildStaticFieldAccess(const Instruction& instruction, DataType::Type field_type = GetFieldAccessType(*dex_file_, field_index); - Handle<mirror::Class> klass = handles_->NewHandle(resolved_field->GetDeclaringClass()); + Handle<mirror::Class> klass = + graph_->GetHandleCache()->NewHandle(resolved_field->GetDeclaringClass()); HLoadClass* constant = BuildLoadClass(klass->GetDexTypeIndex(), klass->GetDexFile(), klass, @@ -2207,7 +2206,7 @@ void HInstructionBuilder::BuildLoadString(dex::StringIndex string_index, uint32_ HSharpening::ProcessLoadString(load_string, code_generator_, *dex_compilation_unit_, - handles_); + graph_->GetHandleCache()->GetHandles()); AppendInstruction(load_string); } @@ -2235,7 +2234,7 @@ HLoadClass* HInstructionBuilder::BuildLoadClass(dex::TypeIndex type_index, } } - // Note: `klass` must be from `handles_`. + // Note: `klass` must be from `graph_->GetHandleCache()`. bool is_referrers_class = (klass != nullptr) && (outer_compilation_unit_->GetCompilingClass().Get() == klass.Get()); HLoadClass* load_class = new (allocator_) HLoadClass( @@ -2273,7 +2272,7 @@ Handle<mirror::Class> HInstructionBuilder::ResolveClass(ScopedObjectAccess& soa, DCHECK_EQ(klass == nullptr, soa.Self()->IsExceptionPending()); soa.Self()->ClearException(); // Clean up the exception left by type resolution if any. - Handle<mirror::Class> h_klass = handles_->NewHandle(klass); + Handle<mirror::Class> h_klass = graph_->GetHandleCache()->NewHandle(klass); class_cache_.Put(type_index, h_klass); return h_klass; } |