Replace WARN and ERROR statements in Ruby
Review Request #336 - Created Dec. 2, 2010 and submitted
| Information | |
|---|---|
| Nilay Vaish | |
| gem5 | |
| Reviewers | |
| Default | |
This patch removes the WARN_* and ERROR_* from src/mem/ruby/common/Debug.hh file. These statements have been replaced with warn(), panic() and fatal() defined in src/base/misc.hh
Posted (Dec. 8, 2010, 9:56 a.m.)
-
src/cpu/testers/rubytest/Check.cc (Diff revision 2) -
You don't need to do %lld with cprintf/warn/dprintf. %d works just fine.
-
src/cpu/testers/rubytest/Check.cc (Diff revision 2) -
If you're going to panic, why bother with the warn? I know that you're mirroring what is already there, but it doesn't really make sense to me. It would probably be nice to make the error messages a little more verbose, but then again, perhaps that should just be a different changeset.
Review request changed
Updated (Dec. 17, 2010, 9:38 a.m.)
Summary: |
|
|---|
Posted (Dec. 19, 2010, 2:46 a.m.)
You have a lot of fatals that I think should be panics. Ask Steve about that. Also this diff didn't address my comments to your previous diff.
Review request changed
Updated (Dec. 19, 2010, 4:02 a.m.)
Posted (Dec. 20, 2010, 1:38 a.m.)
I second Nate: there's fatal() and panic() also take cprintf-style arguments, so there's no point in doing a warn() first followed by fatal() or panic(); the whole message should just be passed to fatal()/panic(). I also don't understand why you kept the ASSERT(0) lines; seems like they should be panics too. See http://m5sim.org/wiki/index.php/Coding_Style#Fatal_vs._panic for the difference between fatal() and panic() (if you haven't already). It's a little hard to tell from just a few lines of context which one is correct, but basically anything that's a programming error rather than a user/configuration error should be panic(), so I'm guessing that some of your fatals should be panics based on that. Also, since the old ERROR_MSG macro called abort(), it's more similar to panic(), so I'd say by default you should use panic unless you know that something reflects a user/configuration error. This last comment is a little unrelated, but I noticed that several of the ERROR_MSG() calls are followed by return statements even though the program terminates. panic() and fatal() are marked as "noreturn" so you should probably be able to eliminate those pointless return statements without incurring any compiler error messages.
Review request changed
Updated (Dec. 20, 2010, 8:31 p.m.)
Change Summary:
Removed calls to warn() where followed by fatal()/panic(). Replaced ASSERT(0) calls with panic(). Removed return statements where possible. I have retained calls to fatal() which I think should be fatal() and not panic().
Diff: |
Revision 4 (+78 -193) |
|---|
Assuming everything compiles and runs, it looks good.
Looks good to me, thanks for the changes!
Review request changed
Updated (Dec. 21, 2010, 11:43 a.m.)
Change Summary:
I have made some changes. While testing the changes that I have been making to Ruby, the deadlock detected message popped. The following data was not pretty useful. I realized that it is so because I have made some changes to the message that is sent to output. WARN prints the variable name as well. So I have added to those to the panic() statements. Brad, take a look if these changes seem fine to you. I ran the regression tester for quick tests.
Diff: |
Revision 5 (+87 -193) |
|---|
