Tidy logging code not using UNIMPLEMENTED.
Change-Id: I7a79c1671a6ff8b2040887133b3e0925ef9a3cfe
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() {