On Jun 13, 2008, at 12:04 PM, nathan binkert wrote:

>> Where do we have circular references? You can't construct objects  
>> with
>> circular references in C++, so why do we need it in Python?
>
> Actually, you can construct C++ objects with circular references, but
> the pointers are not valid in the constructor.  The pointers aren't
> valid until init() or later.
>
> I'm not sure if this was used in practice.  I could look into changing
> it.  This is not something that is going to get solved super quickly
> though.
We do have circular references in the C++ objects but they're not  
setup through Python. The subobjects constructor sets the back  
pointer.  For example the Tsunami object has a pointer to each  
Tsunami*Chip object so when the Tsunami*Chip object is constructed it  
has a pointer to Tsunami and sets the back pointer there. At  
Tsunami::init() all the pointers are setup. Python didn't need to  
handle the circular references for this to work though.

Ali

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

Reply via email to