summaryrefslogtreecommitdiff
path: root/src/cpu/testers
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:43 -0500
committerAndreas Hansson <andreas.hansson@arm.com>2014-12-02 06:07:43 -0500
commit41846cb61b0f511099eb9a203f11885de328ab45 (patch)
tree7563b309ba914ea57dd12e6cfba3ea33817ab1b1 /src/cpu/testers
parent5df96cb690168d750ab0fafffd11fb51624374d2 (diff)
downloadgem5-41846cb61b0f511099eb9a203f11885de328ab45.tar.xz
mem: Assume all dynamic packet data is array allocated
This patch simplifies how we deal with dynamically allocated data in the packet, always assuming that it is array allocated, and hence should be array deallocated (delete[] as opposed to delete). The only uses of dataDynamic was in the Ruby testers. The ARRAY_DATA flag in the packet is removed accordingly. No defragmentation of the flags is done at this point, leaving a gap in the bit masks. As the last part the patch, it renames dataDynamicArray to dataDynamic.
Diffstat (limited to 'src/cpu/testers')
-rw-r--r--src/cpu/testers/directedtest/InvalidateGenerator.cc4
-rw-r--r--src/cpu/testers/directedtest/SeriesRequestGenerator.cc4
-rw-r--r--src/cpu/testers/memtest/memtest.cc4
-rw-r--r--src/cpu/testers/networktest/networktest.cc2
-rw-r--r--src/cpu/testers/rubytest/Check.cc6
-rw-r--r--src/cpu/testers/traffic_gen/generators.cc2
6 files changed, 9 insertions, 13 deletions
diff --git a/src/cpu/testers/directedtest/InvalidateGenerator.cc b/src/cpu/testers/directedtest/InvalidateGenerator.cc
index 84a90844f..61c3f5972 100644
--- a/src/cpu/testers/directedtest/InvalidateGenerator.cc
+++ b/src/cpu/testers/directedtest/InvalidateGenerator.cc
@@ -76,9 +76,7 @@ InvalidateGenerator::initiate()
} else {
panic("initiate was unexpectedly called\n");
}
- uint8_t* dummyData = new uint8_t;
- *dummyData = 0;
- pkt->dataDynamic(dummyData);
+ pkt->allocate();
if (port->sendTimingReq(pkt)) {
DPRINTF(DirectedTest, "initiating request - successful\n");
diff --git a/src/cpu/testers/directedtest/SeriesRequestGenerator.cc b/src/cpu/testers/directedtest/SeriesRequestGenerator.cc
index 80523280b..2356fb47a 100644
--- a/src/cpu/testers/directedtest/SeriesRequestGenerator.cc
+++ b/src/cpu/testers/directedtest/SeriesRequestGenerator.cc
@@ -69,9 +69,7 @@ SeriesRequestGenerator::initiate()
}
PacketPtr pkt = new Packet(req, cmd);
- uint8_t* dummyData = new uint8_t;
- *dummyData = 0;
- pkt->dataDynamic(dummyData);
+ pkt->allocate();
if (port->sendTimingReq(pkt)) {
DPRINTF(DirectedTest, "initiating request - successful\n");
diff --git a/src/cpu/testers/memtest/memtest.cc b/src/cpu/testers/memtest/memtest.cc
index 082737f8a..53c01b7f7 100644
--- a/src/cpu/testers/memtest/memtest.cc
+++ b/src/cpu/testers/memtest/memtest.cc
@@ -327,7 +327,7 @@ MemTest::tick()
blockAddr(req->getPaddr()), *result);
PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
- pkt->dataDynamicArray(new uint8_t[req->getSize()]);
+ pkt->dataDynamic(new uint8_t[req->getSize()]);
MemTestSenderState *state = new MemTestSenderState(result);
pkt->senderState = state;
@@ -349,7 +349,7 @@ MemTest::tick()
PacketPtr pkt = new Packet(req, MemCmd::WriteReq);
uint8_t *pkt_data = new uint8_t[req->getSize()];
- pkt->dataDynamicArray(pkt_data);
+ pkt->dataDynamic(pkt_data);
memcpy(pkt_data, &data, req->getSize());
MemTestSenderState *state = new MemTestSenderState(result);
pkt->senderState = state;
diff --git a/src/cpu/testers/networktest/networktest.cc b/src/cpu/testers/networktest/networktest.cc
index 94dedf648..8ad32d140 100644
--- a/src/cpu/testers/networktest/networktest.cc
+++ b/src/cpu/testers/networktest/networktest.cc
@@ -261,7 +261,7 @@ NetworkTest::generatePkt()
destination, req->getPaddr());
PacketPtr pkt = new Packet(req, requestType);
- pkt->dataDynamicArray(new uint8_t[req->getSize()]);
+ pkt->dataDynamic(new uint8_t[req->getSize()]);
pkt->senderState = NULL;
sendPkt(pkt);
diff --git a/src/cpu/testers/rubytest/Check.cc b/src/cpu/testers/rubytest/Check.cc
index 19d0623c0..b320ca61d 100644
--- a/src/cpu/testers/rubytest/Check.cc
+++ b/src/cpu/testers/rubytest/Check.cc
@@ -113,7 +113,7 @@ Check::initiatePrefetch()
// despite the oddity of the 0 size (questionable if this should
// even be allowed), a prefetch is still a read and as such needs
// a place to store the result
- uint8_t *data = new uint8_t;
+ uint8_t *data = new uint8_t[1];
pkt->dataDynamic(data);
// push the subblock onto the sender state. The sequencer will
@@ -192,7 +192,7 @@ Check::initiateAction()
// }
PacketPtr pkt = new Packet(req, cmd);
- uint8_t *writeData = new uint8_t;
+ uint8_t *writeData = new uint8_t[1];
*writeData = m_value + m_store_count;
pkt->dataDynamic(writeData);
@@ -246,7 +246,7 @@ Check::initiateCheck()
req->setThreadContext(index, 0);
PacketPtr pkt = new Packet(req, MemCmd::ReadReq);
uint8_t *dataArray = new uint8_t[CHECK_SIZE];
- pkt->dataDynamicArray(dataArray);
+ pkt->dataDynamic(dataArray);
// push the subblock onto the sender state. The sequencer will
// update the subblock on the return
diff --git a/src/cpu/testers/traffic_gen/generators.cc b/src/cpu/testers/traffic_gen/generators.cc
index 5e19384bc..f0cf14206 100644
--- a/src/cpu/testers/traffic_gen/generators.cc
+++ b/src/cpu/testers/traffic_gen/generators.cc
@@ -62,7 +62,7 @@ BaseGen::getPacket(Addr addr, unsigned size, const MemCmd& cmd,
PacketPtr pkt = new Packet(req, cmd);
uint8_t* pkt_data = new uint8_t[req->getSize()];
- pkt->dataDynamicArray(pkt_data);
+ pkt->dataDynamic(pkt_data);
if (cmd.isWrite()) {
memset(pkt_data, 0xA, req->getSize());