From 12311c5540e69750b39f1f2e476546cdf05d1f3e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 26 Nov 2018 17:51:16 -0800 Subject: arch, base, cpu, gpu, mem: Replace assert(0 or false with panic. Neither assert(0) nor assert(false) give any hint as to why control getting to them is bad, and their more descriptive versions, assert(0 && "description") and assert(false && "description"), jury rig assert to add an error message when the utility function panic() already does that directly with better formatting options. This change replaces that flavor of call to assert with panic, except in the actual code which processes the formatting that panic uses (to avoid infinitely recurring error handling), and in some *.sm files since I don't know what rules those have to follow and don't want to accidentaly break them. Change-Id: I8addfbfaf77eaed94ec8191f2ae4efb477cefdd0 Reviewed-on: https://gem5-review.googlesource.com/c/14636 Reviewed-by: Brandon Potter Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power --- src/cpu/minor/buffers.hh | 6 +++++- src/cpu/minor/lsq.cc | 17 ++++++----------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'src/cpu/minor') diff --git a/src/cpu/minor/buffers.hh b/src/cpu/minor/buffers.hh index 864b29e0c..edf87dec5 100644 --- a/src/cpu/minor/buffers.hh +++ b/src/cpu/minor/buffers.hh @@ -118,7 +118,11 @@ class NoBubbleTraits { public: static bool isBubble(const ElemType &) { return false; } - static ElemType bubble() { assert(false); } + static ElemType + bubble() + { + panic("bubble called but no bubble interface"); + } }; /** Pass on call to the element */ diff --git a/src/cpu/minor/lsq.cc b/src/cpu/minor/lsq.cc index ad103b001..b836ed22d 100644 --- a/src/cpu/minor/lsq.cc +++ b/src/cpu/minor/lsq.cc @@ -44,6 +44,7 @@ #include "arch/locked_mem.hh" #include "arch/mmapped_ipr.hh" +#include "base/logging.hh" #include "cpu/minor/cpu.hh" #include "cpu/minor/exec_context.hh" #include "cpu/minor/execute.hh" @@ -1121,8 +1122,7 @@ LSQ::tryToSend(LSQRequestPtr request) request->setState(LSQRequest::StoreBufferIssuing); break; default: - assert(false); - break; + panic("Unrecognized LSQ request state %d.", request->state); } state = MemoryRunning; @@ -1144,8 +1144,7 @@ LSQ::tryToSend(LSQRequestPtr request) request->setState(LSQRequest::StoreBufferNeedsRetry); break; default: - assert(false); - break; + panic("Unrecognized LSQ request state %d.", request->state); } } } @@ -1226,10 +1225,7 @@ LSQ::recvTimingResp(PacketPtr response) } break; default: - /* Shouldn't be allowed to receive a response from another - * state */ - assert(false); - break; + panic("Shouldn't be allowed to receive a response from another state"); } /* We go to idle even if there are more things in the requests queue @@ -1260,7 +1256,7 @@ LSQ::recvReqRetry() retryRequest->setState(LSQRequest::StoreInStoreBuffer); break; default: - assert(false); + panic("Unrecognized retry request state %d.", retryRequest->state); } /* Set state back to MemoryRunning so that the following @@ -1283,8 +1279,7 @@ LSQ::recvReqRetry() storeBuffer.countIssuedStore(retryRequest); break; default: - assert(false); - break; + panic("Unrecognized retry request state %d.", retryRequest->state); } retryRequest = NULL; -- cgit v1.2.3