Re: [m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-10 Thread Steve Reinhardt
On Tue, Nov 9, 2010 at 10:56 AM, nathan binkert n...@binkert.org wrote:

  Also, while we're on the topic, I tried to stick a non-simobject,
  non-parameter value into a simobject just to keep track of it, and it
  didn't work. This was surprising and took me a little while to figure
  out since that works just fine if you stick an abitrary simobject to it.
  Is that intentional? It's something like this, although I didn't
  specifically verify this code does what I think it does/seemed to be
 doing.
 
  Root root()
  tlb = Tlb()
  foo = 5
 
  root.tlb = tlb # works fine since tlb is a simobject
  root.foo = foo # chokes saying something about the foo parameter not
  being part of root since foo isn't a simobject

 That is intentional.  Basically, all SimObjects are containers for
 other objects whether or not there are specified parameters for them.
 Anything else must be a parameter.


Yea, Nate and I had a big debate back when we did this because I wanted to
make adding children explicit so that you would only be able to assign
parameter values and nothing else, but this is how it ended up.

Note that there are two other cases where you can create new SimObject
attributes that aren't parameters:
- If the RHS is a function (i.e., using 'def')
- If the name starts with an underscore (so if you really want to add a
scalar as in your example, just call it '_foo')

As far as the original 'self' bug, the code path there deals with
reassigning/overriding a child assignment; I'm a little surprised that never
happens in any of our existing scripts.  It might be worth adding a warning
there if that's something that's uncommon and so far has only occurred as a
side effect of a buggy script.

Steve
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-09 Thread nathan binkert
  This code was apparently never called before, and I think I landed on
 it by accident. Could there be anything else like that? Maybe we should
 put together a test configuration?
Do you know what you did to exercise it?  I don't recall writing this
code.  Steve, do you remember what it's doing?

  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-09 Thread Nathan Binkert

---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/301/#review442
---

Ship it!


I assume that this is correct.

- Nathan


On 2010-11-08 23:37:36, Gabe Black wrote:
 
 ---
 This is an automatically generated e-mail. To reply, visit:
 http://reviews.m5sim.org/r/301/
 ---
 
 (Updated 2010-11-08 23:37:36)
 
 
 Review request for Default.
 
 
 Summary
 ---
 
 SimObject: Use self when calling the clear_child method.
 
 
 Diffs
 -
 
   src/python/m5/SimObject.py f4362ffd810f 
 
 Diff: http://reviews.m5sim.org/r/301/diff
 
 
 Testing
 ---
 
 
 Thanks,
 
 Gabe
 


___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-09 Thread Gabe Black
 On 11/09/10 08:15, nathan binkert wrote:
  This code was apparently never called before, and I think I landed on
 it by accident. Could there be anything else like that? Maybe we should
 put together a test configuration?
 Do you know what you did to exercise it?  I don't recall writing this
 code.  Steve, do you remember what it's doing?

   Nate
 ___
 m5-dev mailing list
 m5-dev@m5sim.org
 http://m5sim.org/mailman/listinfo/m5-dev

Not really. I think it was the result of a bug in my script which I've
since fixed. I -think- what it might have been was that I was missing an
global so I had a SimObject that was a local variable that went out of
scope.

Also, while we're on the topic, I tried to stick a non-simobject,
non-parameter value into a simobject just to keep track of it, and it
didn't work. This was surprising and took me a little while to figure
out since that works just fine if you stick an abitrary simobject to it.
Is that intentional? It's something like this, although I didn't
specifically verify this code does what I think it does/seemed to be doing.

Root root()
tlb = Tlb()
foo = 5

root.tlb = tlb # works fine since tlb is a simobject
root.foo = foo # chokes saying something about the foo parameter not
being part of root since foo isn't a simobject
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-09 Thread nathan binkert
 Also, while we're on the topic, I tried to stick a non-simobject,
 non-parameter value into a simobject just to keep track of it, and it
 didn't work. This was surprising and took me a little while to figure
 out since that works just fine if you stick an abitrary simobject to it.
 Is that intentional? It's something like this, although I didn't
 specifically verify this code does what I think it does/seemed to be doing.

 Root root()
 tlb = Tlb()
 foo = 5

 root.tlb = tlb # works fine since tlb is a simobject
 root.foo = foo # chokes saying something about the foo parameter not
 being part of root since foo isn't a simobject

That is intentional.  Basically, all SimObjects are containers for
other objects whether or not there are specified parameters for them.
Anything else must be a parameter.

  Nate
___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


[m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-08 Thread Gabe Black

---
This is an automatically generated e-mail. To reply, visit:
http://reviews.m5sim.org/r/301/
---

Review request for Default.


Summary
---

SimObject: Use self when calling the clear_child method.


Diffs
-

  src/python/m5/SimObject.py f4362ffd810f 

Diff: http://reviews.m5sim.org/r/301/diff


Testing
---


Thanks,

Gabe

___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev


Re: [m5-dev] Review Request: SimObject: Use self when calling the clear_child method.

2010-11-08 Thread Gabe Black
 This code was apparently never called before, and I think I landed on
it by accident. Could there be anything else like that? Maybe we should
put together a test configuration?

Gabe

On 11/08/10 23:37, Gabe Black wrote:
 ---
 This is an automatically generated e-mail. To reply, visit:
 http://reviews.m5sim.org/r/301/
 ---

 Review request for Default.


 Summary
 ---

 SimObject: Use self when calling the clear_child method.


 Diffs
 -

   src/python/m5/SimObject.py f4362ffd810f 

 Diff: http://reviews.m5sim.org/r/301/diff


 Testing
 ---


 Thanks,

 Gabe

 ___
 m5-dev mailing list
 m5-dev@m5sim.org
 http://m5sim.org/mailman/listinfo/m5-dev

___
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev