Hi,
Does M5 keep any order when calling init() of different objects?
In Ruby, because of dependencies among some objects (like topology and
network), the order of calling init() is important and handled in
constructor of System (the main module).
How can I keep this kind of ordering in M5?
There's no real control over ordering... I believe init() is called on
objects in the same order that they were constructed, but you don't have a
lot of control over the construction order (short of the fact that if B is a
parameter to A then B will be constructed first) and it's probably best not
I believe there are only a few (maybe one?) case(s) where the Ruby
initialization dependencies are pretty ugly. The one I know about is
a dependency between the Ruby network and the topology class. Given
the limited scope of the problem, I think Steve's null init function
should suffice.
-Derek
(moving this over to m5-dev)
M5 has a multi-phase startup process too for dealing with these
dependencies. I don't see it documented explicitly anywhere unfortunately.
Here's the gist of it though (based on a combination of memory and quick
code browsing, so it may not be authoritative):
- As
- You're guaranteed that any SimObject that is passed to you as a parameter
has been constructed before your constructor is called, so that the pointer
in the params struct is valid. Since init() hasn't been called yet you
can't assume too much about what that other object is prepared to do
On Thu, Jul 9, 2009 at 1:24 PM, nathan binkert n...@binkert.org wrote:
- You're guaranteed that any SimObject that is passed to you as a
parameter
has been constructed before your constructor is called, so that the
pointer
in the params struct is valid. Since init() hasn't been called
Quoting nathan binkert n...@binkert.org:
- You're guaranteed that any SimObject that is passed to you as a parameter
has been constructed before your constructor is called, so that the pointer
in the params struct is valid. Since init() hasn't been called yet you
can't assume too much about