diff options
author | Ali Saidi <saidi@eecs.umich.edu> | 2006-05-01 18:53:28 -0400 |
---|---|---|
committer | Ali Saidi <saidi@eecs.umich.edu> | 2006-05-01 18:53:28 -0400 |
commit | 8a9d270f6c17efa79f38e629c7cbcafa51aa8494 (patch) | |
tree | 75bbf24f940af2b8bf6fe00d42c56b1715bdf07b /mem/packet.hh | |
parent | a8fbc4ec76169a6d735817df2aa8bc2085df5ac8 (diff) | |
download | gem5-8a9d270f6c17efa79f38e629c7cbcafa51aa8494.tar.xz |
move code from packet.hh to packet.cc and packet_impl.hh
fix very annoying not-compiler bug
arch/sparc/regfile.hh:
You have not included an out-of-class definition of your static members. See [9.4.2]/4 and about a billion gcc bug reports.
If statements get around the problem through some magic, and than seems nicer that putting a definition of them in a c file
somewhere.
cpu/simple/cpu.cc:
get() and set() do the conversion now
dev/io_device.hh:
need get() and set() defentions in all the devices
mem/packet.cc:
mem/packet.hh:
move code from packet.hh to packet.cc
mem/physical.cc:
packet_impl needed for templated packet functions
--HG--
extra : convert_revision : 6c11842aa928d9af7b4cabe826306fe1fe09e693
Diffstat (limited to 'mem/packet.hh')
-rw-r--r-- | mem/packet.hh | 82 |
1 files changed, 11 insertions, 71 deletions
diff --git a/mem/packet.hh b/mem/packet.hh index a5bd6bc59..69d00675d 100644 --- a/mem/packet.hh +++ b/mem/packet.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 The Regents of The University of Michigan + * Copyright (c) 2006 The Regents of The University of Michigan * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -150,102 +150,42 @@ struct Packet /** Minimally reset a packet so something like simple cpu can reuse it. */ - void reset() { - result = Unknown; - if (dynamicData) { - deleteData(); - dynamicData = false; - arrayData = false; - time = curTick; - } - } + void reset(); /** Set the data pointer to the following value that should not be freed. */ template <typename T> - void dataStatic(T *p) { - assert(!dynamicData); - data = (PacketDataPtr)p; - staticData = true; - } + void dataStatic(T *p); /** Set the data pointer to a value that should have delete [] called on it. */ template <typename T> - void dataDynamicArray(T *p) { - assert(!staticData && !dynamicData); - data = (PacketDataPtr)p; - dynamicData = true; - arrayData = true; - } + void dataDynamicArray(T *p); /** set the data pointer to a value that should have delete called on it. */ template <typename T> - void dataDynamic(T *p) { - assert(!staticData && !dynamicData); - data = (PacketDataPtr)p; - dynamicData = true; - arrayData = false; - } + void dataDynamic(T *p); /** return the value of what is pointed to in the packet. */ template <typename T> - T get() { - assert(staticData || dynamicData); - assert(sizeof(T) <= size); - return *(T*)data; - } + T get(); /** get a pointer to the data ptr. */ template <typename T> - T* getPtr() { - assert(staticData || dynamicData); - return (T*)data; - } - + T* getPtr(); /** set the value in the data pointer to v. */ template <typename T> - void set(T v) { - assert(sizeof(T) <= size); - *(T*)data = v; - } + void set(T v); /** delete the data pointed to in the data pointer. Ok to call to matter how * data was allocted. */ - void deleteData() { - assert(staticData || dynamicData); - if (staticData) - return; - - if (arrayData) - delete [] data; - else - delete data; - } + void deleteData(); /** If there isn't data in the packet, allocate some. */ - void allocate() { - if (data) - return; - assert(!staticData); - dynamicData = true; - arrayData = true; - data = new uint8_t[size]; - } + void allocate(); /** Do the packet modify the same addresses. */ - bool intersect(Packet *p) { - Addr s1 = addr; - Addr e1 = addr + size; - Addr s2 = p->addr; - Addr e2 = p->addr + p->size; - - if (s1 >= s2 && s1 < e2) - return true; - if (e1 >= s2 && e1 < e2) - return true; - return false; - } + bool intersect(Packet *p); }; bool fixPacket(Packet &func, Packet &timing); |