summaryrefslogtreecommitdiff
path: root/sim/param.cc
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2004-10-25 00:56:47 -0400
committerSteve Reinhardt <stever@eecs.umich.edu>2004-10-25 00:56:47 -0400
commite852f9e31a8157f109058e6f3fdb4e86cc0cb10c (patch)
treefff5b2806698b621455afc3f1c639c402008987d /sim/param.cc
parent400daa7e41057ec358691afeffe35ffa430d11b0 (diff)
downloadgem5-e852f9e31a8157f109058e6f3fdb4e86cc0cb10c.tar.xz
Add explicit phases to order ParamContext initializations.
--HG-- extra : convert_revision : c24fba2bded2493a892fa93de0c61f9674cfedbb
Diffstat (limited to 'sim/param.cc')
-rw-r--r--sim/param.cc20
1 files changed, 16 insertions, 4 deletions
diff --git a/sim/param.cc b/sim/param.cc
index 84ecbf8f9..d20be8d33 100644
--- a/sim/param.cc
+++ b/sim/param.cc
@@ -560,15 +560,27 @@ SimObjectBaseParam::parse(const string &s, vector<SimObject *>&value)
list<ParamContext *> *ParamContext::ctxList = NULL;
-ParamContext::ParamContext(const string &_iniSection, bool noAutoParse)
+ParamContext::ParamContext(const string &_iniSection, InitPhase _initPhase)
: iniFilePtr(NULL), // initialized on call to parseParams()
- iniSection(_iniSection), paramList(NULL)
+ iniSection(_iniSection), paramList(NULL),
+ initPhase(_initPhase)
{
- if (!noAutoParse) {
+ // Put this context on global list for initialization
+ if (initPhase != NoAutoInit) {
if (ctxList == NULL)
ctxList = new list<ParamContext *>();
- (*ctxList).push_back(this);
+ // keep list sorted by ascending initPhase values
+ list<ParamContext *>::iterator i = ctxList->begin();
+ list<ParamContext *>::iterator end = ctxList->end();
+ for (; i != end; ++i) {
+ if (initPhase <= (*i)->initPhase) {
+ // found where we want to insert
+ break;
+ }
+ }
+ // (fall through case: insert at end)
+ ctxList->insert(i, this);
}
}