Re: [m5-dev] namespaces for python SimObjects

2008-06-13 Thread nathan binkert
Are instances of class objects uniquely identifiable and usable as keys? Only if they provide a __hash__ function, but in theory it should be possible. If so, you could use the class as a key using the same mechanism instead of the string name with Param.blah. So then you use class Foo to look

Re: [m5-dev] namespaces for python SimObjects

2008-06-13 Thread Ali Saidi
On Jun 13, 2008, at 11:48 AM, nathan binkert wrote: Are instances of class objects uniquely identifiable and usable as keys? Only if they provide a __hash__ function, but in theory it should be possible. If so, you could use the class as a key using the same mechanism instead of

Re: [m5-dev] namespaces for python SimObjects

2008-06-13 Thread Gabe Black
The key difference here is between circular references amongst instances and amongst classes. Circular references amongst instances does not work in the python because it creates a cycle in the object hierarchy which is why the C++ trick is necessary. If you're circular references are in the

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread Gabe Black
Any comments anybody? I have a few to add. First, as I went through the SimObject definitions and was taking out cxx_namespace, there were a few cases where the class name was still the same as type, just in a different namespace. It's slightly redundant to have to put the class name in

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread Steve Reinhardt
On Thu, Jun 12, 2008 at 11:26 AM, Gabe Black [EMAIL PROTECTED] wrote: How about instead of Params.some_class the syntax would be Params(some_class) where Params is more like a class than a module? Then you could look up the information for the class you're dealing with without ever having to

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread nathan binkert
How about instead of Params.some_class the syntax would be Params(some_class) where Params is more like a class than a module? Then you could look up the information for the class you're dealing with without ever having to give it a globally consistent name. Seems reasonable to me... I don't

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread nathan binkert
I was wondering why we had both 'type' and 'cxx_classname'... last time I recall working on that code (before Nate finished the params auto-gen stuff), the point of 'type' was to be the C++ class name. When is the Params.Foo thing different from the Python class name, and is there a good

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread Steve Reinhardt
On Thu, Jun 12, 2008 at 5:44 PM, nathan binkert [EMAIL PROTECTED] wrote: How about instead of Params.some_class the syntax would be Params(some_class) where Params is more like a class than a module? Then you could look up the information for the class you're dealing with without ever having

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread Steve Reinhardt
On Thu, Jun 12, 2008 at 5:51 PM, nathan binkert [EMAIL PROTECTED] wrote: I was wondering why we had both 'type' and 'cxx_classname'... last time I recall working on that code (before Nate finished the params auto-gen stuff), the point of 'type' was to be the C++ class name. When is the

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread nathan binkert
I'm not sure any of that fully explains why we have both attributes though. It is important to remember as in the cache builder example that the 'type' is really something that identifies the function that creates the C++ object and isn't necessarily the type of the resulting object (or even

Re: [m5-dev] namespaces for python SimObjects

2008-06-12 Thread Gabe Black
nathan binkert wrote: I'm not sure any of that fully explains why we have both attributes though. It is important to remember as in the cache builder example that the 'type' is really something that identifies the function that creates the C++ object and isn't necessarily the type of the

Re: [m5-dev] namespaces for python SimObjects

2008-06-09 Thread Gabe Black
It won't, but if you use the attached patch it seems to. Let me know if it looks good and I'll tack it onto my queue. Also, is there a solid reason the create functions can't end up in a namespace other than the global one? I'm ending up with some pretty horrible names trying to make sure

Re: [m5-dev] namespaces for python SimObjects

2008-06-09 Thread Gabe Black
What about making Enums recognize cxx_namespace too? That would be pretty handy although I'm not sure how feasible. There seems to be a global list of them that would probably get confused if there was more than one with the same name, even if they were in separate modules. Gabe Gabe Black

Re: [m5-dev] namespaces for python SimObjects

2008-06-09 Thread nathan binkert
It won't, but if you use the attached patch it seems to. Let me know if it looks good and I'll tack it onto my queue. Patch looks good. Also, is there a solid reason the create functions can't end up in a namespace other than the global one? I'm ending up with some pretty horrible names

Re: [m5-dev] namespaces for python SimObjects

2008-06-09 Thread Gabe Black
That makes sense to me. I can do that at some point or if you'd rather that'd be fine too. Gabe nathan binkert wrote: It won't, but if you use the attached patch it seems to. Let me know if it looks good and I'll tack it onto my queue. Patch looks good. Actually, does it make sense to get

Re: [m5-dev] namespaces for python SimObjects

2008-06-09 Thread nathan binkert
Whoever gets to it. If you don't want to do it instead of the simple patch you wrote, we can put it on the todo list. In general, that code is getting pretty messy and needs some TLC. On Mon, Jun 9, 2008 at 11:21 AM, Gabe Black [EMAIL PROTECTED] wrote: That makes sense to me. I can do that at

[m5-dev] namespaces for python SimObjects

2008-06-02 Thread Gabe Black
I'm just starting on making the BIOSey tables and configuration information, like the e820 map which was forcing there to be 4 gigs of memory, available through SimObjects. There are a bunch of hierarchical tables for, for example, the DMI information, and I'm concerned that if I add a