diff options
Diffstat (limited to 'src/cpu/testers')
-rw-r--r-- | src/cpu/testers/rubytest/Check.cc | 24 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/RubyTester.cc | 12 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/RubyTester.hh | 30 |
3 files changed, 27 insertions, 39 deletions
diff --git a/src/cpu/testers/rubytest/Check.cc b/src/cpu/testers/rubytest/Check.cc index a861dbfd8..ae74da67f 100644 --- a/src/cpu/testers/rubytest/Check.cc +++ b/src/cpu/testers/rubytest/Check.cc @@ -111,16 +111,13 @@ Check::initiatePrefetch() // push the subblock onto the sender state. The sequencer will // update the subblock on the return - pkt->senderState = - new SenderState(m_address, req->getSize(), pkt->senderState); + pkt->senderState = new SenderState(m_address, req->getSize()); if (port->sendTimingReq(pkt)) { DPRINTF(RubyTest, "successfully initiated prefetch.\n"); } else { // If the packet did not issue, must delete - SenderState* senderState = safe_cast<SenderState*>(pkt->senderState); - pkt->senderState = senderState->saved; - delete senderState; + delete pkt->senderState; delete pkt->req; delete pkt; @@ -151,8 +148,7 @@ Check::initiateFlush() // push the subblock onto the sender state. The sequencer will // update the subblock on the return - pkt->senderState = - new SenderState(m_address, req->getSize(), pkt->senderState); + pkt->senderState = new SenderState(m_address, req->getSize()); if (port->sendTimingReq(pkt)) { DPRINTF(RubyTest, "initiating Flush - successful\n"); @@ -198,8 +194,7 @@ Check::initiateAction() // push the subblock onto the sender state. The sequencer will // update the subblock on the return - pkt->senderState = - new SenderState(writeAddr, req->getSize(), pkt->senderState); + pkt->senderState = new SenderState(writeAddr, req->getSize()); if (port->sendTimingReq(pkt)) { DPRINTF(RubyTest, "initiating action - successful\n"); @@ -210,9 +205,7 @@ Check::initiateAction() // If the packet did not issue, must delete // Note: No need to delete the data, the packet destructor // will delete it - SenderState* senderState = safe_cast<SenderState*>(pkt->senderState); - pkt->senderState = senderState->saved; - delete senderState; + delete pkt->senderState; delete pkt->req; delete pkt; @@ -250,8 +243,7 @@ Check::initiateCheck() // push the subblock onto the sender state. The sequencer will // update the subblock on the return - pkt->senderState = - new SenderState(m_address, req->getSize(), pkt->senderState); + pkt->senderState = new SenderState(m_address, req->getSize()); if (port->sendTimingReq(pkt)) { DPRINTF(RubyTest, "initiating check - successful\n"); @@ -262,9 +254,7 @@ Check::initiateCheck() // If the packet did not issue, must delete // Note: No need to delete the data, the packet destructor // will delete it - SenderState* senderState = safe_cast<SenderState*>(pkt->senderState); - pkt->senderState = senderState->saved; - delete senderState; + delete pkt->senderState; delete pkt->req; delete pkt; diff --git a/src/cpu/testers/rubytest/RubyTester.cc b/src/cpu/testers/rubytest/RubyTester.cc index 085647533..68f76f1a6 100644 --- a/src/cpu/testers/rubytest/RubyTester.cc +++ b/src/cpu/testers/rubytest/RubyTester.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 ARM Limited + * Copyright (c) 2012-2013 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -149,17 +149,13 @@ RubyTester::CpuPort::recvTimingResp(PacketPtr pkt) // retrieve the subblock and call hitCallback RubyTester::SenderState* senderState = safe_cast<RubyTester::SenderState*>(pkt->senderState); - SubBlock* subblock = senderState->subBlock; - assert(subblock != NULL); + SubBlock& subblock = senderState->subBlock; - // pop the sender state from the packet - pkt->senderState = senderState->saved; - - tester->hitCallback(id, subblock); + tester->hitCallback(id, &subblock); // Now that the tester has completed, delete the senderState // (includes sublock) and the packet, then return - delete senderState; + delete pkt->senderState; delete pkt->req; delete pkt; return true; diff --git a/src/cpu/testers/rubytest/RubyTester.hh b/src/cpu/testers/rubytest/RubyTester.hh index 2fed84e2d..df1bc1fbb 100644 --- a/src/cpu/testers/rubytest/RubyTester.hh +++ b/src/cpu/testers/rubytest/RubyTester.hh @@ -1,4 +1,16 @@ /* + * Copyright (c) 2013 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * Copyright (c) 2009 Advanced Micro Devices, Inc. * All rights reserved. @@ -69,20 +81,10 @@ class RubyTester : public MemObject struct SenderState : public Packet::SenderState { - SubBlock* subBlock; - Packet::SenderState *saved; - - SenderState(Address addr, int size, - Packet::SenderState *sender_state = NULL) - : saved(sender_state) - { - subBlock = new SubBlock(addr, size); - } - - ~SenderState() - { - delete subBlock; - } + SubBlock subBlock; + + SenderState(Address addr, int size) : subBlock(addr, size) {} + }; typedef RubyTesterParams Params; |