summaryrefslogtreecommitdiff
path: root/src/mem/packet.hh
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2008-11-14 04:55:30 -0800
committerNathan Binkert <nate@binkert.org>2008-11-14 04:55:30 -0800
commit5711282f87afb609c79d657ed6aa8c9259b5b827 (patch)
tree399daee55331d1a8b0664a4a7d7d493f3b027708 /src/mem/packet.hh
parent7a4d75bae31cfe2064fe0718c7f982f769659b3c (diff)
downloadgem5-5711282f87afb609c79d657ed6aa8c9259b5b827.tar.xz
Fix a bunch of bugs I introduced when I changed the flags stuff for packets.
I did some of the flags and assertions wrong. Thanks to Brad Beckmann for pointing this out. I should have run the opt regressions instead of the fast. I also screwed up some of the logical functions in the Flags class.
Diffstat (limited to 'src/mem/packet.hh')
-rw-r--r--src/mem/packet.hh33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/mem/packet.hh b/src/mem/packet.hh
index 38eb2e92b..b75490168 100644
--- a/src/mem/packet.hh
+++ b/src/mem/packet.hh
@@ -461,9 +461,12 @@ class Packet : public FastAlloc, public Printable
* supplied.
*/
Packet(Request *_req, MemCmd _cmd, NodeID _dest)
- : cmd(_cmd), req(_req), data(NULL), addr(_req->paddr),
- size(_req->size), dest(_dest), time(curTick), senderState(NULL)
+ : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL),
+ addr(_req->paddr), size(_req->size), dest(_dest), time(curTick),
+ senderState(NULL)
{
+ if (req->flags.any(Request::VALID_PADDR))
+ flags.set(VALID_ADDR|VALID_SIZE);
}
/**
@@ -472,10 +475,12 @@ class Packet : public FastAlloc, public Printable
* req. this allows for overriding the size/addr of the req.
*/
Packet(Request *_req, MemCmd _cmd, NodeID _dest, int _blkSize)
- : cmd(_cmd), req(_req), data(NULL),
+ : flags(VALID_DST), cmd(_cmd), req(_req), data(NULL),
addr(_req->paddr & ~(_blkSize - 1)), size(_blkSize), dest(_dest),
time(curTick), senderState(NULL)
{
+ if (req->flags.any(Request::VALID_PADDR))
+ flags.set(VALID_ADDR|VALID_SIZE);
}
/**
@@ -544,13 +549,10 @@ class Packet : public FastAlloc, public Printable
assert(isRequest());
origCmd = cmd;
cmd = cmd.responseCommand();
- if (flags.any(VALID_SRC)) {
- dest = src;
- flags.set(VALID_DST);
- flags.clear(VALID_SRC);
- } else {
- flags.clear(VALID_DST);
- }
+
+ dest = src;
+ flags.set(VALID_DST, flags.any(VALID_SRC));
+ flags.clear(VALID_SRC);
}
void
@@ -690,7 +692,6 @@ class Packet : public FastAlloc, public Printable
if (flags.any(ARRAY_DATA))
delete [] data;
else if (flags.any(DYNAMIC_DATA))
-
delete data;
flags.clear(STATIC_DATA|DYNAMIC_DATA|ARRAY_DATA);
@@ -702,11 +703,13 @@ class Packet : public FastAlloc, public Printable
allocate()
{
if (data) {
- assert(flags.none(STATIC_DATA|DYNAMIC_DATA));
- } else {
- flags.set(DYNAMIC_DATA|ARRAY_DATA);
- data = new uint8_t[getSize()];
+ assert(flags.any(STATIC_DATA|DYNAMIC_DATA));
+ return;
}
+
+ assert(flags.none(STATIC_DATA|DYNAMIC_DATA));
+ flags.set(DYNAMIC_DATA|ARRAY_DATA);
+ data = new uint8_t[getSize()];
}