Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/13334

Change subject: systemc: Don't re-schedule a process which is already scheduled.
......................................................................

systemc: Don't re-schedule a process which is already scheduled.

Change-Id: I8e12713c49aad03d0bfb779883adcbfa8fd4b42e
---
M src/systemc/core/process.cc
M src/systemc/core/process.hh
M src/systemc/core/scheduler.cc
3 files changed, 12 insertions(+), 4 deletions(-)



diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index a0759d9..e29cee0 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -359,7 +359,7 @@
         return;
     if (suspended())
         _suspendedReady = true;
-    else
+    else if (!scheduled())
         scheduler.ready(this);
 }

@@ -381,9 +381,10 @@
     timeoutEvent([this]() { this->timeout(); }),
func(func), _internal(internal), _timedOut(false), _dontInitialize(false),
     _needsStart(true), _isUnwinding(false), _terminated(false),
- _suspended(false), _disabled(false), _syncReset(false), syncResetCount(0),
-    asyncResetCount(0), _waitCount(0), refCount(0),
-    stackSize(::Fiber::DefaultStackSize), dynamicSensitivity(nullptr)
+    _scheduled(false), _suspended(false), _disabled(false),
+ _syncReset(false), syncResetCount(0), asyncResetCount(0), _waitCount(0),
+    refCount(0), stackSize(::Fiber::DefaultStackSize),
+    dynamicSensitivity(nullptr)
 {
     _dynamic =
             (::sc_core::sc_get_status() >
diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh
index d50c829..12901bc 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -72,6 +72,9 @@
     void isUnwinding(bool v) { _isUnwinding = v; }
     bool terminated() const { return _terminated; }

+    bool scheduled() const { return _scheduled; }
+    void scheduled(bool new_val) { _scheduled = new_val; }
+
     void forEachKid(const std::function<void(Process *)> &work);

     bool suspended() const { return _suspended; }
@@ -172,6 +175,7 @@
     bool _dynamic;
     bool _isUnwinding;
     bool _terminated;
+    bool _scheduled;

     void terminate();

diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index ec91c79..52bf7ec 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -165,6 +165,7 @@
         Fiber::primaryFiber()->run();
     } else {
         _current->popListNode();
+        _current->scheduled(false);
         // Switch to whatever Fiber is supposed to run this process. All
         // Fibers which aren't running should be parked at this line.
         _current->fiber()->run();
@@ -199,6 +200,8 @@
     if (_stopNow)
         return;

+    p->scheduled(true);
+
     if (p->procKind() == ::sc_core::SC_METHOD_PROC_)
         readyListMethods.pushLast(p);
     else

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/13334
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I8e12713c49aad03d0bfb779883adcbfa8fd4b42e
Gerrit-Change-Number: 13334
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to