On 09/29/11 20:38, nathan binkert wrote: >> 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. > It's similar, but it's really about implementing something that's like > virtual functions at compile time. What you're doing has an element > of that. Check out: > http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern > > Anyway, what do you think of my alternative? an example of the CRTP > would be if you took my proposal and used the "compile time virtual" > to make the accessor methods work. > > Nate
There need to be accessors because the "name()" function is declared in the generic class, or I suppose I'd have to change all the fault classes for all the ISAs. With accessors, it doesn't seem like it would buy anything to declare the static member in each class since we'd need to do the inheritance thing anyway. I can check it in and then you can do what you want with it. That will get rid of all the duplication that's in there now, and you can adjust it to your liking. Gabe _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
