summaryrefslogtreecommitdiff
path: root/src/systemc/core/scheduler.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-10 17:25:00 -0700
committerGabe Black <gabeblack@google.com>2018-10-09 21:45:00 +0000
commit86d82dff58d631318161127b67d5689bb44f76cf (patch)
tree0131fb1d4f161a3bc7ca20c03d0137f245e2c45c /src/systemc/core/scheduler.cc
parente4ab67f7176b3c11536698014c98681d3d36131b (diff)
downloadgem5-86d82dff58d631318161127b67d5689bb44f76cf.tar.xz
systemc: Keep all pre-init processes on a single list.
We were keeping track of processes which should be initialized and those which shouldn't on two different lists, and then processing each list one after the other. This could reorder processes from the order they were created, and so cause spurious differences which cause the Accellera tests to fail. This does make the scheduler slightly simpler, so it's not all bad. Change-Id: I63306a41ce7bea91fa9ff2f6774ce9150134ce48 Reviewed-on: https://gem5-review.googlesource.com/c/12613 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/scheduler.cc')
-rw-r--r--src/systemc/core/scheduler.cc52
1 files changed, 16 insertions, 36 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index 801580947..fe00ac0f8 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -88,8 +88,6 @@ Scheduler::clear()
deschedule(&maxTickEvent);
Process *p;
- while ((p = toFinalize.getNext()))
- p->popListNode();
while ((p = initList.getNext()))
p->popListNode();
while ((p = readyListMethods.getNext()))
@@ -105,24 +103,22 @@ Scheduler::clear()
void
Scheduler::initPhase()
{
- for (Process *p = toFinalize.getNext(); p; p = toFinalize.getNext()) {
+ for (Process *p = initList.getNext(); p; p = initList.getNext()) {
p->finalize();
p->popListNode();
- if (!p->hasStaticSensitivities() && !p->internal()) {
- SC_REPORT_WARNING(
- "(W558) disable() or dont_initialize() called on process "
- "with no static sensitivity, it will be orphaned",
- p->name());
+ if (p->dontInitialize()) {
+ if (!p->hasStaticSensitivities() && !p->internal()) {
+ SC_REPORT_WARNING(
+ "(W558) disable() or dont_initialize() called on "
+ "process with no static sensitivity, it will be "
+ "orphaned", p->name());
+ }
+ } else {
+ p->ready();
}
}
- for (Process *p = initList.getNext(); p; p = initList.getNext()) {
- p->finalize();
- p->popListNode();
- p->ready();
- }
-
runUpdate();
runDelta();
@@ -147,8 +143,9 @@ Scheduler::reg(Process *p)
if (initDone) {
// If we're past initialization, finalize static sensitivity.
p->finalize();
- // Mark the process as ready.
- p->ready();
+ // If not marked as dontInitialize, mark as ready.
+ if (!p->dontInitialize())
+ p->ready();
} else {
// Otherwise, record that this process should be initialized once we
// get there.
@@ -157,20 +154,6 @@ Scheduler::reg(Process *p)
}
void
-Scheduler::dontInitialize(Process *p)
-{
- if (initDone) {
- // Pop this process off of the ready list.
- p->popListNode();
- } else {
- // Push this process onto the list of processes which still need
- // their static sensitivity to be finalized. That implicitly pops it
- // off the list of processes to be initialized/marked ready.
- toFinalize.pushLast(p);
- }
-}
-
-void
Scheduler::yield()
{
// Pull a process from the active list.
@@ -240,15 +223,12 @@ Scheduler::suspend(Process *p)
{
bool was_ready;
if (initDone) {
- // After initialization, the only list we can be on is the ready list.
+ // After initialization, check if we're on a ready list.
was_ready = (p->nextListNode != nullptr);
p->popListNode();
} else {
- // Check the ready lists to see if we find this process.
- was_ready = listContains(&readyListMethods, p) ||
- listContains(&readyListThreads, p);
- if (was_ready)
- toFinalize.pushLast(p);
+ // Nothing is ready before init.
+ was_ready = false;
}
return was_ready;
}