systemc: Check the process type when using sc_join.
authorGabe Black <gabeblack@google.com>
Sat, 22 Sep 2018 13:35:06 +0000 (06:35 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 00:28:49 +0000 (00:28 +0000)
Method processes aren't allowed in an sc_join.

Change-Id: I5c8421a396dbe261645a074df514f69fc652c9c8
Reviewed-on: https://gem5-review.googlesource.com/c/12968
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/sc_join.cc
src/systemc/tests/systemc/kernel/dynamic_processes/test04/expected_returncode [new file with mode: 0644]

index 3e4c6eec432cc75c35b17c5204bc9a509fc85142..3c27eaa42d553eb3b0b74d27a84ac5818cc5e914 100644 (file)
@@ -32,6 +32,7 @@
 #include "systemc/ext/core/sc_event.hh"
 #include "systemc/ext/core/sc_join.hh"
 #include "systemc/ext/core/sc_module.hh"
+#include "systemc/ext/utils/sc_report_handler.hh"
 
 namespace sc_core
 {
@@ -44,6 +45,12 @@ sc_join::add_process(sc_process_handle h)
     auto p = (::sc_gem5::Process *)h;
     assert(p);
 
+    if (p->procKind() == SC_METHOD_PROC_) {
+        SC_REPORT_ERROR("(E561) Attempt to register method process "
+                "with sc_join object", "");
+        return;
+    }
+
     remaining++;
     p->joinWait(this);
 }
diff --git a/src/systemc/tests/systemc/kernel/dynamic_processes/test04/expected_returncode b/src/systemc/tests/systemc/kernel/dynamic_processes/test04/expected_returncode
new file mode 100644 (file)
index 0000000..d00491f
--- /dev/null
@@ -0,0 +1 @@
+1