diff options
author | 2023-12-19 17:40:33 +0000 | |
---|---|---|
committer | 2023-12-21 12:19:34 +0000 | |
commit | a4fd8bb141fdb877bfd0d69700dad4e2859634a7 (patch) | |
tree | 8d95ef1ba0a2458786506e6b70ca0a5d48b8ac80 /compiler/optimizing/instruction_builder.cc | |
parent | e170e989bad0bcc3d178a679a692523e4b18786e (diff) |
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
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 16 |
1 files changed, 10 insertions, 6 deletions
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)); } |