Gabe Black has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/12443 )

Change subject: systemc: Make Process track whether it's dynamic on its own.
......................................................................

systemc: Make Process track whether it's dynamic on its own.

Processes which are created in end_of_elaboration aren't created with
sc_spawn but still need to figure out if they're dynamic. Rather than
duplicate the check in sc_spawn, this change centralizes it in the
Process class itself.

Change-Id: I763d5a0fa89a72fbc82346b6ce2eed852ee72524
Reviewed-on: https://gem5-review.googlesource.com/c/12443
Reviewed-by: Gabe Black <[email protected]>
Maintainer: Gabe Black <[email protected]>
---
M src/systemc/core/process.cc
M src/systemc/core/process.hh
M src/systemc/core/process_types.hh
M src/systemc/core/sc_spawn.cc
4 files changed, 14 insertions(+), 19 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved; Looks good to me, approved



diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index 0784ab4..830b8c7 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -390,13 +390,15 @@

::sc_core::sc_report *Process::lastReport() const { return _lastReport.get(); }

-Process::Process(const char *name, ProcessFuncWrapper *func, bool _dynamic) :
+Process::Process(const char *name, ProcessFuncWrapper *func) :
     ::sc_core::sc_process_b(name), excWrapper(nullptr), func(func),
-    _needsStart(true), _dynamic(_dynamic), _isUnwinding(false),
-    _terminated(false), _suspended(false), _disabled(false),
-    _syncReset(false), refCount(0), stackSize(::Fiber::DefaultStackSize),
-    dynamicSensitivity(nullptr)
+    _needsStart(true), _isUnwinding(false), _terminated(false),
+    _suspended(false), _disabled(false), _syncReset(false), refCount(0),
+    stackSize(::Fiber::DefaultStackSize), dynamicSensitivity(nullptr)
 {
+    _dynamic =
+            (::sc_core::sc_get_status() >
+             ::sc_core::SC_BEFORE_END_OF_ELABORATION);
     _newest = this;
 }

diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh
index 0cb3e3c..0d852af 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -327,7 +327,7 @@
     ::sc_core::sc_report *lastReport() const;

   protected:
-    Process(const char *name, ProcessFuncWrapper *func, bool _dynamic);
+    Process(const char *name, ProcessFuncWrapper *func);

     static Process *_newest;

diff --git a/src/systemc/core/process_types.hh b/src/systemc/core/process_types.hh
index 2dde467..5fbab80 100644
--- a/src/systemc/core/process_types.hh
+++ b/src/systemc/core/process_types.hh
@@ -39,9 +39,7 @@
 class Method : public Process
 {
   public:
- Method(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
-        Process(name, func, _dynamic)
-    {}
+ Method(const char *name, ProcessFuncWrapper *func) : Process(name, func) {}

     const char *kind() const override { return "sc_method_process"; }

@@ -55,8 +53,8 @@
 class Thread : public Process
 {
   public:
- Thread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
-        Process(name, func, _dynamic), ctx(nullptr)
+    Thread(const char *name, ProcessFuncWrapper *func) :
+        Process(name, func), ctx(nullptr)
     {}

     ~Thread() { delete ctx; }
@@ -105,8 +103,7 @@
 class CThread : public Thread
 {
   public:
- CThread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
-        Thread(name, func, _dynamic)
+ CThread(const char *name, ProcessFuncWrapper *func) : Thread(name, func)
     {
         // We'll be in the initialization list now, but we shouldn't be.
         popListNode();
diff --git a/src/systemc/core/sc_spawn.cc b/src/systemc/core/sc_spawn.cc
index 054feb8..b0570a6 100644
--- a/src/systemc/core/sc_spawn.cc
+++ b/src/systemc/core/sc_spawn.cc
@@ -60,15 +60,11 @@
             name = ::sc_core::sc_gen_unique_name("thread_p");
     }

-    bool dynamic =
-        (::sc_core::sc_get_status() >
-         ::sc_core::SC_BEFORE_END_OF_ELABORATION);
-
     Process *proc;
     if (method)
-        proc = new Method(name, func, dynamic);
+        proc = new Method(name, func);
     else
-        proc = new Thread(name, func, dynamic);
+        proc = new Thread(name, func);

     if (opts) {
         for (auto e: opts->_events)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12443
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: I763d5a0fa89a72fbc82346b6ce2eed852ee72524
Gerrit-Change-Number: 12443
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Giacomo Travaglini <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Matthias Jung <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to