cpu: remove unnecessary data ptr from O3 internal read() funcs

The read() function merely initiates a memory read operation; the
data doesn't arrive until the access completes and a response packet
is received from the memory system.  Thus there's no need to provide
a data pointer; its existence is historical.

Getting this pointer out of this internal o3 interface sets the
stage for similar cleanup in the ExecContext interface.  Also
found that we were pointlessly setting the contents at this pointer
on a store forward (the useful memcpy happens just a few lines
below the deleted one).
This commit is contained in:
Steve Reinhardt 2016-01-17 18:27:46 -08:00
parent e595d9cccb
commit 707275265f
4 changed files with 8 additions and 15 deletions

View file

@ -910,7 +910,7 @@ BaseDynInst<Impl>::readMem(Addr addr, uint8_t *data,
} }
reqToVerify = new Request(*req); reqToVerify = new Request(*req);
} }
fault = cpu->read(req, sreqLow, sreqHigh, data, lqIdx); fault = cpu->read(req, sreqLow, sreqHigh, lqIdx);
} else { } else {
// Commit will have to clean up whatever happened. Set this // Commit will have to clean up whatever happened. Set this
// instruction as executed. // instruction as executed.

View file

@ -678,10 +678,9 @@ class FullO3CPU : public BaseO3CPU
/** CPU read function, forwards read to LSQ. */ /** CPU read function, forwards read to LSQ. */
Fault read(RequestPtr &req, RequestPtr &sreqLow, RequestPtr &sreqHigh, Fault read(RequestPtr &req, RequestPtr &sreqLow, RequestPtr &sreqHigh,
uint8_t *data, int load_idx) int load_idx)
{ {
return this->iew.ldstQueue.read(req, sreqLow, sreqHigh, return this->iew.ldstQueue.read(req, sreqLow, sreqHigh, load_idx);
data, load_idx);
} }
/** CPU write function, forwards write to LSQ. */ /** CPU write function, forwards write to LSQ. */

View file

@ -275,7 +275,7 @@ class LSQ {
* index. * index.
*/ */
Fault read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, Fault read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh,
uint8_t *data, int load_idx); int load_idx);
/** Executes a store operation, using the store specified at the store /** Executes a store operation, using the store specified at the store
* index. * index.
@ -332,11 +332,11 @@ class LSQ {
template <class Impl> template <class Impl>
Fault Fault
LSQ<Impl>::read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh, LSQ<Impl>::read(RequestPtr req, RequestPtr sreqLow, RequestPtr sreqHigh,
uint8_t *data, int load_idx) int load_idx)
{ {
ThreadID tid = req->threadId(); ThreadID tid = req->threadId();
return thread[tid].read(req, sreqLow, sreqHigh, data, load_idx); return thread[tid].read(req, sreqLow, sreqHigh, load_idx);
} }
template <class Impl> template <class Impl>

View file

@ -511,7 +511,7 @@ class LSQUnit {
public: public:
/** Executes the load at the given index. */ /** Executes the load at the given index. */
Fault read(Request *req, Request *sreqLow, Request *sreqHigh, Fault read(Request *req, Request *sreqLow, Request *sreqHigh,
uint8_t *data, int load_idx); int load_idx);
/** Executes the store at the given index. */ /** Executes the store at the given index. */
Fault write(Request *req, Request *sreqLow, Request *sreqHigh, Fault write(Request *req, Request *sreqLow, Request *sreqHigh,
@ -550,7 +550,7 @@ class LSQUnit {
template <class Impl> template <class Impl>
Fault Fault
LSQUnit<Impl>::read(Request *req, Request *sreqLow, Request *sreqHigh, LSQUnit<Impl>::read(Request *req, Request *sreqLow, Request *sreqHigh,
uint8_t *data, int load_idx) int load_idx)
{ {
DynInstPtr load_inst = loadQueue[load_idx]; DynInstPtr load_inst = loadQueue[load_idx];
@ -676,12 +676,6 @@ LSQUnit<Impl>::read(Request *req, Request *sreqLow, Request *sreqHigh,
// Get shift amount for offset into the store's data. // Get shift amount for offset into the store's data.
int shift_amt = req->getVaddr() - storeQueue[store_idx].inst->effAddr; int shift_amt = req->getVaddr() - storeQueue[store_idx].inst->effAddr;
if (storeQueue[store_idx].isAllZeros)
memset(data, 0, req->getSize());
else
memcpy(data, storeQueue[store_idx].data + shift_amt,
req->getSize());
// Allocate memory if this is the first time a load is issued. // Allocate memory if this is the first time a load is issued.
if (!load_inst->memData) { if (!load_inst->memData) {
load_inst->memData = new uint8_t[req->getSize()]; load_inst->memData = new uint8_t[req->getSize()];