Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/10842

Change subject: systemc: Add an opaque pointer to the sc_process_handle class.
......................................................................

systemc: Add an opaque pointer to the sc_process_handle class.

The pointer will point to a class which actually holds the state of a
process. Some code in the data types tries to determine what process
is currently running, and it can't do that because the process handle
returned by the appropriate function is a temporary which lets you
*manipulate* the current process, but not identify it uniquely.

By making this internal pointer extractable, multiple process handles
which refer to the same underlying process can be compared correctly.

While it is possible to compare to sc_process_handle instances using
the overridden == and != operators, the code in question also needs to
represent when it doesn't have a process to refer to which it does
with a null pointer. To the best of my knowledge, there's no
sc_process_handle equivalent to a null pointer.

Change-Id: I2ef212c38216c8aa66e6bbd00f892a1b9a6c2ae7
---
M src/systemc/ext/core/sc_process_handle.hh
1 file changed, 21 insertions(+), 0 deletions(-)



diff --git a/src/systemc/ext/core/sc_process_handle.hh b/src/systemc/ext/core/sc_process_handle.hh
index ce3fe03..a928ab3 100644
--- a/src/systemc/ext/core/sc_process_handle.hh
+++ b/src/systemc/ext/core/sc_process_handle.hh
@@ -33,6 +33,13 @@
 #include <exception>
 #include <vector>

+namespace sc_gem5
+{
+
+class Process;
+
+} // namespace sc_gem5
+
 namespace sc_core
 {

@@ -67,12 +74,26 @@

 class sc_process_handle
 {
+  private:
+    ::sc_gem5::Process *_gem5_process;
+
   public:
     sc_process_handle();
     sc_process_handle(const sc_process_handle &);
     explicit sc_process_handle(sc_object *);
     ~sc_process_handle();

+ // These non-standard operators provide access to the data structure which + // actually tracks the process within gem5. By making them operators, we
+    // can minimize the symbols added to the class namespace.
+    operator ::sc_gem5::Process * () const { return _gem5_process; }
+    sc_process_handle &
+    operator = (::sc_gem5::Process *p)
+    {
+        _gem5_process = p;
+        return *this;
+    }
+
     bool valid() const;

     sc_process_handle &operator = (const sc_process_handle &);

--
To view, visit https://gem5-review.googlesource.com/10842
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: I2ef212c38216c8aa66e6bbd00f892a1b9a6c2ae7
Gerrit-Change-Number: 10842
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to