summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-10-06 02:58:02 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 01:02:06 +0000
commita7d99be947c80de4647d07fd4f73c19cc4050a77 (patch)
treeb59d98011d72ebc847ce5f73cbf2063f1f7cac13
parent9677f2da711edc3382e754c7dfd62464e904a9e9 (diff)
downloadgem5-a7d99be947c80de4647d07fd4f73c19cc4050a77.tar.xz
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>
-rw-r--r--src/systemc/core/SConscript1
-rw-r--r--src/systemc/core/process.cc7
-rw-r--r--src/systemc/core/process.hh2
-rw-r--r--src/systemc/core/process_types.cc46
-rw-r--r--src/systemc/core/process_types.hh2
5 files changed, 5 insertions, 53 deletions
diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript
index 230304214..0ce10290d 100644
--- a/src/systemc/core/SConscript
+++ b/src/systemc/core/SConscript
@@ -37,7 +37,6 @@ if env['USE_SYSTEMC']:
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 3bf7ead07..93542fc00 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -206,9 +206,10 @@ Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids)
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 0331f0786..86ca6744e 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -84,7 +84,7 @@ class Process : public ::sc_core::sc_process_b, public ListNode
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 188225c02..000000000
--- 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 748c24914..1361e9745 100644
--- a/src/systemc/core/process_types.hh
+++ b/src/systemc/core/process_types.hh
@@ -63,8 +63,6 @@ class Thread : public Process
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
{