diff options
author | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2018-06-04 09:40:19 +0100 |
---|---|---|
committer | Giacomo Travaglini <giacomo.travaglini@arm.com> | 2018-06-11 16:55:30 +0000 |
commit | f54020eb8155371725ab75b0fc5c419287eca084 (patch) | |
tree | 65d379f7603e689e083e9a58ff4c2e90abd19fbf /src/cpu/o3/lsq.hh | |
parent | 2113b21996d086dab32b9fd388efe3df241bfbd2 (diff) | |
download | gem5-f54020eb8155371725ab75b0fc5c419287eca084.tar.xz |
misc: Using smart pointers for memory Requests
This patch is changing the underlying type for RequestPtr from Request*
to shared_ptr<Request>. Having memory requests being managed by smart
pointers will simplify the code; it will also prevent memory leakage and
dangling pointers.
Change-Id: I7749af38a11ac8eb4d53d8df1252951e0890fde3
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/10996
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/cpu/o3/lsq.hh')
-rw-r--r-- | src/cpu/o3/lsq.hh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cpu/o3/lsq.hh b/src/cpu/o3/lsq.hh index 6bc9b3d73..7c78156d5 100644 --- a/src/cpu/o3/lsq.hh +++ b/src/cpu/o3/lsq.hh @@ -274,13 +274,15 @@ class LSQ { /** Executes a read operation, using the load specified at the load * index. */ - Fault read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, + Fault read(const RequestPtr &req, + RequestPtr &sreqLow, RequestPtr &sreqHigh, int load_idx); /** Executes a store operation, using the store specified at the store * index. */ - Fault write(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, + Fault write(const RequestPtr &req, + const RequestPtr &sreqLow, const RequestPtr &sreqHigh, uint8_t *data, int store_idx); /** @@ -331,7 +333,8 @@ class LSQ { template <class Impl> Fault -LSQ<Impl>::read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, +LSQ<Impl>::read(const RequestPtr &req, + RequestPtr &sreqLow, RequestPtr &sreqHigh, int load_idx) { ThreadID tid = cpu->contextToThread(req->contextId()); @@ -341,7 +344,8 @@ LSQ<Impl>::read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, template <class Impl> Fault -LSQ<Impl>::write(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, +LSQ<Impl>::write(const RequestPtr &req, + const RequestPtr &sreqLow, const RequestPtr &sreqHigh, uint8_t *data, int store_idx) { ThreadID tid = cpu->contextToThread(req->contextId()); |