Tidy logging code not using UNIMPLEMENTED.
Change-Id: I7a79c1671a6ff8b2040887133b3e0925ef9a3cfe
diff --git a/compiler/common_compiler_test.cc b/compiler/common_compiler_test.cc
index 359d6af..7e19e15 100644
--- a/compiler/common_compiler_test.cc
+++ b/compiler/common_compiler_test.cc
@@ -111,7 +111,7 @@
#else
// Only warn if not Intel as Intel doesn't have cache flush instructions.
#if !defined(__i386__) && !defined(__x86_64__)
- LOG(WARNING) << "UNIMPLEMENTED: cache flush";
+ UNIMPLEMENTED(WARNING) << "cache flush";
#endif
#endif
}
diff --git a/compiler/compiler.cc b/compiler/compiler.cc
index fbfd8e6..36213ca 100644
--- a/compiler/compiler.cc
+++ b/compiler/compiler.cc
@@ -75,8 +75,8 @@
default:
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
- return nullptr;
}
} // namespace art
diff --git a/compiler/dex/quick/arm64/utility_arm64.cc b/compiler/dex/quick/arm64/utility_arm64.cc
index 0883694..6985b73 100644
--- a/compiler/dex/quick/arm64/utility_arm64.cc
+++ b/compiler/dex/quick/arm64/utility_arm64.cc
@@ -768,8 +768,8 @@
opcode = kA64Sub4RRre;
break;
default:
- LOG(FATAL) << "Unimplemented opcode: " << op;
- break;
+ UNIMPLEMENTED(FATAL) << "Unimplemented opcode: " << op;
+ UNREACHABLE();
}
A64Opcode widened_opcode = r_dest.Is64Bit() ? WIDE(opcode) : opcode;
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 35a3d4b..235aba8 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -206,7 +206,7 @@
break;
default:
LOG(FATAL) << "Unreachable.";
- break;
+ UNREACHABLE();
}
object->SetLockWord(LockWord::FromForwardingAddress(offset), false);
DCHECK(IsImageOffsetAssigned(object));
diff --git a/compiler/jni/portable/jni_compiler.cc b/compiler/jni/portable/jni_compiler.cc
index d2f54f8..ff37d85 100644
--- a/compiler/jni/portable/jni_compiler.cc
+++ b/compiler/jni/portable/jni_compiler.cc
@@ -298,6 +298,7 @@
case 'D': ret_type = irb_.getJDoubleTy(); break;
case 'L': ret_type = irb_.getJObjectTy(); break;
default: LOG(FATAL) << "Unreachable: unexpected return type in shorty " << shorty;
+ UNREACHABLE();
}
// Get argument type
std::vector< ::llvm::Type*> args_type;
diff --git a/compiler/utils/arena_object.h b/compiler/utils/arena_object.h
index 50909f75..8f6965e 100644
--- a/compiler/utils/arena_object.h
+++ b/compiler/utils/arena_object.h
@@ -31,6 +31,7 @@
void operator delete(void*, size_t) {
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
};
diff --git a/compiler/utils/arm/assembler_arm.cc b/compiler/utils/arm/assembler_arm.cc
index b430c7e..db42b46 100644
--- a/compiler/utils/arm/assembler_arm.cc
+++ b/compiler/utils/arm/assembler_arm.cc
@@ -324,7 +324,7 @@
return IsAbsoluteUint(10, offset); // VFP addressing mode.
default:
LOG(FATAL) << "UNREACHABLE";
- return false;
+ UNREACHABLE();
}
}
@@ -342,7 +342,7 @@
return IsAbsoluteUint(10, offset); // VFP addressing mode.
default:
LOG(FATAL) << "UNREACHABLE";
- return false;
+ UNREACHABLE();
}
}
@@ -359,9 +359,9 @@
return IsAbsoluteUint(10, offset); // VFP addressing mode.
case kLoadWordPair:
return IsAbsoluteUint(10, offset);
- default:
+ default:
LOG(FATAL) << "UNREACHABLE";
- return false;
+ UNREACHABLE();
}
}
@@ -377,9 +377,9 @@
return IsAbsoluteUint(10, offset); // VFP addressing mode.
case kStoreWordPair:
return IsAbsoluteUint(10, offset);
- default:
+ default:
LOG(FATAL) << "UNREACHABLE";
- return false;
+ UNREACHABLE();
}
}
diff --git a/compiler/utils/arm/assembler_arm32.cc b/compiler/utils/arm/assembler_arm32.cc
index 6af69c8..3d46617 100644
--- a/compiler/utils/arm/assembler_arm32.cc
+++ b/compiler/utils/arm/assembler_arm32.cc
@@ -1356,6 +1356,7 @@
break;
default:
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
}
@@ -1427,6 +1428,7 @@
break;
default:
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
}
diff --git a/compiler/utils/arm/assembler_thumb2.cc b/compiler/utils/arm/assembler_thumb2.cc
index 7968a77..37478c4 100644
--- a/compiler/utils/arm/assembler_thumb2.cc
+++ b/compiler/utils/arm/assembler_thumb2.cc
@@ -2406,6 +2406,7 @@
break;
default:
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
}
@@ -2477,6 +2478,7 @@
break;
default:
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
}
diff --git a/disassembler/disassembler_x86.cc b/disassembler/disassembler_x86.cc
index e12559f..b9e98f6 100644
--- a/disassembler/disassembler_x86.cc
+++ b/disassembler/disassembler_x86.cc
@@ -508,7 +508,7 @@
case 0x5D: opcode << "min"; break;
case 0x5E: opcode << "div"; break;
case 0x5F: opcode << "max"; break;
- default: LOG(FATAL) << "Unreachable";
+ default: LOG(FATAL) << "Unreachable"; UNREACHABLE();
}
if (prefix[2] == 0x66) {
opcode << "pd";
@@ -1239,7 +1239,7 @@
case 0xF2: prefixed_opcode << "repne "; break;
case 0xF3: prefixed_opcode << "repe "; break;
case 0: break;
- default: LOG(FATAL) << "Unreachable";
+ default: LOG(FATAL) << "Unreachable"; UNREACHABLE();
}
prefixed_opcode << opcode.str();
os << FormatInstructionPointer(begin_instr)
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index f6717fb..854effd 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -5284,6 +5284,7 @@
break;
default:
LOG(FATAL) << "Unreachable - invocation type: " << type;
+ UNREACHABLE();
}
if (resolved == nullptr) {
// Search by name, which works across dex files.
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index 78cbe58..761441e 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -1182,13 +1182,14 @@
case kArray:
case kAnnotation:
UNIMPLEMENTED(FATAL) << ": type " << type_;
- break;
+ UNREACHABLE();
case kNull:
jval_.l = NULL;
width = 0;
break;
default:
LOG(FATAL) << "Unreached";
+ UNREACHABLE();
}
ptr_ += width;
}
diff --git a/runtime/dex_instruction.cc b/runtime/dex_instruction.cc
index af38433..a802759 100644
--- a/runtime/dex_instruction.cc
+++ b/runtime/dex_instruction.cc
@@ -113,7 +113,7 @@
return 1; // NOP.
} else {
LOG(FATAL) << "Unreachable: " << DumpString(nullptr);
- return 0;
+ UNREACHABLE();
}
}
}
diff --git a/runtime/entrypoints/entrypoint_utils-inl.h b/runtime/entrypoints/entrypoint_utils-inl.h
index 9fb9a3b..ccc5d83 100644
--- a/runtime/entrypoints/entrypoint_utils-inl.h
+++ b/runtime/entrypoints/entrypoint_utils-inl.h
@@ -499,11 +499,8 @@
case StaticPrimitiveRead: is_primitive = true; is_set = false; is_static = true; break;
case StaticPrimitiveWrite: is_primitive = true; is_set = true; is_static = true; break;
default:
- LOG(FATAL) << "UNREACHABLE"; // Assignment below to avoid GCC warnings.
- is_primitive = true;
- is_set = true;
- is_static = true;
- break;
+ LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
if (UNLIKELY(resolved_field->IsStatic() != is_static)) {
// Incompatible class change.
diff --git a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc
index c3664bf..61d66ba 100644
--- a/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/portable/portable_trampoline_entrypoints.cc
@@ -172,7 +172,7 @@
break;
case Primitive::kPrimVoid:
LOG(FATAL) << "UNREACHABLE";
- break;
+ UNREACHABLE();
}
++cur_reg_;
}
@@ -261,8 +261,7 @@
break;
case Primitive::kPrimVoid:
LOG(FATAL) << "UNREACHABLE";
- val.j = 0;
- break;
+ UNREACHABLE();
}
args_.push_back(val);
}
diff --git a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
index a2869ec..7dbfdd5 100644
--- a/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_alloc_entrypoints.cc
@@ -248,7 +248,8 @@
}
#endif
default: {
- LOG(FATAL) << "Unimplemented";
+ UNIMPLEMENTED(FATAL);
+ UNREACHABLE();
}
}
}
diff --git a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
index af341bb..2e38c3a 100644
--- a/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
+++ b/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
@@ -456,7 +456,7 @@
break;
case Primitive::kPrimVoid:
LOG(FATAL) << "UNREACHABLE";
- break;
+ UNREACHABLE();
}
++cur_reg_;
}
@@ -564,8 +564,7 @@
break;
case Primitive::kPrimVoid:
LOG(FATAL) << "UNREACHABLE";
- val.j = 0;
- break;
+ UNREACHABLE();
}
args_->push_back(val);
}
@@ -1557,7 +1556,7 @@
break;
case Primitive::kPrimVoid:
LOG(FATAL) << "UNREACHABLE";
- break;
+ UNREACHABLE();
}
}
diff --git a/runtime/gc/collector/mark_sweep.cc b/runtime/gc/collector/mark_sweep.cc
index 83da063..ad3bb11 100644
--- a/runtime/gc/collector/mark_sweep.cc
+++ b/runtime/gc/collector/mark_sweep.cc
@@ -813,6 +813,7 @@
break;
default:
LOG(FATAL) << "Unreachable";
+ UNREACHABLE();
}
TimingLogger::ScopedTiming t(name, GetTimings());
ScanObjectVisitor visitor(this);
diff --git a/runtime/gc/gc_cause.cc b/runtime/gc/gc_cause.cc
index f0e1512..6be683d 100644
--- a/runtime/gc/gc_cause.cc
+++ b/runtime/gc/gc_cause.cc
@@ -35,8 +35,8 @@
case kGcCauseTrim: return "HeapTrim";
default:
LOG(FATAL) << "Unreachable";
+ UNREACHABLE();
}
- return "";
}
std::ostream& operator<<(std::ostream& os, const GcCause& gc_cause) {
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index bceac44..c0008aa 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -1325,8 +1325,9 @@
// Throw OOM by default.
break;
default: {
- LOG(FATAL) << "Unimplemented homogeneous space compaction result "
- << static_cast<size_t>(result);
+ UNIMPLEMENTED(FATAL) << "homogeneous space compaction result: "
+ << static_cast<size_t>(result);
+ UNREACHABLE();
}
}
// Always print that we ran homogeneous space compation since this can cause jank.
@@ -1761,7 +1762,8 @@
break;
}
default: {
- LOG(FATAL) << "Unimplemented";
+ UNIMPLEMENTED(FATAL);
+ UNREACHABLE();
}
}
if (IsGcConcurrent()) {
diff --git a/runtime/gc/space/bump_pointer_space.cc b/runtime/gc/space/bump_pointer_space.cc
index 8f42642..0a55b52 100644
--- a/runtime/gc/space/bump_pointer_space.cc
+++ b/runtime/gc/space/bump_pointer_space.cc
@@ -201,8 +201,8 @@
}
accounting::ContinuousSpaceBitmap::SweepCallback* BumpPointerSpace::GetSweepCallback() {
- LOG(FATAL) << "Unimplemented";
- return nullptr;
+ UNIMPLEMENTED(FATAL);
+ UNREACHABLE();
}
uint64_t BumpPointerSpace::GetBytesAllocated() {
diff --git a/runtime/gc/space/space.cc b/runtime/gc/space/space.cc
index bff28f6..b233805 100644
--- a/runtime/gc/space/space.cc
+++ b/runtime/gc/space/space.cc
@@ -39,33 +39,33 @@
}
DlMallocSpace* Space::AsDlMallocSpace() {
- LOG(FATAL) << "Unreachable";
- return nullptr;
+ UNIMPLEMENTED(FATAL) << "Unreachable";
+ UNREACHABLE();
}
RosAllocSpace* Space::AsRosAllocSpace() {
- LOG(FATAL) << "Unreachable";
- return nullptr;
+ UNIMPLEMENTED(FATAL) << "Unreachable";
+ UNREACHABLE();
}
ZygoteSpace* Space::AsZygoteSpace() {
- LOG(FATAL) << "Unreachable";
- return nullptr;
+ UNIMPLEMENTED(FATAL) << "Unreachable";
+ UNREACHABLE();
}
BumpPointerSpace* Space::AsBumpPointerSpace() {
- LOG(FATAL) << "Unreachable";
- return nullptr;
+ UNIMPLEMENTED(FATAL) << "Unreachable";
+ UNREACHABLE();
}
AllocSpace* Space::AsAllocSpace() {
- LOG(FATAL) << "Unimplemented";
- return nullptr;
+ UNIMPLEMENTED(FATAL) << "Unreachable";
+ UNREACHABLE();
}
ContinuousMemMapAllocSpace* Space::AsContinuousMemMapAllocSpace() {
- LOG(FATAL) << "Unimplemented";
- return nullptr;
+ UNIMPLEMENTED(FATAL) << "Unreachable";
+ UNREACHABLE();
}
DiscontinuousSpace::DiscontinuousSpace(const std::string& name,
diff --git a/runtime/gc/space/zygote_space.cc b/runtime/gc/space/zygote_space.cc
index 51d84f5..9de0548 100644
--- a/runtime/gc/space/zygote_space.cc
+++ b/runtime/gc/space/zygote_space.cc
@@ -58,7 +58,8 @@
}
void ZygoteSpace::Clear() {
- LOG(FATAL) << "Unimplemented";
+ UNIMPLEMENTED(FATAL);
+ UNREACHABLE();
}
ZygoteSpace::ZygoteSpace(const std::string& name, MemMap* mem_map, size_t objects_allocated)
diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc
index dfb03cd..9de12f2 100644
--- a/runtime/interpreter/interpreter.cc
+++ b/runtime/interpreter/interpreter.cc
@@ -325,7 +325,7 @@
JValue ExecuteGotoImpl(Thread* self, MethodHelper& mh, const DexFile::CodeItem* code_item,
ShadowFrame& shadow_frame, JValue result_register) {
LOG(FATAL) << "UNREACHABLE";
- exit(0);
+ UNREACHABLE();
}
// Explicit definitions of ExecuteGotoImpl.
template<> SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 3ccdd03..c887a88 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -80,6 +80,7 @@
break;
default:
LOG(FATAL) << "Unreachable: " << field_type;
+ UNREACHABLE();
}
return true;
}
@@ -153,6 +154,7 @@
break;
default:
LOG(FATAL) << "Unreachable: " << field_type;
+ UNREACHABLE();
}
return true;
}
@@ -195,7 +197,7 @@
break;
default:
LOG(FATAL) << "Unreachable: " << field_type;
- break;
+ UNREACHABLE();
}
return field_value;
}
@@ -285,6 +287,7 @@
}
default:
LOG(FATAL) << "Unreachable: " << field_type;
+ UNREACHABLE();
}
return true;
}
@@ -369,6 +372,7 @@
break;
default:
LOG(FATAL) << "Unreachable: " << field_type;
+ UNREACHABLE();
}
return true;
}
diff --git a/runtime/mirror/art_method-inl.h b/runtime/mirror/art_method-inl.h
index 664a412..d262fd5 100644
--- a/runtime/mirror/art_method-inl.h
+++ b/runtime/mirror/art_method-inl.h
@@ -171,7 +171,7 @@
}
default:
LOG(FATAL) << "Unreachable - invocation type: " << type;
- return true;
+ UNREACHABLE();
}
}
@@ -223,9 +223,7 @@
}
inline const uint8_t* ArtMethod::GetVmapTable(const void* code_pointer) {
- if (IsOptimized()) {
- LOG(FATAL) << "Unimplemented vmap table for optimized compiler";
- }
+ CHECK(!IsOptimized()) << "Unimplemented vmap table for optimized compiler";
DCHECK(code_pointer != nullptr);
DCHECK(code_pointer == GetQuickOatCodePointer());
uint32_t offset =
diff --git a/runtime/mirror/object-inl.h b/runtime/mirror/object-inl.h
index b89da9d..c9e60bc 100644
--- a/runtime/mirror/object-inl.h
+++ b/runtime/mirror/object-inl.h
@@ -121,7 +121,7 @@
OFFSET_OF_OBJECT_MEMBER(Object, x_rb_ptr_));
#else
LOG(FATAL) << "Unreachable";
- return nullptr;
+ UNREACHABLE();
#endif
}
@@ -134,6 +134,7 @@
OFFSET_OF_OBJECT_MEMBER(Object, x_rb_ptr_), rb_ptr);
#else
LOG(FATAL) << "Unreachable";
+ UNREACHABLE();
#endif
}
@@ -156,7 +157,7 @@
return true;
#else
LOG(FATAL) << "Unreachable";
- return false;
+ UNREACHABLE();
#endif
}
@@ -166,13 +167,12 @@
DCHECK(obj->GetReadBarrierPointer() == nullptr)
<< "Bad Baker pointer: obj=" << reinterpret_cast<void*>(obj)
<< " ptr=" << reinterpret_cast<void*>(obj->GetReadBarrierPointer());
- } else if (kUseBrooksReadBarrier) {
+ } else {
+ CHECK(kUseBrooksReadBarrier);
Object* obj = const_cast<Object*>(this);
DCHECK_EQ(obj, obj->GetReadBarrierPointer())
<< "Bad Brooks pointer: obj=" << reinterpret_cast<void*>(obj)
<< " ptr=" << reinterpret_cast<void*>(obj->GetReadBarrierPointer());
- } else {
- LOG(FATAL) << "Unreachable";
}
}
diff --git a/runtime/monitor.cc b/runtime/monitor.cc
index 6123934..5020ced 100644
--- a/runtime/monitor.cc
+++ b/runtime/monitor.cc
@@ -877,7 +877,7 @@
}
default: {
LOG(FATAL) << "Unreachable";
- return ThreadList::kInvalidThreadId;
+ UNREACHABLE();
}
}
}
@@ -1032,7 +1032,7 @@
return true;
default:
LOG(FATAL) << "Unreachable";
- return false;
+ UNREACHABLE();
}
}
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index ec7d82d..c35bb30 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -326,6 +326,7 @@
break;
default:
LOG(FATAL) << "Unreachable - invocation type: " << invoke_type;
+ UNREACHABLE();
}
if (method == NULL) {
return;
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
index ee99e78..43681a7 100644
--- a/runtime/native/java_lang_System.cc
+++ b/runtime/native/java_lang_System.cc
@@ -93,7 +93,7 @@
switch (dstComponentPrimitiveType) {
case Primitive::kPrimVoid:
LOG(FATAL) << "Unreachable, cannot have arrays of type void";
- return;
+ UNREACHABLE();
case Primitive::kPrimBoolean:
case Primitive::kPrimByte:
DCHECK_EQ(Primitive::ComponentSize(dstComponentPrimitiveType), 1U);
@@ -122,7 +122,7 @@
}
default:
LOG(FATAL) << "Unknown array type: " << PrettyTypeOf(srcArray);
- return;
+ UNREACHABLE();
}
}
// If one of the arrays holds a primitive type the other array must hold the exact same type.
diff --git a/runtime/quick_exception_handler.h b/runtime/quick_exception_handler.h
index b93769c..cf1ecbf 100644
--- a/runtime/quick_exception_handler.h
+++ b/runtime/quick_exception_handler.h
@@ -40,6 +40,7 @@
~QuickExceptionHandler() {
LOG(FATAL) << "UNREACHABLE"; // Expected to take long jump.
+ UNREACHABLE();
}
void FindCatch(const ThrowLocation& throw_location, mirror::Throwable* exception,
diff --git a/runtime/stack.cc b/runtime/stack.cc
index 0cdc984..0adf031 100644
--- a/runtime/stack.cc
+++ b/runtime/stack.cc
@@ -127,7 +127,8 @@
}
} else if (m->IsOptimized()) {
// TODO: Implement, currently only used for exceptions when jdwp is enabled.
- LOG(WARNING) << "StackVisitor::GetThisObject is unimplemented with the optimizing compiler";
+ UNIMPLEMENTED(WARNING)
+ << "StackVisitor::GetThisObject is unimplemented with the optimizing compiler";
return nullptr;
} else {
const DexFile::CodeItem* code_item = m->GetCodeItem();
diff --git a/runtime/stack_map.h b/runtime/stack_map.h
index b1c46a9..a58ecab 100644
--- a/runtime/stack_map.h
+++ b/runtime/stack_map.h
@@ -286,7 +286,7 @@
}
}
LOG(FATAL) << "Unreachable";
- return StackMap(MemoryRegion());
+ UNREACHABLE();
}
StackMap GetStackMapForNativePcOffset(uint32_t native_pc_offset) {
@@ -298,7 +298,7 @@
}
}
LOG(FATAL) << "Unreachable";
- return StackMap(MemoryRegion());
+ UNREACHABLE();
}
private:
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 9c04133..da82c76 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1971,6 +1971,7 @@
exception_handler.UpdateInstrumentationStack();
exception_handler.DoLongJump();
LOG(FATAL) << "UNREACHABLE";
+ UNREACHABLE();
}
Context* Thread::GetLongJumpContext() {