diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2012-02-24 11:45:30 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2012-02-24 11:45:30 -0500 |
commit | 9e3c8de30bafe33f35e4b9e82fb49418941f8cb7 (patch) | |
tree | 016c65f8060c49b31d3fd3c064b97ae09279d689 /src/sim/system.hh | |
parent | 1031b824b975cec999c37cabc8c05c485a4ae5ca (diff) | |
download | gem5-9e3c8de30bafe33f35e4b9e82fb49418941f8cb7.tar.xz |
MEM: Make port proxies use references rather than pointers
This patch is adding a clearer design intent to all objects that would
not be complete without a port proxy by making the proxies members
rathen than dynamically allocated. In essence, if NULL would not be a
valid value for the proxy, then we avoid using a pointer to make this
clear.
The same approach is used for the methods using these proxies, such as
loadSections, that now use references rather than pointers to better
reflect the fact that NULL would not be an acceptable value (in fact
the code would break and that is how this patch started out).
Overall the concept of "using a reference to express unconditional
composition where a NULL pointer is never valid" could be done on a
much broader scale throughout the code base, but for now it is only
done in the locations affected by the proxies.
Diffstat (limited to 'src/sim/system.hh')
-rw-r--r-- | src/sim/system.hh | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/sim/system.hh b/src/sim/system.hh index 9d11132e5..dd122161d 100644 --- a/src/sim/system.hh +++ b/src/sim/system.hh @@ -56,20 +56,18 @@ #include "cpu/pc_event.hh" #include "enums/MemoryMode.hh" #include "kern/system_events.hh" +#include "mem/fs_translating_port_proxy.hh" #include "mem/mem_object.hh" #include "mem/port.hh" #include "params/System.hh" class BaseCPU; class BaseRemoteGDB; -class FSTranslatingPortProxy; class GDBListener; class ObjectFile; class PhysicalMemory; class Platform; -class PortProxy; class ThreadContext; -class VirtualPort; class System : public MemObject { @@ -117,14 +115,14 @@ class System : public MemObject virtual void init(); /** - * Get a pointer to the system port that can be used by + * Get a reference to the system port that can be used by * non-structural simulation objects like processes or threads, or * external entities like loaders and debuggers, etc, to access * the memory system. * - * @return a pointer to the system port we own + * @return a reference to the system port we own */ - Port* getSystemPort() { return &_systemPort; } + Port& getSystemPort() { return _systemPort; } /** * Additional function to return the Port of a memory object. @@ -181,8 +179,8 @@ class System : public MemObject /** Port to physical memory used for writing object files into ram at * boot.*/ - PortProxy* physProxy; - FSTranslatingPortProxy* virtProxy; + PortProxy physProxy; + FSTranslatingPortProxy virtProxy; /** kernel symbol table */ SymbolTable *kernelSymtab; |