Review Board 2.0.15


Alpha: Use the CRTP to simplify Alpha's fault classes.

Review Request #882 - Created Sept. 24, 2011 and updated

Information
Gabe Black
gem5
Reviewers
Default
ali, gblack, nate, stever
Alpha: Use the CRTP to simplify Alpha's fault classes.

   
Posted (Sept. 29, 2011, 7:18 a.m.)
While this might looks somewhat like the CRTP, it's a pretty wierd version of it, such that I probably wouldn't even call it that.  The fact that you don't even use the template parameter is pretty odd.

As far as I can tell, you added the template so you could avoid having to declare the various static members for each version of the class.  I'd personally think it's pretty confusing.

Wouldn't it be simpler to get rid of just about all of this code, including the accessors and just have a single public member that is a "static const FaultVals vals"? For each fault?

If you really don't want to do this, I won't stand in your way (because I do believe done > perfect), but it took a long time for me to figure out what the heck was going on.
  1. Isn't that how this is supposed to work? I did the same thing here that I was told to do a long time ago for SPARC and what was called CRTP back by you guys back then. I made the change to Alpha and MIPS to be consistent, and because they had basically the same code I was told to clean up in SPARC years ago. Being able to declare a fault class in one line is pretty nice too.