diff options
author | 2022-06-24 10:03:30 +0100 | |
---|---|---|
committer | 2022-08-09 10:45:00 +0000 | |
commit | caf9b6583272b90fc522cd445172ae97520dbe18 (patch) | |
tree | 7f7183894894c4cac7b8d5acfd2224ef21b3af6c /compiler | |
parent | c6b816ceb2b35300c937ef2e7d008598b6afba21 (diff) |
Rename HNativeDebugInfo to HNop
We can generalize HNativeDebugInfo to be used as a Nop (i.e. no
instructions are generated), and give it the option of having an
environment to keep the current HNativeDebugInfo logic working.
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Change-Id: I06b3a36e8b124bcda858d2c9cd8ff0ab21caea36
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm64.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_arm_vixl.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/code_generator_x86_64.cc | 8 | ||||
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 2 | ||||
-rw-r--r-- | compiler/optimizing/nodes.h | 25 | ||||
-rw-r--r-- | compiler/optimizing/scheduler.cc | 2 |
8 files changed, 34 insertions, 29 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index d8fc3ba690..af08ddd150 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -413,7 +413,7 @@ void CodeGenerator::Compile(CodeAllocator* allocator) { for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { HInstruction* current = it.Current(); if (current->HasEnvironment()) { - // Create stackmap for HNativeDebugInfo or any instruction which calls native code. + // Create stackmap for HNop or any instruction which calls native code. // Note that we need correct mapping for the native PC of the call instruction, // so the runtime's stackmap is not sufficient since it is at PC after the call. MaybeRecordNativeDebugInfo(current, block->GetDexPc()); diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index 2f8c0b22e7..d3031b71e5 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -3852,12 +3852,12 @@ void InstructionCodeGeneratorARM64::VisitSelect(HSelect* select) { } } -void LocationsBuilderARM64::VisitNativeDebugInfo(HNativeDebugInfo* info) { - new (GetGraph()->GetAllocator()) LocationSummary(info); +void LocationsBuilderARM64::VisitNop(HNop* nop) { + new (GetGraph()->GetAllocator()) LocationSummary(nop); } -void InstructionCodeGeneratorARM64::VisitNativeDebugInfo(HNativeDebugInfo*) { - // MaybeRecordNativeDebugInfo is already called implicitly in CodeGenerator::Compile. +void InstructionCodeGeneratorARM64::VisitNop(HNop*) { + // The environment recording already happened in CodeGenerator::Compile. } void CodeGeneratorARM64::IncreaseFrame(size_t adjustment) { diff --git a/compiler/optimizing/code_generator_arm_vixl.cc b/compiler/optimizing/code_generator_arm_vixl.cc index 09fa598203..00a6c837d9 100644 --- a/compiler/optimizing/code_generator_arm_vixl.cc +++ b/compiler/optimizing/code_generator_arm_vixl.cc @@ -3069,12 +3069,12 @@ void InstructionCodeGeneratorARMVIXL::VisitSelect(HSelect* select) { } } -void LocationsBuilderARMVIXL::VisitNativeDebugInfo(HNativeDebugInfo* info) { - new (GetGraph()->GetAllocator()) LocationSummary(info); +void LocationsBuilderARMVIXL::VisitNop(HNop* nop) { + new (GetGraph()->GetAllocator()) LocationSummary(nop); } -void InstructionCodeGeneratorARMVIXL::VisitNativeDebugInfo(HNativeDebugInfo*) { - // MaybeRecordNativeDebugInfo is already called implicitly in CodeGenerator::Compile. +void InstructionCodeGeneratorARMVIXL::VisitNop(HNop*) { + // The environment recording already happened in CodeGenerator::Compile. } void CodeGeneratorARMVIXL::IncreaseFrame(size_t adjustment) { diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 8c6b8027cd..8c4a11c5ed 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -2230,12 +2230,12 @@ void InstructionCodeGeneratorX86::VisitSelect(HSelect* select) { } } -void LocationsBuilderX86::VisitNativeDebugInfo(HNativeDebugInfo* info) { - new (GetGraph()->GetAllocator()) LocationSummary(info); +void LocationsBuilderX86::VisitNop(HNop* nop) { + new (GetGraph()->GetAllocator()) LocationSummary(nop); } -void InstructionCodeGeneratorX86::VisitNativeDebugInfo(HNativeDebugInfo*) { - // MaybeRecordNativeDebugInfo is already called implicitly in CodeGenerator::Compile. +void InstructionCodeGeneratorX86::VisitNop(HNop*) { + // The environment recording already happened in CodeGenerator::Compile. } void CodeGeneratorX86::IncreaseFrame(size_t adjustment) { diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 511917a735..5987410893 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -2274,12 +2274,12 @@ void InstructionCodeGeneratorX86_64::VisitSelect(HSelect* select) { } } -void LocationsBuilderX86_64::VisitNativeDebugInfo(HNativeDebugInfo* info) { - new (GetGraph()->GetAllocator()) LocationSummary(info); +void LocationsBuilderX86_64::VisitNop(HNop* nop) { + new (GetGraph()->GetAllocator()) LocationSummary(nop); } -void InstructionCodeGeneratorX86_64::VisitNativeDebugInfo(HNativeDebugInfo*) { - // MaybeRecordNativeDebugInfo is already called implicitly in CodeGenerator::Compile. +void InstructionCodeGeneratorX86_64::VisitNop(HNop*) { + // The environment recording already happened in CodeGenerator::Compile. } void CodeGeneratorX86_64::IncreaseFrame(size_t adjustment) { diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index e0bdd0963c..605427ba11 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -414,7 +414,7 @@ bool HInstructionBuilder::Build() { } if (native_debuggable && native_debug_info_locations->IsBitSet(dex_pc)) { - AppendInstruction(new (allocator_) HNativeDebugInfo(dex_pc)); + AppendInstruction(new (allocator_) HNop(dex_pc, /* needs_environment= */ true)); } // Note: There may be no Thread for gtests. diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index ed2f2111b2..103d318710 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -1565,10 +1565,10 @@ class HLoopInformationOutwardIterator : public ValueObject { M(Min, BinaryOperation) \ M(MonitorOperation, Instruction) \ M(Mul, BinaryOperation) \ - M(NativeDebugInfo, Instruction) \ M(Neg, UnaryOperation) \ M(NewArray, Instruction) \ M(NewInstance, Instruction) \ + M(Nop, Instruction) \ M(Not, UnaryOperation) \ M(NotEqual, Condition) \ M(NullConstant, Instruction) \ @@ -2433,7 +2433,7 @@ class HInstruction : public ArenaObject<kArenaAllocInstruction> { !CanThrow() && !IsSuspendCheck() && !IsControlFlow() && - !IsNativeDebugInfo() && + !IsNop() && !IsParameterValue() && // If we added an explicit barrier then we should keep it. !IsMemoryBarrier() && @@ -6783,22 +6783,27 @@ class HSuspendCheck final : public HExpression<0> { SlowPathCode* slow_path_; }; -// Pseudo-instruction which provides the native debugger with mapping information. -// It ensures that we can generate line number and local variables at this point. -class HNativeDebugInfo : public HExpression<0> { +// Pseudo-instruction which doesn't generate any code. +// If `emit_environment` is true, it can be used to generate an environment. It is used, for +// example, to provide the native debugger with mapping information. It ensures that we can generate +// line number and local variables at this point. +class HNop : public HExpression<0> { public: - explicit HNativeDebugInfo(uint32_t dex_pc) - : HExpression<0>(kNativeDebugInfo, SideEffects::None(), dex_pc) { + explicit HNop(uint32_t dex_pc, bool needs_environment) + : HExpression<0>(kNop, SideEffects::None(), dex_pc), needs_environment_(needs_environment) { } bool NeedsEnvironment() const override { - return true; + return needs_environment_; } - DECLARE_INSTRUCTION(NativeDebugInfo); + DECLARE_INSTRUCTION(Nop); protected: - DEFAULT_COPY_CONSTRUCTOR(NativeDebugInfo); + DEFAULT_COPY_CONSTRUCTOR(Nop); + + private: + bool needs_environment_; }; /** diff --git a/compiler/optimizing/scheduler.cc b/compiler/optimizing/scheduler.cc index 8f18ccff5f..d228aba95a 100644 --- a/compiler/optimizing/scheduler.cc +++ b/compiler/optimizing/scheduler.cc @@ -718,7 +718,7 @@ bool HScheduler::IsSchedulable(const HInstruction* instruction) const { // HLoadException // HMemoryBarrier // HMonitorOperation - // HNativeDebugInfo + // HNop // HThrow // HTryBoundary // TODO: Some of the instructions above may be safe to schedule (maybe as |