systemc: Remove a redundant injectException for Thread's throw_it.

For some reason lost to the sands of time, the throw_it function was
virtual for the Thread class, and that class would call the base
class's throw_it, and then also injectException itself. That would
result in the exception being injected into the thread twice which is
incorrect.

Since it's not clear what the original intention of this code was, the
throw_it function is now no longer virtual, and the one useful aspect
of it, a check if the process is already terminated, was moved into the
base class function.

Change-Id: I7fb14baa7728bd1e9206011870b6ccaa9c4e8c64
Reviewed-on: https://gem5-review.googlesource.com/c/13312
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript
index 2303042..0ce1029 100644
--- a/src/systemc/core/SConscript
+++ b/src/systemc/core/SConscript
@@ -37,7 +37,6 @@
     Source('object.cc')
     Source('port.cc')
     Source('process.cc')
-    Source('process_types.cc')
     Source('python.cc')
     Source('scheduler.cc')
     Source('sched_event.cc')
diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index 3bf7ead..93542fc 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -206,9 +206,10 @@
     if (inc_kids)
         forEachKid([&exc](Process *p) { p->throw_it(exc, true); });
 
-    // Only inject an exception into threads that have started.
-    if (!_needsStart)
-        injectException(exc);
+    if (_needsStart || _terminated)
+        return;
+
+    injectException(exc);
 }
 
 void
diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh
index 0331f07..86ca674 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -84,7 +84,7 @@
 
     void kill(bool inc_kids);
     void reset(bool inc_kids);
-    virtual void throw_it(ExceptionWrapperBase &exc, bool inc_kids);
+    void throw_it(ExceptionWrapperBase &exc, bool inc_kids);
 
     void injectException(ExceptionWrapperBase &exc);
     ExceptionWrapperBase *excWrapper;
diff --git a/src/systemc/core/process_types.cc b/src/systemc/core/process_types.cc
deleted file mode 100644
index 188225c..0000000
--- a/src/systemc/core/process_types.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2018 Google, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met: redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer;
- * redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution;
- * neither the name of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Gabe Black
- */
-
-#include "systemc/core/process_types.hh"
-
-namespace sc_gem5
-{
-
-void
-Thread::throw_it(ExceptionWrapperBase &exc, bool inc_kids)
-{
-    Process::throw_it(exc, inc_kids);
-
-    if (_terminated)
-        return;
-
-    injectException(exc);
-}
-
-} // namespace sc_gem5
diff --git a/src/systemc/core/process_types.hh b/src/systemc/core/process_types.hh
index 748c249..1361e97 100644
--- a/src/systemc/core/process_types.hh
+++ b/src/systemc/core/process_types.hh
@@ -63,8 +63,6 @@
 
     const char *kind() const override { return "sc_thread_process"; }
 
-    void throw_it(ExceptionWrapperBase &exc, bool inc_kids) override;
-
     sc_core::sc_curr_proc_kind
     procKind() const override
     {