From: Ali Saidi Date: Mon, 19 Nov 2007 23:23:43 +0000 (-0500) Subject: Memory: Cache the physical memory start and size so we don't need a dynamic cast... X-Git-Tag: m5_2.0_beta5~77^2~2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8026ecbb8e9f93894b15ac5422c58ecedfbf9fdf;p=gem5.git Memory: Cache the physical memory start and size so we don't need a dynamic cast on every access. --HG-- extra : convert_revision : d6c3e93718991e7b68248242c80d8e6ac637ac51 --- diff --git a/src/mem/physical.cc b/src/mem/physical.cc index 8c56d340f..a3a9df64e 100644 --- a/src/mem/physical.cc +++ b/src/mem/physical.cc @@ -70,6 +70,10 @@ PhysicalMemory::PhysicalMemory(const Params *p) memset(pmemAddr, 0, p->range.size()); pagePtr = 0; + + cachedSize = params()->range.size(); + cachedStart = params()->range.start; + } void diff --git a/src/mem/physical.hh b/src/mem/physical.hh index b06cc90f8..c3749bd5b 100644 --- a/src/mem/physical.hh +++ b/src/mem/physical.hh @@ -149,10 +149,12 @@ class PhysicalMemory : public MemObject std::vector ports; typedef std::vector::iterator PortIterator; + uint64_t cachedSize; + uint64_t cachedStart; public: Addr new_page(); - uint64_t size() { return params()->range.size(); } - uint64_t start() { return params()->range.start; } + uint64_t size() { return cachedSize; } + uint64_t start() { return cachedStart; } public: typedef PhysicalMemoryParams Params;