From 3e75615ad25b6af1842b194e78b429b0f585b46a Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Thu, 8 Aug 2024 15:33:56 +0000 Subject: Calculate the number of out vregs. Determine the number of out vregs needed by invokes that actually make a call, and by `HStringBuilderAppend`s. This can yield smaller frame sizes of compiled methods when some calls are inlined or fully intrinsified. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 358519867 Change-Id: I4930a9bd811b1de14658f5ef44e65eadea6a7961 --- compiler/optimizing/instruction_builder.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index c97c78ca17..5cdefd9717 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -501,6 +501,7 @@ void HInstructionBuilder::BuildIntrinsic(ArtMethod* method) { HInvokeStaticOrDirect* invoke = new (allocator_) HInvokeStaticOrDirect( allocator_, number_of_arguments, + /* number_of_out_vregs= */ in_vregs, return_type_, kNoDexPc, target_method, @@ -1066,6 +1067,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction, MethodCompilationStat::kUnresolvedMethod); HInvoke* invoke = new (allocator_) HInvokeUnresolved(allocator_, number_of_arguments, + operands.GetNumberOfOperands(), return_type, dex_pc, method_reference, @@ -1086,6 +1088,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction, HInvoke* invoke = new (allocator_) HInvokeStaticOrDirect( allocator_, number_of_arguments - 1, + operands.GetNumberOfOperands() - 1, /* return_type= */ DataType::Type::kReference, dex_pc, method_reference, @@ -1151,6 +1154,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction, } invoke = new (allocator_) HInvokeStaticOrDirect(allocator_, number_of_arguments, + operands.GetNumberOfOperands(), return_type, dex_pc, method_reference, @@ -1170,6 +1174,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction, } else if (invoke_type == kVirtual) { invoke = new (allocator_) HInvokeVirtual(allocator_, number_of_arguments, + operands.GetNumberOfOperands(), return_type, dex_pc, method_reference, @@ -1191,6 +1196,7 @@ bool HInstructionBuilder::BuildInvoke(const Instruction& instruction, .method_load_kind; invoke = new (allocator_) HInvokeInterface(allocator_, number_of_arguments, + operands.GetNumberOfOperands(), return_type, dex_pc, method_reference, @@ -1392,6 +1398,7 @@ bool HInstructionBuilder::BuildInvokePolymorphic(uint32_t dex_pc, MethodReference method_reference(&graph_->GetDexFile(), method_idx); HInvoke* invoke = new (allocator_) HInvokePolymorphic(allocator_, number_of_arguments, + operands.GetNumberOfOperands(), return_type, dex_pc, method_reference, @@ -1433,6 +1440,7 @@ bool HInstructionBuilder::BuildInvokeCustom(uint32_t dex_pc, MethodReference method_reference(&graph_->GetDexFile(), dex::kDexNoIndex); HInvoke* invoke = new (allocator_) HInvokeCustom(allocator_, number_of_arguments, + operands.GetNumberOfOperands(), call_site_idx, return_type, dex_pc, -- cgit v1.2.3-59-g8ed1b