> On 2010-06-28 17:41:44, Nathan Binkert wrote:
> > src/python/m5/stats.py, line 62
> > <http://reviews.m5sim.org/r/27/diff/2/?file=618#file618line62>
> >
> >     Not sure if it matters at all, but you've changed the order of reset.  
> > Currently, we reset stats and then reset objects.  I hope that nothing 
> > depends on this order, but I thought I'd mention it.

Since this ordering was implicit in the order that reset callbacks are 
registered and invoked--it took me a while to prove to myself that you were 
right--I'd sure hope nothing depended on it.  I've seen no evidence of it 
either.


> On 2010-06-28 17:41:44, Nathan Binkert wrote:
> > src/python/m5/SimObject.py, line 773
> > <http://reviews.m5sim.org/r/27/diff/2/?file=615#file615line773>
> >
> >     Not sure if it is worth it, but we could add the following to 
> > __getattr__(self, attr):
> >     
> >     try:
> >         return getattr(self._ccObject, attr)
> >     except AttributeError:
> >         pass
> >     
> >     There are two failures, _ccObject doesn't exist yet, and attr is not 
> > found.  I think both are handled by AttributeError.  Anyway it's just an 
> > idea since the code looks repetitive.  Could also do:
> >     if attr in ('init', 'regStats' .....):
> >        return getattr(self._ccObject, attr)
> >     
> >     Just less code and I know that you like less code :)
> 
> Steve Reinhardt wrote:
>     Sounds good to me... I'll give it a try.
>

I did this to be more parallel with the rest of __getattr__:

        # If the attribute exists on the C++ object, transparently
        # forward the reference there.  This is typically used for
        # SWIG-wrapped methods such as init(), regStats(),
        # regFormulas(), resetStats(), and startup().
        if self._ccObject and hasattr(self._ccObject, attr):
            return getattr(self._ccObject, attr)

It seems to work.


> On 2010-06-28 17:41:44, Nathan Binkert wrote:
> > src/python/m5/SimObject.py, line 767
> > <http://reviews.m5sim.org/r/27/diff/2/?file=615#file615line767>
> >
> >     I wonder if Children doesn't quite describe it right since children 
> > doesn't obviously imply recursion.  iterDescendants?  (I don't have strong 
> > feelings here.)
> 
> Steve Reinhardt wrote:
>     I don't disagree, but don't have a lot of great alternatives.  
> iterDescendants is too long.  iterTree?

iterAll is my current favorite...


- Steve


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


On 2010-06-27 23:41:59, Steve Reinhardt wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/27/
> -----------------------------------------------------------
> 
> (Updated 2010-06-27 23:41:59)
> 
> 
> Review request for Default.
> 
> 
> Summary
> -------
> 
> sim: move iterating over SimObjects into Python.
> 
> 
> Diffs
> -----
> 
>   src/python/m5/SimObject.py 5044bb906d5a 
>   src/python/m5/core.py 5044bb906d5a 
>   src/python/m5/simulate.py 5044bb906d5a 
>   src/python/m5/stats.py 5044bb906d5a 
>   src/python/swig/core.i 5044bb906d5a 
>   src/python/swig/pyobject.hh 5044bb906d5a 
>   src/python/swig/sim_object.i 5044bb906d5a 
>   src/sim/sim_object.hh 5044bb906d5a 
>   src/sim/sim_object.cc 5044bb906d5a 
> 
> Diff: http://reviews.m5sim.org/r/27/diff
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Steve
> 
>

_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to