diff options
author | 2024-03-11 09:31:10 +0000 | |
---|---|---|
committer | 2024-03-14 08:47:37 +0000 | |
commit | 68f7caffe7a2e7d728d5447b28cf8c422be46748 (patch) | |
tree | 68e927688ed734bdf16161e52297008b61733c0c | |
parent | 41f264abe76acb4f7cb545471cbbfbc30e3101ca (diff) |
Make sure there are no lone UNREACHABLEs
Either remove them, or add a LOG(FATAL) before them.
Bug: 328756212
Test: art/test/testrunner/testrunner.py --host --64 --optimizing -b
Test: m test-art-host-gtest
Change-Id: Ibf2bddb0a4add5a844a515a040b3751acc7faf84
26 files changed, 48 insertions, 51 deletions
diff --git a/compiler/optimizing/code_generator_riscv64.cc b/compiler/optimizing/code_generator_riscv64.cc index abbd74ac65..451481bceb 100644 --- a/compiler/optimizing/code_generator_riscv64.cc +++ b/compiler/optimizing/code_generator_riscv64.cc @@ -122,7 +122,6 @@ Location Riscv64ReturnLocation(DataType::Type return_type) { case DataType::Type::kVoid: return Location::NoLocation(); } - UNREACHABLE(); } static RegisterSet OneRegInReferenceOutSaveEverythingCallerSaves() { diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 21d3492e8a..55fb4ee3d3 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -1506,8 +1506,6 @@ Location InvokeDexCallingConventionVisitorX86::GetReturnLocation(DataType::Type case DataType::Type::kFloat32: return Location::FpuRegisterLocation(XMM0); } - - UNREACHABLE(); } Location InvokeDexCallingConventionVisitorX86::GetMethodLocation() const { diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index af6c6255e5..f94514e08e 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -2950,8 +2950,6 @@ Location InvokeDexCallingConventionVisitorX86_64::GetReturnLocation(DataType::Ty case DataType::Type::kFloat32: return Location::FpuRegisterLocation(XMM0); } - - UNREACHABLE(); } Location InvokeDexCallingConventionVisitorX86_64::GetMethodLocation() const { diff --git a/compiler/optimizing/inliner.cc b/compiler/optimizing/inliner.cc index 0fd3eeab2e..02cf8a4052 100644 --- a/compiler/optimizing/inliner.cc +++ b/compiler/optimizing/inliner.cc @@ -684,7 +684,6 @@ bool HInliner::TryInlineFromInlineCache(HInvoke* invoke_instruction) return false; } } - UNREACHABLE(); } HInliner::InlineCacheType HInliner::GetInlineCacheJIT( diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc index b21f36cfcf..62efeb1d8c 100644 --- a/compiler/optimizing/intrinsics_x86.cc +++ b/compiler/optimizing/intrinsics_x86.cc @@ -3816,7 +3816,7 @@ static void GenerateVarHandleCommonChecks(HInvoke *invoke, break; } default: - // Unimplemented + LOG(FATAL) << "Unexpected coordinates count: " << expected_coordinates_count; UNREACHABLE(); } @@ -4350,6 +4350,7 @@ static void GenerateVarHandleGetAndSet(HInvoke* invoke, CodeGeneratorX86* codege break; } default: + LOG(FATAL) << "Unexpected type: " << value_type; UNREACHABLE(); } @@ -4688,6 +4689,7 @@ static void GenerateVarHandleGetAndAdd(HInvoke* invoke, CodeGeneratorX86* codege break; } default: + LOG(FATAL) << "Unexpected type: " << type; UNREACHABLE(); } @@ -4782,6 +4784,7 @@ static void GenerateBitwiseOp(HInvoke* invoke, __ andl(left, right); break; default: + LOG(FATAL) << "Unexpected intrinsic: " << invoke->GetIntrinsic(); UNREACHABLE(); } } diff --git a/compiler/optimizing/intrinsics_x86_64.cc b/compiler/optimizing/intrinsics_x86_64.cc index 1876a70541..598b95867e 100644 --- a/compiler/optimizing/intrinsics_x86_64.cc +++ b/compiler/optimizing/intrinsics_x86_64.cc @@ -4493,7 +4493,7 @@ static void GenerateVarHandleGetAndSet(HInvoke* invoke, __ xchgq(valreg, field_addr); break; default: - DCHECK(false) << "unexpected type in getAndSet intrinsic"; + LOG(FATAL) << "unexpected type in getAndSet intrinsic: " << type; UNREACHABLE(); } if (byte_swap) { @@ -4600,7 +4600,7 @@ static void GenerateVarHandleGetAndOp(HInvoke* invoke, } break; default: - DCHECK(false) << "unexpected operation"; + LOG(FATAL) << "unexpected operation"; UNREACHABLE(); } @@ -4628,7 +4628,7 @@ static void GenerateVarHandleGetAndOp(HInvoke* invoke, __ LockCmpxchgq(field_addr, temp); break; default: - DCHECK(false) << "unexpected type in getAndBitwiseOp intrinsic"; + LOG(FATAL) << "unexpected type in getAndBitwiseOp intrinsic"; UNREACHABLE(); } @@ -4800,7 +4800,7 @@ static void GenerateVarHandleGetAndAdd(HInvoke* invoke, __ LockXaddq(field_addr, valreg); break; default: - DCHECK(false) << "unexpected type in getAndAdd intrinsic"; + LOG(FATAL) << "unexpected type in getAndAdd intrinsic"; UNREACHABLE(); } } diff --git a/compiler/optimizing/loop_optimization.cc b/compiler/optimizing/loop_optimization.cc index f6d69ca789..28712302c5 100644 --- a/compiler/optimizing/loop_optimization.cc +++ b/compiler/optimizing/loop_optimization.cc @@ -2455,13 +2455,9 @@ HInstruction* HLoopOptimization::GenerateVecOp(HInstruction* org, new (global_allocator_) HAbs(org_type, opa, dex_pc)); case HInstruction::kEqual: { // Special case. - if (vector_mode_ == kVector) { - vector = new (global_allocator_) HVecCondition( - global_allocator_, opa, opb, type, vector_length_, dex_pc); - } else { - DCHECK(vector_mode_ == kSequential); - UNREACHABLE(); - } + DCHECK_EQ(vector_mode_, kVector); + vector = new (global_allocator_) + HVecCondition(global_allocator_, opa, opb, type, vector_length_, dex_pc); } break; default: @@ -2772,19 +2768,14 @@ bool HLoopOptimization::VectorizeIfCondition(LoopNode* node, vector_map_->Get(opa_promoted), vector_map_->Get(opb_promoted), type); + DCHECK_EQ(vector_mode_, kVector); + HInstruction* vec_pred_not = new (global_allocator_) + HVecPredNot(global_allocator_, vec_cond, type, vector_length_, hif->GetDexPc()); - if (vector_mode_ == kVector) { - HInstruction* vec_pred_not = new (global_allocator_) HVecPredNot( - global_allocator_, vec_cond, type, vector_length_, hif->GetDexPc()); - - vector_map_->Put(hif, vec_pred_not); - BlockPredicateInfo* pred_info = predicate_info_map_->Get(hif->GetBlock()); - pred_info->SetControlFlowInfo(vec_cond->AsVecPredSetOperation(), - vec_pred_not->AsVecPredSetOperation()); - } else { - DCHECK(vector_mode_ == kSequential); - UNREACHABLE(); - } + vector_map_->Put(hif, vec_pred_not); + BlockPredicateInfo* pred_info = predicate_info_map_->Get(hif->GetBlock()); + pred_info->SetControlFlowInfo(vec_cond->AsVecPredSetOperation(), + vec_pred_not->AsVecPredSetOperation()); } return true; } @@ -3140,6 +3131,7 @@ void HLoopOptimization::InitPredicateInfoMap(LoopNode* node, return; } } + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } diff --git a/compiler/optimizing/loop_optimization.h b/compiler/optimizing/loop_optimization.h index 86a9f0fcb8..2bf32ac095 100644 --- a/compiler/optimizing/loop_optimization.h +++ b/compiler/optimizing/loop_optimization.h @@ -108,6 +108,7 @@ class HLoopOptimization : public HOptimization { * Vectorization mode during synthesis * (sequential peeling/cleanup loop or vector loop). */ + // TODO(solanes): Change this into enum class enum VectorMode { kSequential, kVector diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc index 0e5de00f97..f532681527 100644 --- a/compiler/optimizing/optimizing_compiler.cc +++ b/compiler/optimizing/optimizing_compiler.cc @@ -897,6 +897,7 @@ CodeGenerator* OptimizingCompiler::TryCompile(ArenaAllocator* allocator, break; } case kAnalysisSuccess: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } pass_observer.SetGraphInBadState(); diff --git a/compiler/utils/atomic_dex_ref_map-inl.h b/compiler/utils/atomic_dex_ref_map-inl.h index 5f68a7c701..653d21b3ea 100644 --- a/compiler/utils/atomic_dex_ref_map-inl.h +++ b/compiler/utils/atomic_dex_ref_map-inl.h @@ -46,7 +46,6 @@ inline size_t AtomicDexRefMap<DexFileReferenceType, Value>::NumberOfDexIndices( if (std::is_same<DexFileReferenceType, TypeReference>::value) { return dex_file->NumTypeIds(); } - UNREACHABLE(); } template <typename DexFileReferenceType, typename Value> diff --git a/compiler/utils/x86_64/assembler_x86_64.h b/compiler/utils/x86_64/assembler_x86_64.h index 7f80dbccf7..b7475cd367 100644 --- a/compiler/utils/x86_64/assembler_x86_64.h +++ b/compiler/utils/x86_64/assembler_x86_64.h @@ -122,7 +122,7 @@ class Operand : public ValueObject { return disp32(); default: // Mod 11b means reg/reg, so there is no address and consequently no displacement. - DCHECK(false) << "there is no displacement in x86_64 reg/reg operand"; + LOG(FATAL) << "there is no displacement in x86_64 reg/reg operand"; UNREACHABLE(); } } diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc index b663d32e2e..78d5eca68f 100644 --- a/dex2oat/linker/image_writer.cc +++ b/dex2oat/linker/image_writer.cc @@ -3580,7 +3580,6 @@ ImageWriter::Bin ImageWriter::BinTypeForNativeRelocationType(NativeObjectRelocat case NativeObjectRelocationType::kGcRootPointer: return Bin::kMetadata; } - UNREACHABLE(); } size_t ImageWriter::GetOatIndex(mirror::Object* obj) const { diff --git a/dexdump/dexdump.cc b/dexdump/dexdump.cc index b237c0e4a8..0ed3c52c07 100644 --- a/dexdump/dexdump.cc +++ b/dexdump/dexdump.cc @@ -1891,6 +1891,7 @@ static void dumpCallSite(const DexFile* pDexFile, u4 idx) { value = it.GetJavaValue().z ? "true" : "false"; break; case EncodedArrayValueIterator::ValueType::kEndOfInput: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } diff --git a/disassembler/disassembler_riscv64.cc b/disassembler/disassembler_riscv64.cc index 09e9faf7d7..992fe31637 100644 --- a/disassembler/disassembler_riscv64.cc +++ b/disassembler/disassembler_riscv64.cc @@ -1715,6 +1715,7 @@ void DisassemblerRiscv64::Printer::Dump16(const uint8_t* insn) { os_ << "c.sd " << XRegName(GetRs2Short16(insn16)); break; default: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } os_ << ", "; @@ -1831,6 +1832,7 @@ void DisassemblerRiscv64::Printer::Dump16(const uint8_t* insn) { break; } default: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } break; @@ -1856,6 +1858,7 @@ void DisassemblerRiscv64::Printer::Dump16(const uint8_t* insn) { break; } default: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } break; @@ -1938,6 +1941,7 @@ void DisassemblerRiscv64::Printer::Dump16(const uint8_t* insn) { os_ << "c.sdsp " << XRegName(GetRs2_16(insn16)); break; default: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } @@ -1946,6 +1950,7 @@ void DisassemblerRiscv64::Printer::Dump16(const uint8_t* insn) { break; default: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } } diff --git a/imgdiag/imgdiag.cc b/imgdiag/imgdiag.cc index 66eac8c912..237debaa32 100644 --- a/imgdiag/imgdiag.cc +++ b/imgdiag/imgdiag.cc @@ -394,11 +394,13 @@ class ReferenceFieldVisitor { [[noreturn]] void VisitRootIfNonNull( [[maybe_unused]] mirror::CompressedReference<mirror::Object>* root) const REQUIRES_SHARED(Locks::mutator_lock_) { + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } [[noreturn]] void VisitRoot([[maybe_unused]] mirror::CompressedReference<mirror::Object>* root) const REQUIRES_SHARED(Locks::mutator_lock_) { + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } diff --git a/libartbase/base/compiler_filter.cc b/libartbase/base/compiler_filter.cc index 5f86256e15..f4b40f281b 100644 --- a/libartbase/base/compiler_filter.cc +++ b/libartbase/base/compiler_filter.cc @@ -34,7 +34,6 @@ bool CompilerFilter::IsAotCompilationEnabled(Filter filter) { case CompilerFilter::kEverythingProfile: case CompilerFilter::kEverything: return true; } - UNREACHABLE(); } bool CompilerFilter::IsJniCompilationEnabled(Filter filter) { @@ -49,7 +48,6 @@ bool CompilerFilter::IsJniCompilationEnabled(Filter filter) { case CompilerFilter::kEverythingProfile: case CompilerFilter::kEverything: return true; } - UNREACHABLE(); } bool CompilerFilter::IsAnyCompilationEnabled(Filter filter) { @@ -68,7 +66,6 @@ bool CompilerFilter::IsVerificationEnabled(Filter filter) { case CompilerFilter::kEverythingProfile: case CompilerFilter::kEverything: return true; } - UNREACHABLE(); } bool CompilerFilter::DependsOnImageChecksum(Filter filter) { @@ -89,7 +86,6 @@ bool CompilerFilter::DependsOnProfile(Filter filter) { case CompilerFilter::kSpeedProfile: case CompilerFilter::kEverythingProfile: return true; } - UNREACHABLE(); } CompilerFilter::Filter CompilerFilter::GetNonProfileDependentFilterFrom(Filter filter) { @@ -110,7 +106,6 @@ CompilerFilter::Filter CompilerFilter::GetNonProfileDependentFilterFrom(Filter f case CompilerFilter::kEverythingProfile: return CompilerFilter::kEverything; } - UNREACHABLE(); } CompilerFilter::Filter CompilerFilter::GetSafeModeFilterFrom(Filter filter) { @@ -129,7 +124,6 @@ CompilerFilter::Filter CompilerFilter::GetSafeModeFilterFrom(Filter filter) { case CompilerFilter::kEverythingProfile: return CompilerFilter::kVerify; } - UNREACHABLE(); } bool CompilerFilter::IsAsGoodAs(Filter current, Filter target) { @@ -151,7 +145,6 @@ std::string CompilerFilter::NameOfFilter(Filter filter) { case CompilerFilter::kEverythingProfile: return "everything-profile"; case CompilerFilter::kEverything: return "everything"; } - UNREACHABLE(); } bool CompilerFilter::ParseCompilerFilter(const char* option, Filter* filter) { diff --git a/libdexfile/dex/descriptors_names.cc b/libdexfile/dex/descriptors_names.cc index dce5ecdcde..2b68b27506 100644 --- a/libdexfile/dex/descriptors_names.cc +++ b/libdexfile/dex/descriptors_names.cc @@ -313,8 +313,6 @@ static bool IsValidPartOfMemberNameUtf8Slow(const char** pUtf8Ptr) { default: return true; } - - UNREACHABLE(); } /* Return whether the pointed-at modified-UTF-8 encoded character is diff --git a/libdexfile/dex/dex_instruction.cc b/libdexfile/dex/dex_instruction.cc index 11a2d97691..8b8b6a71cc 100644 --- a/libdexfile/dex/dex_instruction.cc +++ b/libdexfile/dex/dex_instruction.cc @@ -82,10 +82,11 @@ int32_t Instruction::GetTargetOffset() const { case k10t: return VRegA_10t(); case k20t: return VRegA_20t(); case k30t: return VRegA_30t(); - default: LOG(FATAL) << "Tried to access the branch offset of an instruction " << Name() << - " which does not have a target operand."; + default: + LOG(FATAL) << "Tried to access the branch offset of an instruction " << Name() + << " which does not have a target operand."; + UNREACHABLE(); } - UNREACHABLE(); } bool Instruction::CanFlowThrough() const { diff --git a/openjdkjvmti/ti_thread.cc b/openjdkjvmti/ti_thread.cc index 191b63c050..324d1ecc1b 100644 --- a/openjdkjvmti/ti_thread.cc +++ b/openjdkjvmti/ti_thread.cc @@ -924,7 +924,6 @@ jvmtiError ThreadUtil::SuspendOther(art::Thread* self, } // We timed out. Just go around and try again. } while (true); - UNREACHABLE(); } jvmtiError ThreadUtil::SuspendSelf(art::Thread* self) { diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 57dbd6d259..ff5803e69f 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -10203,6 +10203,7 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForField( case DexFile::MethodHandleType::kInvokeConstructor: case DexFile::MethodHandleType::kInvokeDirect: case DexFile::MethodHandleType::kInvokeInterface: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } @@ -10261,6 +10262,7 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForField( case DexFile::MethodHandleType::kInvokeConstructor: case DexFile::MethodHandleType::kInvokeDirect: case DexFile::MethodHandleType::kInvokeInterface: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } @@ -10301,6 +10303,7 @@ ObjPtr<mirror::MethodHandle> ClassLinker::ResolveMethodHandleForMethod( case DexFile::MethodHandleType::kStaticGet: case DexFile::MethodHandleType::kInstancePut: case DexFile::MethodHandleType::kInstanceGet: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); case DexFile::MethodHandleType::kInvokeStatic: { kind = mirror::MethodHandle::Kind::kInvokeStatic; diff --git a/runtime/gc/collector/mark_compact-inl.h b/runtime/gc/collector/mark_compact-inl.h index 454d79ae88..13f11300fa 100644 --- a/runtime/gc/collector/mark_compact-inl.h +++ b/runtime/gc/collector/mark_compact-inl.h @@ -217,6 +217,7 @@ uint32_t MarkCompact::LiveWordsBitmap<kAlignment>::FindNthLiveWordOffset(size_t } } } + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } diff --git a/runtime/gc/collector/mark_compact.cc b/runtime/gc/collector/mark_compact.cc index 0cea34e7bb..85d4c1af71 100644 --- a/runtime/gc/collector/mark_compact.cc +++ b/runtime/gc/collector/mark_compact.cc @@ -3578,6 +3578,7 @@ void MarkCompact::ConcurrentlyProcessLinearAllocPage(uint8_t* fault_page, bool i // The page is processed but not mapped. We should map it. break; case PageState::kMutatorProcessing: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); case PageState::kProcessingAndMapping: case PageState::kProcessedAndMapping: diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc index e3e14cae76..1a6fc6844f 100644 --- a/runtime/gc/space/image_space.cc +++ b/runtime/gc/space/image_space.cc @@ -1125,7 +1125,10 @@ class ImageSpace::Loader { public: ALWAYS_INLINE bool InSource(uintptr_t) const { return false; } ALWAYS_INLINE bool InDest(uintptr_t) const { return false; } - ALWAYS_INLINE uintptr_t ToDest(uintptr_t) const { UNREACHABLE(); } + ALWAYS_INLINE uintptr_t ToDest(uintptr_t) const { + LOG(FATAL) << "Unreachable"; + UNREACHABLE(); + } }; template <typename Range0, typename Range1 = EmptyRange, typename Range2 = EmptyRange> diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 85ed318390..2f2fdcc9e3 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -639,6 +639,7 @@ static ObjPtr<mirror::Class> GetClassForBootstrapArgument(EncodedArrayValueItera case EncodedArrayValueIterator::ValueType::kNull: return nullptr; case EncodedArrayValueIterator::ValueType::kEndOfInput: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } } @@ -721,8 +722,8 @@ static bool GetArgumentForBootstrapMethod(Thread* self, // Unreachable - unsupported types that have been checked when // determining the effect call site type based on the bootstrap // argument types. - UNREACHABLE(); case EncodedArrayValueIterator::ValueType::kEndOfInput: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } } @@ -766,8 +767,8 @@ static bool PackArgumentForBootstrapMethod(Thread* self, // Unreachable - unsupported types that have been checked when // determining the effect call site type based on the bootstrap // argument types. - UNREACHABLE(); case EncodedArrayValueIterator::ValueType::kEndOfInput: + LOG(FATAL) << "Unreachable"; UNREACHABLE(); } } @@ -853,6 +854,8 @@ static bool PackCollectorArrayForBootstrapMethod(Thread* self, } else if (component_type == GetClassRoot<mirror::Class>()) { COLLECT_REFERENCE_ARRAY(mirror::Class, Type); } else { + component_type->DumpClass(LOG_STREAM(FATAL_WITHOUT_ABORT), mirror::Class::kDumpClassFullDetail); + LOG(FATAL) << "unexpected class: " << component_type->PrettyTypeOf(); UNREACHABLE(); } #undef COLLECT_PRIMITIVE_ARRAY diff --git a/runtime/mirror/var_handle.cc b/runtime/mirror/var_handle.cc index a623e42559..ec332cbcbc 100644 --- a/runtime/mirror/var_handle.cc +++ b/runtime/mirror/var_handle.cc @@ -1656,7 +1656,6 @@ int32_t VarHandle::GetNumberOfVarTypeParameters(AccessModeTemplate access_mode_t case AccessModeTemplate::kCompareAndExchange: return 2; } - UNREACHABLE(); } bool FieldVarHandle::Access(AccessMode access_mode, diff --git a/runtime/oat/oat_file_assistant.cc b/runtime/oat/oat_file_assistant.cc index 2eaf966ec6..5ddee8d616 100644 --- a/runtime/oat/oat_file_assistant.cc +++ b/runtime/oat/oat_file_assistant.cc @@ -987,7 +987,6 @@ bool OatFileAssistant::OatFileInfo::IsUseable() { case kOatUpToDate: return true; } - UNREACHABLE(); } OatFileAssistant::OatStatus OatFileAssistant::OatFileInfo::Status() { |