summaryrefslogtreecommitdiff
path: root/src/systemc/core
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-05 19:28:44 -0700
committerGabe Black <gabeblack@google.com>2018-10-09 21:38:23 +0000
commit5ed90fffb6bdbbd5fe2316687faff05f641d6692 (patch)
tree842b96779ee67fec12d7ba48a017791b02cf117d /src/systemc/core
parentdee485ff6779ef81b8d26c68041ded4065fb1402 (diff)
downloadgem5-5ed90fffb6bdbbd5fe2316687faff05f641d6692.tar.xz
systemc: Warn if a process is dont_initialize with no static sensitivieis.
Change-Id: I4db64f42872a6fb459faa401abdad3f168297347 Reviewed-on: https://gem5-review.googlesource.com/c/12599 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core')
-rw-r--r--src/systemc/core/process.cc9
-rw-r--r--src/systemc/core/process.hh8
-rw-r--r--src/systemc/core/process_types.hh11
-rw-r--r--src/systemc/core/sc_spawn.cc10
-rw-r--r--src/systemc/core/scheduler.cc7
5 files changed, 36 insertions, 9 deletions
diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index b8eab3cde..317e8c3a2 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -396,11 +396,12 @@ Process::lastReport(::sc_core::sc_report *report)
::sc_core::sc_report *Process::lastReport() const { return _lastReport.get(); }
-Process::Process(const char *name, ProcessFuncWrapper *func) :
+Process::Process(const char *name, ProcessFuncWrapper *func, bool internal) :
::sc_core::sc_process_b(name), excWrapper(nullptr), func(func),
- _needsStart(true), _isUnwinding(false), _terminated(false),
- _suspended(false), _disabled(false), _syncReset(false), refCount(0),
- stackSize(::Fiber::DefaultStackSize), dynamicSensitivity(nullptr)
+ _internal(internal), _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() >
diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh
index d28d46396..4b43e1b7b 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -336,8 +336,11 @@ class Process : public ::sc_core::sc_process_b, public ListNode
void lastReport(::sc_core::sc_report *report);
::sc_core::sc_report *lastReport() const;
+ bool hasStaticSensitivities() { return !staticSensitivities.empty(); }
+ bool internal() { return _internal; }
+
protected:
- Process(const char *name, ProcessFuncWrapper *func);
+ Process(const char *name, ProcessFuncWrapper *func, bool internal=false);
static Process *_newest;
@@ -354,6 +357,9 @@ class Process : public ::sc_core::sc_process_b, public ListNode
ProcessFuncWrapper *func;
sc_core::sc_curr_proc_kind _procKind;
+
+ bool _internal;
+
bool _needsStart;
bool _dynamic;
bool _isUnwinding;
diff --git a/src/systemc/core/process_types.hh b/src/systemc/core/process_types.hh
index 5fbab8038..6f603e73f 100644
--- a/src/systemc/core/process_types.hh
+++ b/src/systemc/core/process_types.hh
@@ -39,7 +39,9 @@ namespace sc_gem5
class Method : public Process
{
public:
- Method(const char *name, ProcessFuncWrapper *func) : Process(name, func) {}
+ Method(const char *name, ProcessFuncWrapper *func, bool internal=false) :
+ Process(name, func, internal)
+ {}
const char *kind() const override { return "sc_method_process"; }
@@ -53,8 +55,8 @@ class Method : public Process
class Thread : public Process
{
public:
- Thread(const char *name, ProcessFuncWrapper *func) :
- Process(name, func), ctx(nullptr)
+ Thread(const char *name, ProcessFuncWrapper *func, bool internal=false) :
+ Process(name, func, internal), ctx(nullptr)
{}
~Thread() { delete ctx; }
@@ -103,7 +105,8 @@ class Thread : public Process
class CThread : public Thread
{
public:
- CThread(const char *name, ProcessFuncWrapper *func) : Thread(name, func)
+ CThread(const char *name, ProcessFuncWrapper *func, bool internal=false) :
+ Thread(name, func, internal)
{
// 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 b0570a663..00fe502e6 100644
--- a/src/systemc/core/sc_spawn.cc
+++ b/src/systemc/core/sc_spawn.cc
@@ -83,6 +83,16 @@ spawnWork(ProcessFuncWrapper *func, const char *name,
proc->addStatic(new PendingSensitivityFinder(proc, f));
}
+ if (opts && opts->_dontInitialize &&
+ opts->_events.empty() && opts->_ports.empty() &&
+ opts->_exports.empty() && opts->_interfaces.empty() &&
+ opts->_finders.empty()) {
+ SC_REPORT_WARNING(
+ "(W558) disable() or dont_initialize() called on process "
+ "with no static sensitivity, it will be orphaned",
+ proc->name());
+ }
+
scheduler.reg(proc);
if (dontInitialize)
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index 78b47cd4d..4c98b68aa 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -106,6 +106,13 @@ Scheduler::initPhase()
for (Process *p = toFinalize.getNext(); p; p = toFinalize.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());
+ }
}
for (Process *p = initList.getNext(); p; p = initList.getNext()) {