From a4fd8bb141fdb877bfd0d69700dad4e2859634a7 Mon Sep 17 00:00:00 2001 From: Mythri Alle Date: Tue, 19 Dec 2023 17:40:33 +0000 Subject: Use GetCurrentMethod to get the current method when tracing The current method is passed in a register and we can use the GetCurrentMethod as an input to the method entry / exit hooks. In most cases we may just have the current method in the register on method entry. Bug: 259258187 Test: art/test.py Change-Id: Iea75f41b0ec5ebbc2aef857c84f39846b594e8e7 --- compiler/optimizing/instruction_builder.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 281da6f9ec..7dd1397215 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -378,7 +378,7 @@ bool HInstructionBuilder::Build() { InitializeParameters(); AppendInstruction(new (allocator_) HSuspendCheck(0u)); if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) { - AppendInstruction(new (allocator_) HMethodEntryHook(0u)); + AppendInstruction(new (allocator_) HMethodEntryHook(graph_->GetCurrentMethod(), 0u)); } AppendInstruction(new (allocator_) HGoto(0u)); continue; @@ -470,7 +470,7 @@ void HInstructionBuilder::BuildIntrinsic(ArtMethod* method) { InitializeBlockLocals(); InitializeParameters(); if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) { - AppendInstruction(new (allocator_) HMethodEntryHook(0u)); + AppendInstruction(new (allocator_) HMethodEntryHook(graph_->GetCurrentMethod(), 0u)); } AppendInstruction(new (allocator_) HGoto(0u)); @@ -515,12 +515,14 @@ void HInstructionBuilder::BuildIntrinsic(ArtMethod* method) { // Add the return instruction. if (return_type_ == DataType::Type::kVoid) { if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) { - AppendInstruction(new (allocator_) HMethodExitHook(graph_->GetNullConstant(), kNoDexPc)); + AppendInstruction(new (allocator_) HMethodExitHook( + graph_->GetCurrentMethod(), graph_->GetNullConstant(), kNoDexPc)); } AppendInstruction(new (allocator_) HReturnVoid()); } else { if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) { - AppendInstruction(new (allocator_) HMethodExitHook(latest_result_, kNoDexPc)); + AppendInstruction(new (allocator_) + HMethodExitHook(graph_->GetCurrentMethod(), latest_result_, kNoDexPc)); } AppendInstruction(new (allocator_) HReturn(latest_result_)); } @@ -857,14 +859,16 @@ void HInstructionBuilder::BuildReturn(const Instruction& instruction, if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) { // Return value is not used for void functions. We pass NullConstant to // avoid special cases when generating code. - AppendInstruction(new (allocator_) HMethodExitHook(graph_->GetNullConstant(), dex_pc)); + AppendInstruction(new (allocator_) HMethodExitHook( + graph_->GetCurrentMethod(), graph_->GetNullConstant(), dex_pc)); } AppendInstruction(new (allocator_) HReturnVoid(dex_pc)); } else { DCHECK(!RequiresConstructorBarrier(dex_compilation_unit_)); HInstruction* value = LoadLocal(instruction.VRegA(), type); if (graph_->IsDebuggable() && code_generator_->GetCompilerOptions().IsJitCompiler()) { - AppendInstruction(new (allocator_) HMethodExitHook(value, dex_pc)); + AppendInstruction(new (allocator_) HMethodExitHook( + graph_->GetCurrentMethod(), value, dex_pc)); } AppendInstruction(new (allocator_) HReturn(value, dex_pc)); } -- cgit v1.2.3-59-g8ed1b