diff options
author | Sean Wilson <spwilson2@wisc.edu> | 2017-06-27 16:22:24 -0500 |
---|---|---|
committer | Sean Wilson <spwilson2@wisc.edu> | 2017-07-12 20:07:05 +0000 |
commit | e5c9e9c4d439e1937db33a954ac231032dab69f2 (patch) | |
tree | 9337b4df1004b0fb9b4ccd6aee0561b83261a23c /src/mem/external_slave.cc | |
parent | 8c1ea47b3c2fc90378eb16f3ad92d4ae522567c5 (diff) | |
download | gem5-e5c9e9c4d439e1937db33a954ac231032dab69f2.tar.xz |
kvm, mem: Refactor some Event subclasses into lambdas
Change-Id: Ifafdcf4692d58a17f90e66ff8de8fa3e146c34bb
Signed-off-by: Sean Wilson <spwilson2@wisc.edu>
Reviewed-on: https://gem5-review.googlesource.com/3924
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/mem/external_slave.cc')
-rw-r--r-- | src/mem/external_slave.cc | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/src/mem/external_slave.cc b/src/mem/external_slave.cc index 990e3561a..ac93e669c 100644 --- a/src/mem/external_slave.cc +++ b/src/mem/external_slave.cc @@ -52,17 +52,9 @@ class StubSlavePort : public ExternalSlave::Port { public: - class ResponseEvent : public Event - { - public: - StubSlavePort &owner; - - ResponseEvent(StubSlavePort &owner_) : owner(owner_) { } - - void process(); - }; + void processResponseEvent(); - ResponseEvent responseEvent; + EventFunctionWrapper responseEvent; /** Stub can handle a single request at a time. This will be * NULL when no packet is in flight */ @@ -75,7 +67,8 @@ class StubSlavePort : public ExternalSlave::Port StubSlavePort(const std::string &name_, ExternalSlave &owner_) : ExternalSlave::Port(name_, owner_), - responseEvent(*this), responsePacket(NULL), mustRetry(false) + responseEvent([this]{ processResponseEvent(); }, name()), + responsePacket(NULL), mustRetry(false) { } Tick recvAtomic(PacketPtr packet); @@ -123,18 +116,18 @@ StubSlavePort::recvFunctional(PacketPtr packet) } void -StubSlavePort::ResponseEvent::process() +StubSlavePort::processResponseEvent() { - owner.responsePacket->makeResponse(); - owner.responsePacket->headerDelay = 0; - owner.responsePacket->payloadDelay = 0; + responsePacket->makeResponse(); + responsePacket->headerDelay = 0; + responsePacket->payloadDelay = 0; - if (owner.sendTimingResp(owner.responsePacket)) { - owner.responsePacket = NULL; + if (sendTimingResp(responsePacket)) { + responsePacket = NULL; - if (owner.mustRetry) - owner.sendRetryReq(); - owner.mustRetry = false; + if (mustRetry) + sendRetryReq(); + mustRetry = false; } } |