process.cc revision 13182
112952Sgabeblack@google.com/* 212952Sgabeblack@google.com * Copyright 2018 Google, Inc. 312952Sgabeblack@google.com * 412952Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512952Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612952Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712952Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812952Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912952Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012952Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112952Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212952Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312952Sgabeblack@google.com * this software without specific prior written permission. 1412952Sgabeblack@google.com * 1512952Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612952Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712952Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812952Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912952Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012952Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112952Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212952Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312952Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412952Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512952Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612952Sgabeblack@google.com * 2712952Sgabeblack@google.com * Authors: Gabe Black 2812952Sgabeblack@google.com */ 2912952Sgabeblack@google.com 3012952Sgabeblack@google.com#include "systemc/core/process.hh" 3112957Sgabeblack@google.com 3212957Sgabeblack@google.com#include "base/logging.hh" 3312957Sgabeblack@google.com#include "systemc/core/event.hh" 3412953Sgabeblack@google.com#include "systemc/core/scheduler.hh" 3513102Sgabeblack@google.com#include "systemc/ext/core/sc_main.hh" 3612998Sgabeblack@google.com#include "systemc/ext/core/sc_process_handle.hh" 3712998Sgabeblack@google.com#include "systemc/ext/utils/sc_report_handler.hh" 3812952Sgabeblack@google.com 3912952Sgabeblack@google.comnamespace sc_gem5 4012952Sgabeblack@google.com{ 4112952Sgabeblack@google.com 4212957Sgabeblack@google.comSensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) : 4313063Sgabeblack@google.com Sensitivity(p), timeoutEvent([this]() { this->timeout(); }) 4412957Sgabeblack@google.com{ 4513063Sgabeblack@google.com scheduler.schedule(&timeoutEvent, t); 4612957Sgabeblack@google.com} 4712957Sgabeblack@google.com 4812957Sgabeblack@google.comSensitivityTimeout::~SensitivityTimeout() 4912957Sgabeblack@google.com{ 5012957Sgabeblack@google.com if (timeoutEvent.scheduled()) 5112962Sgabeblack@google.com scheduler.deschedule(&timeoutEvent); 5212962Sgabeblack@google.com} 5312962Sgabeblack@google.com 5412962Sgabeblack@google.comvoid 5512962Sgabeblack@google.comSensitivityTimeout::timeout() 5612962Sgabeblack@google.com{ 5712962Sgabeblack@google.com notify(); 5812957Sgabeblack@google.com} 5912957Sgabeblack@google.com 6012957Sgabeblack@google.comSensitivityEvent::SensitivityEvent( 6112957Sgabeblack@google.com Process *p, const ::sc_core::sc_event *e) : Sensitivity(p), event(e) 6212957Sgabeblack@google.com{ 6312957Sgabeblack@google.com Event::getFromScEvent(event)->addSensitivity(this); 6412957Sgabeblack@google.com} 6512957Sgabeblack@google.com 6612957Sgabeblack@google.comSensitivityEvent::~SensitivityEvent() 6712957Sgabeblack@google.com{ 6812957Sgabeblack@google.com Event::getFromScEvent(event)->delSensitivity(this); 6912957Sgabeblack@google.com} 7012957Sgabeblack@google.com 7112957Sgabeblack@google.comSensitivityEventAndList::SensitivityEventAndList( 7212957Sgabeblack@google.com Process *p, const ::sc_core::sc_event_and_list *list) : 7312957Sgabeblack@google.com Sensitivity(p), list(list), count(0) 7412957Sgabeblack@google.com{ 7512957Sgabeblack@google.com for (auto e: list->events) 7612957Sgabeblack@google.com Event::getFromScEvent(e)->addSensitivity(this); 7712957Sgabeblack@google.com} 7812957Sgabeblack@google.com 7912957Sgabeblack@google.comSensitivityEventAndList::~SensitivityEventAndList() 8012957Sgabeblack@google.com{ 8112957Sgabeblack@google.com for (auto e: list->events) 8212957Sgabeblack@google.com Event::getFromScEvent(e)->delSensitivity(this); 8312957Sgabeblack@google.com} 8412957Sgabeblack@google.com 8512957Sgabeblack@google.comvoid 8612957Sgabeblack@google.comSensitivityEventAndList::notifyWork(Event *e) 8712957Sgabeblack@google.com{ 8812957Sgabeblack@google.com e->delSensitivity(this); 8912957Sgabeblack@google.com count++; 9012957Sgabeblack@google.com if (count == list->events.size()) 9112959Sgabeblack@google.com process->satisfySensitivity(this); 9212957Sgabeblack@google.com} 9312957Sgabeblack@google.com 9412957Sgabeblack@google.comSensitivityEventOrList::SensitivityEventOrList( 9512957Sgabeblack@google.com Process *p, const ::sc_core::sc_event_or_list *list) : 9612957Sgabeblack@google.com Sensitivity(p), list(list) 9712957Sgabeblack@google.com{ 9812957Sgabeblack@google.com for (auto e: list->events) 9912957Sgabeblack@google.com Event::getFromScEvent(e)->addSensitivity(this); 10012957Sgabeblack@google.com} 10112957Sgabeblack@google.com 10212957Sgabeblack@google.comSensitivityEventOrList::~SensitivityEventOrList() 10312957Sgabeblack@google.com{ 10412957Sgabeblack@google.com for (auto e: list->events) 10512957Sgabeblack@google.com Event::getFromScEvent(e)->delSensitivity(this); 10612957Sgabeblack@google.com} 10712957Sgabeblack@google.com 10813075Sgabeblack@google.comvoid 10913075Sgabeblack@google.comSensitivityTimeoutAndEventAndList::notifyWork(Event *e) 11013075Sgabeblack@google.com{ 11113075Sgabeblack@google.com if (e) { 11213075Sgabeblack@google.com // An event went off which must be part of the sc_event_and_list. 11313075Sgabeblack@google.com SensitivityEventAndList::notifyWork(e); 11413075Sgabeblack@google.com } else { 11513075Sgabeblack@google.com // There's no inciting event, so this must be a timeout. 11613075Sgabeblack@google.com SensitivityTimeout::notifyWork(e); 11713075Sgabeblack@google.com } 11813075Sgabeblack@google.com} 11913075Sgabeblack@google.com 12012957Sgabeblack@google.com 12112952Sgabeblack@google.comclass UnwindExceptionReset : public ::sc_core::sc_unwind_exception 12212952Sgabeblack@google.com{ 12312952Sgabeblack@google.com public: 12412995Sgabeblack@google.com UnwindExceptionReset() { _isReset = true; } 12512952Sgabeblack@google.com}; 12612952Sgabeblack@google.com 12712952Sgabeblack@google.comclass UnwindExceptionKill : public ::sc_core::sc_unwind_exception 12812952Sgabeblack@google.com{ 12912952Sgabeblack@google.com public: 13012995Sgabeblack@google.com UnwindExceptionKill() {} 13112952Sgabeblack@google.com}; 13212952Sgabeblack@google.com 13312952Sgabeblack@google.comtemplate <typename T> 13412952Sgabeblack@google.comstruct BuiltinExceptionWrapper : public ExceptionWrapperBase 13512952Sgabeblack@google.com{ 13612952Sgabeblack@google.com public: 13712952Sgabeblack@google.com T t; 13812952Sgabeblack@google.com void throw_it() override { throw t; } 13912952Sgabeblack@google.com}; 14012952Sgabeblack@google.com 14112952Sgabeblack@google.comBuiltinExceptionWrapper<UnwindExceptionReset> resetException; 14212952Sgabeblack@google.comBuiltinExceptionWrapper<UnwindExceptionKill> killException; 14312952Sgabeblack@google.com 14412952Sgabeblack@google.com 14512952Sgabeblack@google.comvoid 14612952Sgabeblack@google.comProcess::forEachKid(const std::function<void(Process *)> &work) 14712952Sgabeblack@google.com{ 14812952Sgabeblack@google.com for (auto &kid: get_child_objects()) { 14912952Sgabeblack@google.com Process *p_kid = dynamic_cast<Process *>(kid); 15012952Sgabeblack@google.com if (p_kid) 15112952Sgabeblack@google.com work(p_kid); 15212952Sgabeblack@google.com } 15312952Sgabeblack@google.com} 15412952Sgabeblack@google.com 15512952Sgabeblack@google.comvoid 15612952Sgabeblack@google.comProcess::suspend(bool inc_kids) 15712952Sgabeblack@google.com{ 15812952Sgabeblack@google.com if (inc_kids) 15912952Sgabeblack@google.com forEachKid([](Process *p) { p->suspend(true); }); 16012952Sgabeblack@google.com 16112952Sgabeblack@google.com if (!_suspended) { 16212952Sgabeblack@google.com _suspended = true; 16313133Sgabeblack@google.com _suspendedReady = scheduler.suspend(this); 16412952Sgabeblack@google.com 16513133Sgabeblack@google.com if (procKind() != ::sc_core::SC_METHOD_PROC_ && 16613133Sgabeblack@google.com scheduler.current() == this) { 16713133Sgabeblack@google.com // This isn't in the spec, but Accellera says that a thread that 16813133Sgabeblack@google.com // self suspends should be marked ready immediately when it's 16913133Sgabeblack@google.com // resumed. 17013133Sgabeblack@google.com _suspendedReady = true; 17113133Sgabeblack@google.com scheduler.yield(); 17213133Sgabeblack@google.com } 17312952Sgabeblack@google.com } 17412952Sgabeblack@google.com} 17512952Sgabeblack@google.com 17612952Sgabeblack@google.comvoid 17712952Sgabeblack@google.comProcess::resume(bool inc_kids) 17812952Sgabeblack@google.com{ 17912952Sgabeblack@google.com if (inc_kids) 18012952Sgabeblack@google.com forEachKid([](Process *p) { p->resume(true); }); 18112952Sgabeblack@google.com 18212952Sgabeblack@google.com if (_suspended) { 18312952Sgabeblack@google.com _suspended = false; 18412959Sgabeblack@google.com if (_suspendedReady) 18513133Sgabeblack@google.com scheduler.resume(this); 18612959Sgabeblack@google.com _suspendedReady = false; 18712952Sgabeblack@google.com } 18812952Sgabeblack@google.com} 18912952Sgabeblack@google.com 19012952Sgabeblack@google.comvoid 19112952Sgabeblack@google.comProcess::disable(bool inc_kids) 19212952Sgabeblack@google.com{ 19312952Sgabeblack@google.com if (inc_kids) 19412952Sgabeblack@google.com forEachKid([](Process *p) { p->disable(true); }); 19512952Sgabeblack@google.com 19612999Sgabeblack@google.com if (!::sc_core::sc_allow_process_control_corners && 19712999Sgabeblack@google.com dynamic_cast<SensitivityTimeout *>(dynamicSensitivity)) { 19812999Sgabeblack@google.com std::string message("attempt to disable a thread with timeout wait: "); 19912999Sgabeblack@google.com message += name(); 20012999Sgabeblack@google.com SC_REPORT_ERROR("Undefined process control interaction", 20112999Sgabeblack@google.com message.c_str()); 20212999Sgabeblack@google.com } 20312999Sgabeblack@google.com 20412952Sgabeblack@google.com _disabled = true; 20512952Sgabeblack@google.com} 20612952Sgabeblack@google.com 20712952Sgabeblack@google.comvoid 20812952Sgabeblack@google.comProcess::enable(bool inc_kids) 20912952Sgabeblack@google.com{ 21012952Sgabeblack@google.com 21112952Sgabeblack@google.com if (inc_kids) 21212952Sgabeblack@google.com forEachKid([](Process *p) { p->enable(true); }); 21312952Sgabeblack@google.com 21412952Sgabeblack@google.com _disabled = false; 21512952Sgabeblack@google.com} 21612952Sgabeblack@google.com 21712952Sgabeblack@google.comvoid 21812952Sgabeblack@google.comProcess::kill(bool inc_kids) 21912952Sgabeblack@google.com{ 22013102Sgabeblack@google.com if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 22113102Sgabeblack@google.com SC_REPORT_ERROR( 22213102Sgabeblack@google.com "(E572) a process may not be killed before it is initialized", 22313102Sgabeblack@google.com name()); 22413102Sgabeblack@google.com } 22513102Sgabeblack@google.com 22612952Sgabeblack@google.com // Propogate the kill to our children no matter what happens to us. 22712952Sgabeblack@google.com if (inc_kids) 22812952Sgabeblack@google.com forEachKid([](Process *p) { p->kill(true); }); 22912952Sgabeblack@google.com 23012952Sgabeblack@google.com // If we're in the middle of unwinding, ignore the kill request. 23112952Sgabeblack@google.com if (_isUnwinding) 23212952Sgabeblack@google.com return; 23312952Sgabeblack@google.com 23412995Sgabeblack@google.com // Update our state. 23512998Sgabeblack@google.com terminate(); 23612995Sgabeblack@google.com _isUnwinding = true; 23712995Sgabeblack@google.com 23812998Sgabeblack@google.com // Make sure this process isn't marked ready 23912998Sgabeblack@google.com popListNode(); 24012998Sgabeblack@google.com 24112998Sgabeblack@google.com // Inject the kill exception into this process if it's started. 24212998Sgabeblack@google.com if (!_needsStart) 24312998Sgabeblack@google.com injectException(killException); 24412952Sgabeblack@google.com} 24512952Sgabeblack@google.com 24612952Sgabeblack@google.comvoid 24712952Sgabeblack@google.comProcess::reset(bool inc_kids) 24812952Sgabeblack@google.com{ 24913102Sgabeblack@google.com if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 25013102Sgabeblack@google.com SC_REPORT_ERROR( 25113102Sgabeblack@google.com "(E573) a process may not be asynchronously reset while" 25213102Sgabeblack@google.com "the simulation is not running", name()); 25313102Sgabeblack@google.com } 25413102Sgabeblack@google.com 25512952Sgabeblack@google.com // Propogate the reset to our children no matter what happens to us. 25612952Sgabeblack@google.com if (inc_kids) 25712952Sgabeblack@google.com forEachKid([](Process *p) { p->reset(true); }); 25812952Sgabeblack@google.com 25912952Sgabeblack@google.com // If we're in the middle of unwinding, ignore the reset request. 26012952Sgabeblack@google.com if (_isUnwinding) 26112952Sgabeblack@google.com return; 26212952Sgabeblack@google.com 26312995Sgabeblack@google.com 26412998Sgabeblack@google.com if (_needsStart) { 26512998Sgabeblack@google.com scheduler.runNow(this); 26612998Sgabeblack@google.com } else { 26712998Sgabeblack@google.com _isUnwinding = true; 26812998Sgabeblack@google.com injectException(resetException); 26912998Sgabeblack@google.com } 27012952Sgabeblack@google.com 27112952Sgabeblack@google.com _resetEvent.notify(); 27212952Sgabeblack@google.com} 27312952Sgabeblack@google.com 27412952Sgabeblack@google.comvoid 27512952Sgabeblack@google.comProcess::throw_it(ExceptionWrapperBase &exc, bool inc_kids) 27612952Sgabeblack@google.com{ 27713102Sgabeblack@google.com if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) { 27813102Sgabeblack@google.com SC_REPORT_ERROR( 27913102Sgabeblack@google.com "(E574) throw_it not allowed unless simulation is running ", 28013102Sgabeblack@google.com name()); 28113102Sgabeblack@google.com } 28213102Sgabeblack@google.com 28312952Sgabeblack@google.com if (inc_kids) 28412952Sgabeblack@google.com forEachKid([&exc](Process *p) { p->throw_it(exc, true); }); 28512998Sgabeblack@google.com 28612998Sgabeblack@google.com // Only inject an exception into threads that have started. 28712998Sgabeblack@google.com if (!_needsStart) 28812998Sgabeblack@google.com injectException(exc); 28912952Sgabeblack@google.com} 29012952Sgabeblack@google.com 29112952Sgabeblack@google.comvoid 29212952Sgabeblack@google.comProcess::injectException(ExceptionWrapperBase &exc) 29312952Sgabeblack@google.com{ 29412952Sgabeblack@google.com excWrapper = &exc; 29512995Sgabeblack@google.com scheduler.runNow(this); 29612952Sgabeblack@google.com}; 29712952Sgabeblack@google.com 29812952Sgabeblack@google.comvoid 29912952Sgabeblack@google.comProcess::syncResetOn(bool inc_kids) 30012952Sgabeblack@google.com{ 30112952Sgabeblack@google.com if (inc_kids) 30212952Sgabeblack@google.com forEachKid([](Process *p) { p->syncResetOn(true); }); 30312952Sgabeblack@google.com 30412952Sgabeblack@google.com _syncReset = true; 30512952Sgabeblack@google.com} 30612952Sgabeblack@google.com 30712952Sgabeblack@google.comvoid 30812952Sgabeblack@google.comProcess::syncResetOff(bool inc_kids) 30912952Sgabeblack@google.com{ 31012952Sgabeblack@google.com if (inc_kids) 31112952Sgabeblack@google.com forEachKid([](Process *p) { p->syncResetOff(true); }); 31212952Sgabeblack@google.com 31312952Sgabeblack@google.com _syncReset = false; 31412952Sgabeblack@google.com} 31512952Sgabeblack@google.com 31612952Sgabeblack@google.comvoid 31712957Sgabeblack@google.comProcess::dontInitialize() 31812957Sgabeblack@google.com{ 31912957Sgabeblack@google.com scheduler.dontInitialize(this); 32012957Sgabeblack@google.com} 32112957Sgabeblack@google.com 32212957Sgabeblack@google.comvoid 32312957Sgabeblack@google.comProcess::finalize() 32412957Sgabeblack@google.com{ 32512957Sgabeblack@google.com for (auto &s: pendingStaticSensitivities) { 32612957Sgabeblack@google.com s->finalize(staticSensitivities); 32712957Sgabeblack@google.com delete s; 32812957Sgabeblack@google.com s = nullptr; 32912957Sgabeblack@google.com } 33012957Sgabeblack@google.com pendingStaticSensitivities.clear(); 33112957Sgabeblack@google.com}; 33212957Sgabeblack@google.com 33312957Sgabeblack@google.comvoid 33412953Sgabeblack@google.comProcess::run() 33512952Sgabeblack@google.com{ 33612953Sgabeblack@google.com bool reset; 33712953Sgabeblack@google.com do { 33812953Sgabeblack@google.com reset = false; 33912953Sgabeblack@google.com try { 34012953Sgabeblack@google.com func->call(); 34113175Sgabeblack@google.com } catch(ScHalt) { 34213175Sgabeblack@google.com std::cout << "Terminating process " << name() << std::endl; 34312995Sgabeblack@google.com } catch(const ::sc_core::sc_unwind_exception &exc) { 34412953Sgabeblack@google.com reset = exc.is_reset(); 34512995Sgabeblack@google.com _isUnwinding = false; 34613182Sgabeblack@google.com } catch (...) { 34713182Sgabeblack@google.com throw; 34812953Sgabeblack@google.com } 34912953Sgabeblack@google.com } while (reset); 35013093Sgabeblack@google.com needsStart(true); 35112953Sgabeblack@google.com} 35212952Sgabeblack@google.com 35312957Sgabeblack@google.comvoid 35412957Sgabeblack@google.comProcess::addStatic(PendingSensitivity *s) 35512957Sgabeblack@google.com{ 35612957Sgabeblack@google.com pendingStaticSensitivities.push_back(s); 35712957Sgabeblack@google.com} 35812957Sgabeblack@google.com 35912957Sgabeblack@google.comvoid 36012957Sgabeblack@google.comProcess::setDynamic(Sensitivity *s) 36112957Sgabeblack@google.com{ 36212957Sgabeblack@google.com delete dynamicSensitivity; 36312957Sgabeblack@google.com dynamicSensitivity = s; 36412957Sgabeblack@google.com} 36512957Sgabeblack@google.com 36612959Sgabeblack@google.comvoid 36712959Sgabeblack@google.comProcess::satisfySensitivity(Sensitivity *s) 36812959Sgabeblack@google.com{ 36912959Sgabeblack@google.com // If there's a dynamic sensitivity and this wasn't it, ignore. 37012959Sgabeblack@google.com if (dynamicSensitivity && dynamicSensitivity != s) 37112959Sgabeblack@google.com return; 37212959Sgabeblack@google.com 37312959Sgabeblack@google.com setDynamic(nullptr); 37412959Sgabeblack@google.com ready(); 37512959Sgabeblack@google.com} 37612959Sgabeblack@google.com 37712959Sgabeblack@google.comvoid 37812959Sgabeblack@google.comProcess::ready() 37912959Sgabeblack@google.com{ 38012996Sgabeblack@google.com if (disabled()) 38112996Sgabeblack@google.com return; 38212959Sgabeblack@google.com if (suspended()) 38312959Sgabeblack@google.com _suspendedReady = true; 38412959Sgabeblack@google.com else 38512959Sgabeblack@google.com scheduler.ready(this); 38612959Sgabeblack@google.com} 38712959Sgabeblack@google.com 38812997Sgabeblack@google.comvoid 38912997Sgabeblack@google.comProcess::lastReport(::sc_core::sc_report *report) 39012997Sgabeblack@google.com{ 39112997Sgabeblack@google.com if (report) { 39212997Sgabeblack@google.com _lastReport = std::unique_ptr<::sc_core::sc_report>( 39312997Sgabeblack@google.com new ::sc_core::sc_report(*report)); 39412997Sgabeblack@google.com } else { 39512997Sgabeblack@google.com _lastReport = nullptr; 39612997Sgabeblack@google.com } 39712997Sgabeblack@google.com} 39812997Sgabeblack@google.com 39912997Sgabeblack@google.com::sc_core::sc_report *Process::lastReport() const { return _lastReport.get(); } 40012997Sgabeblack@google.com 40113180Sgabeblack@google.comProcess::Process(const char *name, ProcessFuncWrapper *func, bool internal) : 40213087Sgabeblack@google.com ::sc_core::sc_process_b(name), excWrapper(nullptr), func(func), 40313180Sgabeblack@google.com _internal(internal), _needsStart(true), _isUnwinding(false), 40413180Sgabeblack@google.com _terminated(false), _suspended(false), _disabled(false), _syncReset(false), 40513180Sgabeblack@google.com refCount(0), stackSize(::Fiber::DefaultStackSize), 40613180Sgabeblack@google.com dynamicSensitivity(nullptr) 40712953Sgabeblack@google.com{ 40813131Sgabeblack@google.com _dynamic = 40913131Sgabeblack@google.com (::sc_core::sc_get_status() > 41013131Sgabeblack@google.com ::sc_core::SC_BEFORE_END_OF_ELABORATION); 41112953Sgabeblack@google.com _newest = this; 41212953Sgabeblack@google.com} 41312952Sgabeblack@google.com 41412998Sgabeblack@google.comvoid 41512998Sgabeblack@google.comProcess::terminate() 41612998Sgabeblack@google.com{ 41712998Sgabeblack@google.com _terminated = true; 41812998Sgabeblack@google.com _suspendedReady = false; 41912998Sgabeblack@google.com _suspended = false; 42012998Sgabeblack@google.com _syncReset = false; 42112998Sgabeblack@google.com delete dynamicSensitivity; 42212998Sgabeblack@google.com dynamicSensitivity = nullptr; 42312998Sgabeblack@google.com for (auto s: staticSensitivities) 42412998Sgabeblack@google.com delete s; 42512998Sgabeblack@google.com staticSensitivities.clear(); 42613006Sgabeblack@google.com 42713006Sgabeblack@google.com _terminatedEvent.notify(); 42812998Sgabeblack@google.com} 42912998Sgabeblack@google.com 43012953Sgabeblack@google.comProcess *Process::_newest; 43112952Sgabeblack@google.com 43212952Sgabeblack@google.comvoid 43312952Sgabeblack@google.comthrow_it_wrapper(Process *p, ExceptionWrapperBase &exc, bool inc_kids) 43412952Sgabeblack@google.com{ 43512952Sgabeblack@google.com p->throw_it(exc, inc_kids); 43612952Sgabeblack@google.com} 43712952Sgabeblack@google.com 43812952Sgabeblack@google.com} // namespace sc_gem5 439