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 | |
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')
-rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 20 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm_vixl.cc | 17 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_riscv64.cc | 20 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 28 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 32 | ||||
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 16 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 15 |
7 files changed, 100 insertions, 48 deletions
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 9027976165..f1c3a76bba 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -1195,7 +1195,8 @@ void LocationsBuilderARM64::VisitMethodExitHook(HMethodExitHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); DataType::Type return_type = method_hook->InputAt(0)->GetType(); - locations->SetInAt(0, ARM64ReturnLocation(return_type)); + locations->SetInAt(0, Location::Any()); + locations->SetInAt(1, ARM64ReturnLocation(return_type)); } void InstructionCodeGeneratorARM64::GenerateMethodEntryExitHook(HInstruction* instruction) { @@ -1247,17 +1248,24 @@ void InstructionCodeGeneratorARM64::GenerateMethodEntryExitHook(HInstruction* in __ ComputeAddress(addr, MemOperand(addr, index, LSL, TIMES_8)); Register tmp = index; + Register method_reg = tmp; + Location method_location = instruction->GetLocations()->InAt(0); + if (method_location.IsDoubleStackSlot()) { + __ Ldr(method_reg, StackOperandFrom(method_location)); + } else { + DCHECK(method_location.IsRegister()); + method_reg = XRegisterFrom(method_location); + } // Record method pointer and trace action. - __ Ldr(tmp, MemOperand(sp, 0)); // Use last two bits to encode trace method action. For MethodEntry it is 0 // so no need to set the bits since they are 0 already. if (instruction->IsMethodExitHook()) { DCHECK_GE(ArtMethod::Alignment(kRuntimePointerSize), static_cast<size_t>(4)); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodEnter) == 0); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodExit) == 1); - __ Orr(tmp, tmp, Operand(enum_cast<int32_t>(TraceAction::kTraceMethodExit))); + __ Orr(method_reg, method_reg, Operand(enum_cast<int32_t>(TraceAction::kTraceMethodExit))); } - __ Str(tmp, MemOperand(addr, kMethodOffsetInBytes)); + __ Str(method_reg, MemOperand(addr, kMethodOffsetInBytes)); // Record the timestamp. __ Mrs(tmp, (SystemRegister)SYS_CNTVCT_EL0); __ Str(tmp, MemOperand(addr, kTimestampOffsetInBytes)); @@ -1271,7 +1279,9 @@ void InstructionCodeGeneratorARM64::VisitMethodExitHook(HMethodExitHook* instruc } void LocationsBuilderARM64::VisitMethodEntryHook(HMethodEntryHook* method_hook) { - new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); + LocationSummary* locations = new (GetGraph()->GetAllocator()) + LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); + locations->SetInAt(0, Location::Any()); } void InstructionCodeGeneratorARM64::VisitMethodEntryHook(HMethodEntryHook* instruction) { diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc index 00c14b0b46..8680472044 100644 --- a/compiler/optimizing/code_generator_arm_vixl.cc +++ b/compiler/optimizing/code_generator_arm_vixl.cc @@ -2175,7 +2175,8 @@ void CodeGeneratorARMVIXL::ComputeSpillMask() { void LocationsBuilderARMVIXL::VisitMethodExitHook(HMethodExitHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); - locations->SetInAt(0, parameter_visitor_.GetReturnLocation(method_hook->InputAt(0)->GetType())); + locations->SetInAt(0, Location::Any()); + locations->SetInAt(1, parameter_visitor_.GetReturnLocation(method_hook->InputAt(0)->GetType())); // We need three temporary registers, two to load the timestamp counter (64-bit value) and one to // compute the address to store the timestamp counter. locations->AddRegisterTemps(3); @@ -2230,17 +2231,24 @@ void InstructionCodeGeneratorARMVIXL::GenerateMethodEntryExitHook(HInstruction* __ Ldr(addr, MemOperand(tr, Thread::TraceBufferPtrOffset<kArmPointerSize>().SizeValue())); __ Add(addr, addr, Operand(index, LSL, TIMES_4)); + vixl32::Register method_reg = tmp; + Location method_location = locations->InAt(0); + if (method_location.IsStackSlot()) { + GetAssembler()->LoadFromOffset(kLoadWord, method_reg, sp, method_location.GetStackIndex()); + } else { + DCHECK(method_location.IsRegister()); + method_reg = RegisterFrom(method_location); + } // Record method pointer and trace action. - __ Ldr(tmp, MemOperand(sp, 0)); // Use last two bits to encode trace method action. For MethodEntry it is 0 // so no need to set the bits since they are 0 already. if (instruction->IsMethodExitHook()) { DCHECK_GE(ArtMethod::Alignment(kRuntimePointerSize), static_cast<size_t>(4)); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodEnter) == 0); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodExit) == 1); - __ Orr(tmp, tmp, Operand(enum_cast<int32_t>(TraceAction::kTraceMethodExit))); + __ Orr(method_reg, method_reg, Operand(enum_cast<int32_t>(TraceAction::kTraceMethodExit))); } - __ Str(tmp, MemOperand(addr, kMethodOffsetInBytes)); + __ Str(method_reg, MemOperand(addr, kMethodOffsetInBytes)); vixl32::Register tmp1 = index; // See Architecture Reference Manual ARMv7-A and ARMv7-R edition section B4.1.34. @@ -2264,6 +2272,7 @@ void InstructionCodeGeneratorARMVIXL::VisitMethodExitHook(HMethodExitHook* instr void LocationsBuilderARMVIXL::VisitMethodEntryHook(HMethodEntryHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); + locations->SetInAt(0, Location::Any()); // We need three temporary registers, two to load the timestamp counter (64-bit value) and one to // compute the address to store the timestamp counter. locations->AddRegisterTemps(3); diff --git a/compiler/optimizing/code_generator_riscv64.cc b/compiler/optimizing/code_generator_riscv64.cc index 182c1d4d05..3b5d7f1cfc 100644 --- a/compiler/optimizing/code_generator_riscv64.cc +++ b/compiler/optimizing/code_generator_riscv64.cc @@ -2621,18 +2621,25 @@ void InstructionCodeGeneratorRISCV64::GenerateMethodEntryExitHook(HInstruction* __ Loadd(tmp2, TR, Thread::TraceBufferPtrOffset<kRiscv64PointerSize>().SizeValue()); __ Sh3Add(tmp, tmp, tmp2); + XRegister method = tmp2; + Location method_location = instruction->GetLocations()->InAt(0); + if (method_location.IsDoubleStackSlot()) { + __ Ld(method, SP, method_location.GetStackIndex()); + } else { + DCHECK(method_location.IsRegister()); + method = method_location.AsRegister<XRegister>(); + } // Record method pointer and trace action. - __ Ld(tmp2, SP, 0); // Use last two bits to encode trace method action. For MethodEntry it is 0 // so no need to set the bits since they are 0 already. DCHECK_GE(ArtMethod::Alignment(kRuntimePointerSize), static_cast<size_t>(4)); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodEnter) == 0); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodExit) == 1); if (instruction->IsMethodExitHook()) { - __ Ori(tmp2, tmp2, enum_cast<int32_t>(TraceAction::kTraceMethodExit)); + __ Ori(method, method, enum_cast<int32_t>(TraceAction::kTraceMethodExit)); } static_assert(IsInt<12>(kMethodOffsetInBytes)); // No free scratch register for `Stored()`. - __ Sd(tmp2, tmp, kMethodOffsetInBytes); + __ Sd(method, tmp, kMethodOffsetInBytes); // Record the timestamp. __ RdTime(tmp2); @@ -4462,7 +4469,9 @@ void InstructionCodeGeneratorRISCV64::VisitMemoryBarrier(HMemoryBarrier* instruc } void LocationsBuilderRISCV64::VisitMethodEntryHook(HMethodEntryHook* instruction) { - new (GetGraph()->GetAllocator()) LocationSummary(instruction, LocationSummary::kCallOnSlowPath); + LocationSummary* locations = new (GetGraph()->GetAllocator()) + LocationSummary(instruction, LocationSummary::kCallOnSlowPath); + locations->SetInAt(0, Location::Any()); } void InstructionCodeGeneratorRISCV64::VisitMethodEntryHook(HMethodEntryHook* instruction) { @@ -4475,7 +4484,8 @@ void LocationsBuilderRISCV64::VisitMethodExitHook(HMethodExitHook* instruction) LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(instruction, LocationSummary::kCallOnSlowPath); DataType::Type return_type = instruction->InputAt(0)->GetType(); - locations->SetInAt(0, Riscv64ReturnLocation(return_type)); + locations->SetInAt(0, Location::Any()); + locations->SetInAt(1, Riscv64ReturnLocation(return_type)); } void InstructionCodeGeneratorRISCV64::VisitMethodExitHook(HMethodExitHook* instruction) { diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 71db5c99af..979715f375 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -1195,8 +1195,8 @@ static dwarf::Reg DWARFReg(Register reg) { return dwarf::Reg::X86Core(static_cast<int>(reg)); } -void SetInForReturnValue(HInstruction* ret, LocationSummary* locations) { - switch (ret->InputAt(0)->GetType()) { +void SetInForReturnValue(HInstruction* ret, LocationSummary* locations, int input_index) { + switch (ret->InputAt(input_index)->GetType()) { case DataType::Type::kReference: case DataType::Type::kBool: case DataType::Type::kUint8: @@ -1204,31 +1204,32 @@ void SetInForReturnValue(HInstruction* ret, LocationSummary* locations) { case DataType::Type::kUint16: case DataType::Type::kInt16: case DataType::Type::kInt32: - locations->SetInAt(0, Location::RegisterLocation(EAX)); + locations->SetInAt(input_index, Location::RegisterLocation(EAX)); break; case DataType::Type::kInt64: - locations->SetInAt(0, Location::RegisterPairLocation(EAX, EDX)); + locations->SetInAt(input_index, Location::RegisterPairLocation(EAX, EDX)); break; case DataType::Type::kFloat32: case DataType::Type::kFloat64: - locations->SetInAt(0, Location::FpuRegisterLocation(XMM0)); + locations->SetInAt(input_index, Location::FpuRegisterLocation(XMM0)); break; case DataType::Type::kVoid: - locations->SetInAt(0, Location::NoLocation()); + locations->SetInAt(input_index, Location::NoLocation()); break; default: - LOG(FATAL) << "Unknown return type " << ret->InputAt(0)->GetType(); + LOG(FATAL) << "Unknown return type " << ret->InputAt(input_index)->GetType(); } } void LocationsBuilderX86::VisitMethodExitHook(HMethodExitHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); - SetInForReturnValue(method_hook, locations); + locations->SetInAt(0, Location::Any()); + SetInForReturnValue(method_hook, locations, /* input_index= */ 1); // We use rdtsc to obtain a timestamp for tracing. rdtsc returns the results in EAX + EDX. locations->AddTemp(Location::RegisterLocation(EAX)); locations->AddTemp(Location::RegisterLocation(EDX)); @@ -1287,7 +1288,13 @@ void InstructionCodeGeneratorX86::GenerateMethodEntryExitHook(HInstruction* inst // Record method pointer and trace action. Register method = index; - __ movl(method, Address(ESP, kCurrentMethodStackOffset)); + Location method_location = locations->InAt(0); + if (method_location.IsStackSlot()) { + __ movl(method, Address(ESP, method_location.GetStackIndex())); + } else { + DCHECK(method_location.IsRegister()); + method = method_location.AsRegister<Register>(); + } // Use last two bits to encode trace method action. For MethodEntry it is 0 // so no need to set the bits since they are 0 already. if (instruction->IsMethodExitHook()) { @@ -1313,6 +1320,7 @@ void InstructionCodeGeneratorX86::VisitMethodExitHook(HMethodExitHook* instructi void LocationsBuilderX86::VisitMethodEntryHook(HMethodEntryHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); + locations->SetInAt(0, Location::Any()); // We use rdtsc to obtain a timestamp for tracing. rdtsc returns the results in EAX + EDX. locations->AddTemp(Location::RegisterLocation(EAX)); locations->AddTemp(Location::RegisterLocation(EDX)); @@ -2680,7 +2688,7 @@ void InstructionCodeGeneratorX86::VisitReturnVoid([[maybe_unused]] HReturnVoid* void LocationsBuilderX86::VisitReturn(HReturn* ret) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(ret, LocationSummary::kNoCall); - SetInForReturnValue(ret, locations); + SetInForReturnValue(ret, locations, /* input_index= */ 0); } void InstructionCodeGeneratorX86::VisitReturn(HReturn* ret) { diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 81ffa9876c..cb40cc4aa3 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -1595,6 +1595,7 @@ static dwarf::Reg DWARFReg(FloatRegister reg) { void LocationsBuilderX86_64::VisitMethodEntryHook(HMethodEntryHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); + locations->SetInAt(0, Location::Any()); // We use rdtsc to record the timestamp for method profiling. rdtsc returns // two 32-bit values in EAX + EDX even on 64-bit architectures. locations->AddTemp(Location::RegisterLocation(RAX)); @@ -1631,7 +1632,7 @@ void InstructionCodeGeneratorX86_64::GenerateMethodEntryExitHook(HInstruction* i __ j(kGreater, slow_path->GetEntryLabel()); // Check if there is place in the buffer for a new entry, if no, take slow path. - CpuRegister index = locations->GetTemp(0).AsRegister<CpuRegister>(); + Register index = locations->GetTemp(0).AsRegister<Register>(); CpuRegister entry_addr = CpuRegister(TMP); uint64_t trace_buffer_index_offset = Thread::TraceBufferIndexOffset<kX86_64PointerSize>().SizeValue(); @@ -1652,15 +1653,21 @@ void InstructionCodeGeneratorX86_64::GenerateMethodEntryExitHook(HInstruction* i Address(CpuRegister(entry_addr), CpuRegister(index), TIMES_8, 0)); // Record method pointer and action. - CpuRegister method = index; - __ movq(CpuRegister(method), Address(CpuRegister(RSP), kCurrentMethodStackOffset)); + Register method = index; + Location method_location = locations->InAt(0); + if (method_location.IsDoubleStackSlot()) { + __ movq(CpuRegister(method), Address(CpuRegister(RSP), method_location.GetStackIndex())); + } else { + DCHECK(method_location.IsRegister()) << method_location; + method = method_location.AsRegister<Register>(); + } // Use last two bits to encode trace method action. For MethodEntry it is 0 // so no need to set the bits since they are 0 already. if (instruction->IsMethodExitHook()) { DCHECK_GE(ArtMethod::Alignment(kRuntimePointerSize), static_cast<size_t>(4)); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodEnter) == 0); static_assert(enum_cast<int32_t>(TraceAction::kTraceMethodExit) == 1); - __ orq(method, Immediate(enum_cast<int32_t>(TraceAction::kTraceMethodExit))); + __ orq(CpuRegister(method), Immediate(enum_cast<int32_t>(TraceAction::kTraceMethodExit))); } __ movq(Address(entry_addr, kMethodOffsetInBytes), CpuRegister(method)); // Get the timestamp. rdtsc returns timestamp in RAX + RDX even in 64-bit architectures. @@ -1677,8 +1684,8 @@ void InstructionCodeGeneratorX86_64::VisitMethodEntryHook(HMethodEntryHook* inst GenerateMethodEntryExitHook(instruction); } -void SetInForReturnValue(HInstruction* instr, LocationSummary* locations) { - switch (instr->InputAt(0)->GetType()) { +void SetInForReturnValue(HInstruction* instr, LocationSummary* locations, int input_index) { + switch (instr->InputAt(input_index)->GetType()) { case DataType::Type::kReference: case DataType::Type::kBool: case DataType::Type::kUint8: @@ -1687,27 +1694,28 @@ void SetInForReturnValue(HInstruction* instr, LocationSummary* locations) { case DataType::Type::kInt16: case DataType::Type::kInt32: case DataType::Type::kInt64: - locations->SetInAt(0, Location::RegisterLocation(RAX)); + locations->SetInAt(input_index, Location::RegisterLocation(RAX)); break; case DataType::Type::kFloat32: case DataType::Type::kFloat64: - locations->SetInAt(0, Location::FpuRegisterLocation(XMM0)); + locations->SetInAt(input_index, Location::FpuRegisterLocation(XMM0)); break; case DataType::Type::kVoid: - locations->SetInAt(0, Location::NoLocation()); + locations->SetInAt(input_index, Location::NoLocation()); break; default: - LOG(FATAL) << "Unexpected return type " << instr->InputAt(0)->GetType(); + LOG(FATAL) << "Unexpected return type " << instr->InputAt(input_index)->GetType(); } } void LocationsBuilderX86_64::VisitMethodExitHook(HMethodExitHook* method_hook) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(method_hook, LocationSummary::kCallOnSlowPath); - SetInForReturnValue(method_hook, locations); + locations->SetInAt(0, Location::Any()); + SetInForReturnValue(method_hook, locations, /* input_index= */ 1); // We use rdtsc to record the timestamp for method profiling. rdtsc returns // two 32-bit values in EAX + EDX even on 64-bit architectures. locations->AddTemp(Location::RegisterLocation(RAX)); @@ -2829,7 +2837,7 @@ void InstructionCodeGeneratorX86_64::VisitReturnVoid([[maybe_unused]] HReturnVoi void LocationsBuilderX86_64::VisitReturn(HReturn* ret) { LocationSummary* locations = new (GetGraph()->GetAllocator()) LocationSummary(ret, LocationSummary::kNoCall); - SetInForReturnValue(ret, locations); + SetInForReturnValue(ret, locations, /* input_index= */ 0); } void InstructionCodeGeneratorX86_64::VisitReturn(HReturn* ret) { 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)); } diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index d84ff7be73..fceff877f1 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -3059,10 +3059,12 @@ class HExpression<0> : public HInstruction { friend class SsaBuilder; }; -class HMethodEntryHook : public HExpression<0> { +class HMethodEntryHook : public HExpression<1> { public: - explicit HMethodEntryHook(uint32_t dex_pc) - : HExpression(kMethodEntryHook, SideEffects::All(), dex_pc) {} + HMethodEntryHook(HInstruction* method, uint32_t dex_pc) + : HExpression(kMethodEntryHook, SideEffects::All(), dex_pc) { + SetRawInputAt(0, method); + } bool NeedsEnvironment() const override { return true; @@ -3076,11 +3078,12 @@ class HMethodEntryHook : public HExpression<0> { DEFAULT_COPY_CONSTRUCTOR(MethodEntryHook); }; -class HMethodExitHook : public HExpression<1> { +class HMethodExitHook : public HExpression<2> { public: - HMethodExitHook(HInstruction* value, uint32_t dex_pc) + HMethodExitHook(HInstruction* method, HInstruction* value, uint32_t dex_pc) : HExpression(kMethodExitHook, SideEffects::All(), dex_pc) { - SetRawInputAt(0, value); + SetRawInputAt(0, method); + SetRawInputAt(1, value); } bool NeedsEnvironment() const override { |