changeset dc4d191011c5 in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=dc4d191011c5 summary: Add FAST_ALLOC_DEBUG and FAST_ALLOC_STATS as SConstruct options.
changeset da526ea4fa3c in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=da526ea4fa3c summary: Don't FastAlloc MSHRs since we don't allocate them on the fly. changeset 125d59b1047b in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=125d59b1047b summary: Delete the Request for a no-response Packet diffstat: 11 files changed, 43 insertions(+), 29 deletions(-) SConstruct | 7 ++++++- src/base/fast_alloc.cc | 12 +++++++----- src/base/fast_alloc.hh | 20 +++++++------------- src/cpu/memtest/memtest.hh | 3 ++- src/cpu/o3/lsq_unit.hh | 3 ++- src/cpu/ozone/lw_lsq.hh | 3 ++- src/dev/io_device.hh | 3 ++- src/mem/bridge.hh | 3 ++- src/mem/cache/cache_impl.hh | 3 ++- src/mem/packet.hh | 14 +++++++++++--- src/mem/tport.cc | 1 - diffs (truncated from 313 to 300 lines): diff -r d1531963b59d -r 125d59b1047b SConstruct --- a/SConstruct Sat Mar 22 22:17:15 2008 -0400 +++ b/SConstruct Mon Mar 24 01:08:02 2008 -0400 @@ -537,6 +537,10 @@ sticky_opts.AddOptions( # scons 0.96.90 or later. ListOption('CPU_MODELS', 'CPU models', default_cpus, all_cpu_list), BoolOption('NO_FAST_ALLOC', 'Disable fast object allocator', False), + BoolOption('FAST_ALLOC_DEBUG', 'Enable fast object allocator debugging', + False), + BoolOption('FAST_ALLOC_STATS', 'Enable fast object allocator statistics', + False), BoolOption('EFENCE', 'Link with Electric Fence malloc debugger', False), BoolOption('SS_COMPATIBLE_FP', @@ -561,7 +565,8 @@ nonsticky_opts.AddOptions( # These options get exported to #defines in config/*.hh (see src/SConscript). env.ExportOptions = ['FULL_SYSTEM', 'ALPHA_TLASER', 'USE_FENV', \ - 'USE_MYSQL', 'NO_FAST_ALLOC', 'SS_COMPATIBLE_FP', \ + 'USE_MYSQL', 'NO_FAST_ALLOC', 'FAST_ALLOC_DEBUG', \ + 'FAST_ALLOC_STATS', 'SS_COMPATIBLE_FP', \ 'USE_CHECKER', 'PYTHONHOME', 'TARGET_ISA'] # Define a handy 'no-op' action diff -r d1531963b59d -r 125d59b1047b src/base/fast_alloc.cc --- a/src/base/fast_alloc.cc Sat Mar 22 22:17:15 2008 -0400 +++ b/src/base/fast_alloc.cc Mon Mar 24 01:08:02 2008 -0400 @@ -45,7 +45,7 @@ void *FastAlloc::freeLists[Num_Buckets]; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS unsigned FastAlloc::newCount[Num_Buckets]; unsigned FastAlloc::deleteCount[Num_Buckets]; unsigned FastAlloc::allocCount[Num_Buckets]; @@ -59,7 +59,7 @@ void *FastAlloc::moreStructs(int bucket) const int nstructs = Num_Structs_Per_New; // how many to allocate? char *p = ::new char[nstructs * sz]; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS ++allocCount[bucket]; #endif @@ -72,7 +72,7 @@ void *FastAlloc::moreStructs(int bucket) } -#ifdef FAST_ALLOC_DEBUG +#if FAST_ALLOC_DEBUG #include <typeinfo> #include <iostream> @@ -167,9 +167,9 @@ FastAlloc::dump_oldest(int n) return; } - for (FastAlloc *p = inUseHead.inUsePrev; + for (FastAlloc *p = inUseHead.inUseNext; p != &inUseHead && n > 0; - p = p->inUsePrev, --n) + p = p->inUseNext, --n) { cout << p << " " << typeid(*p).name() << endl; } @@ -180,11 +180,13 @@ FastAlloc::dump_oldest(int n) // C interfaces to FastAlloc::dump_summary() and FastAlloc::dump_oldest(). // gdb seems to have trouble with calling C++ functions directly. // +void fast_alloc_summary() { FastAlloc::dump_summary(); } +void fast_alloc_oldest(int n) { FastAlloc::dump_oldest(n); diff -r d1531963b59d -r 125d59b1047b src/base/fast_alloc.hh --- a/src/base/fast_alloc.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/base/fast_alloc.hh Mon Mar 24 01:08:02 2008 -0400 @@ -62,15 +62,9 @@ // collapse the destructor call chain back up the inheritance // hierarchy. -// Uncomment this #define to track in-use objects -// (for debugging memory leaks). -//#define FAST_ALLOC_DEBUG - -// Uncomment this #define to count news, deletes, and chunk allocations -// (by bucket). -// #define FAST_ALLOC_STATS - #include "config/no_fast_alloc.hh" +#include "config/fast_alloc_debug.hh" +#include "config/fast_alloc_stats.hh" #if NO_FAST_ALLOC @@ -88,7 +82,7 @@ class FastAlloc { void *operator new(size_t); void operator delete(void *, size_t); -#ifdef FAST_ALLOC_DEBUG +#if FAST_ALLOC_DEBUG FastAlloc(); FastAlloc(FastAlloc*,FastAlloc*); // for inUseHead, see below virtual ~FastAlloc(); @@ -121,13 +115,13 @@ class FastAlloc { static void *freeLists[Num_Buckets]; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS static unsigned newCount[Num_Buckets]; static unsigned deleteCount[Num_Buckets]; static unsigned allocCount[Num_Buckets]; #endif -#ifdef FAST_ALLOC_DEBUG +#if FAST_ALLOC_DEBUG // per-object debugging fields bool inUse; // in-use flag FastAlloc *inUsePrev; // ptrs to build list of in-use objects @@ -170,7 +164,7 @@ void *FastAlloc::allocate(size_t sz) else p = moreStructs(b); -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS ++newCount[b]; #endif @@ -192,7 +186,7 @@ void FastAlloc::deallocate(void *p, size b = bucketFor(sz); *(void **)p = freeLists[b]; freeLists[b] = p; -#ifdef FAST_ALLOC_STATS +#if FAST_ALLOC_STATS ++deleteCount[b]; #endif } diff -r d1531963b59d -r 125d59b1047b src/cpu/memtest/memtest.hh --- a/src/cpu/memtest/memtest.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/cpu/memtest/memtest.hh Mon Mar 24 01:08:02 2008 -0400 @@ -35,6 +35,7 @@ #include <set> #include "base/statistics.hh" +#include "base/fast_alloc.hh" #include "params/MemTest.hh" #include "sim/eventq.hh" #include "sim/sim_exit.hh" @@ -116,7 +117,7 @@ class MemTest : public MemObject bool snoopRangeSent; - class MemTestSenderState : public Packet::SenderState + class MemTestSenderState : public Packet::SenderState, public FastAlloc { public: /** Constructor. */ diff -r d1531963b59d -r 125d59b1047b src/cpu/o3/lsq_unit.hh --- a/src/cpu/o3/lsq_unit.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/cpu/o3/lsq_unit.hh Mon Mar 24 01:08:02 2008 -0400 @@ -40,6 +40,7 @@ #include "arch/faults.hh" #include "arch/locked_mem.hh" #include "config/full_system.hh" +#include "base/fast_alloc.hh" #include "base/hashmap.hh" #include "cpu/inst_seq.hh" #include "mem/packet.hh" @@ -245,7 +246,7 @@ class LSQUnit { Port *dcachePort; /** Derived class to hold any sender state the LSQ needs. */ - class LSQSenderState : public Packet::SenderState + class LSQSenderState : public Packet::SenderState, public FastAlloc { public: /** Default constructor. */ diff -r d1531963b59d -r 125d59b1047b src/cpu/ozone/lw_lsq.hh --- a/src/cpu/ozone/lw_lsq.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/cpu/ozone/lw_lsq.hh Mon Mar 24 01:08:02 2008 -0400 @@ -39,6 +39,7 @@ #include "arch/faults.hh" #include "arch/types.hh" #include "config/full_system.hh" +#include "base/fast_alloc.hh" #include "base/hashmap.hh" #include "cpu/inst_seq.hh" #include "mem/packet.hh" @@ -301,7 +302,7 @@ class OzoneLWLSQ { }; /** Derived class to hold any sender state the LSQ needs. */ - class LSQSenderState : public Packet::SenderState + class LSQSenderState : public Packet::SenderState, public FastAlloc { public: /** Default constructor. */ diff -r d1531963b59d -r 125d59b1047b src/dev/io_device.hh --- a/src/dev/io_device.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/dev/io_device.hh Mon Mar 24 01:08:02 2008 -0400 @@ -32,6 +32,7 @@ #ifndef __DEV_IO_DEVICE_HH__ #define __DEV_IO_DEVICE_HH__ +#include "base/fast_alloc.hh" #include "mem/mem_object.hh" #include "mem/packet.hh" #include "mem/tport.hh" @@ -73,7 +74,7 @@ class DmaPort : public Port class DmaPort : public Port { protected: - struct DmaReqState : public Packet::SenderState + struct DmaReqState : public Packet::SenderState, public FastAlloc { /** Event to call on the device when this transaction (all packets) * complete. */ diff -r d1531963b59d -r 125d59b1047b src/mem/bridge.hh --- a/src/mem/bridge.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/mem/bridge.hh Mon Mar 24 01:08:02 2008 -0400 @@ -42,6 +42,7 @@ #include <inttypes.h> #include <queue> +#include "base/fast_alloc.hh" #include "mem/mem_object.hh" #include "mem/packet.hh" #include "mem/port.hh" @@ -73,7 +74,7 @@ class Bridge : public MemObject /** Pass ranges from one side of the bridge to the other? */ std::vector<Range<Addr> > filterRanges; - class PacketBuffer : public Packet::SenderState { + class PacketBuffer : public Packet::SenderState, public FastAlloc { public: Tick ready; diff -r d1531963b59d -r 125d59b1047b src/mem/cache/cache_impl.hh --- a/src/mem/cache/cache_impl.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/mem/cache/cache_impl.hh Mon Mar 24 01:08:02 2008 -0400 @@ -38,6 +38,7 @@ */ #include "sim/host.hh" +#include "base/fast_alloc.hh" #include "base/misc.hh" #include "base/range_ops.hh" @@ -346,7 +347,7 @@ Cache<TagStore>::access(PacketPtr pkt, B } -class ForwardResponseRecord : public Packet::SenderState +class ForwardResponseRecord : public Packet::SenderState, public FastAlloc { Packet::SenderState *prevSenderState; int prevSrc; diff -r d1531963b59d -r 125d59b1047b src/mem/packet.hh --- a/src/mem/packet.hh Sat Mar 22 22:17:15 2008 -0400 +++ b/src/mem/packet.hh Mon Mar 24 01:08:02 2008 -0400 @@ -295,7 +295,7 @@ class Packet : public FastAlloc, public * needed to process it. A specific subclass would be derived * from this to carry state specific to a particular sending * device. */ - class SenderState : public FastAlloc { + class SenderState { public: virtual ~SenderState() {} }; @@ -304,7 +304,7 @@ class Packet : public FastAlloc, public * Object used to maintain state of a PrintReq. The senderState * field of a PrintReq should always be of this type. */ - class PrintReqState : public SenderState { + class PrintReqState : public SenderState, public FastAlloc { /** An entry in the label stack. */ class LabelStackEntry { public: @@ -455,7 +455,15 @@ class Packet : public FastAlloc, public /** Destructor. */ ~Packet() - { if (staticData || dynamicData) deleteData(); } + { + // If this is a request packet for which there's no response, + // delete the request object here, since the requester will + // never get the chance. + if (req && isRequest() && !needsResponse()) + delete req; + if (staticData || dynamicData) + deleteData(); + } _______________________________________________ m5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/m5-dev
