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/cpu/thread_context.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/cpu/thread_context.hh')
-rw-r--r-- | src/cpu/thread_context.hh | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cpu/thread_context.hh b/src/cpu/thread_context.hh index 2f2e5b02b..41941b262 100644 --- a/src/cpu/thread_context.hh +++ b/src/cpu/thread_context.hh @@ -143,9 +143,9 @@ class ThreadContext virtual TheISA::Kernel::Statistics *getKernelStats() = 0; - virtual PortProxy* getPhysProxy() = 0; + virtual PortProxy &getPhysProxy() = 0; - virtual FSTranslatingPortProxy* getVirtProxy() = 0; + virtual FSTranslatingPortProxy &getVirtProxy() = 0; /** * Initialise the physical and virtual port proxies and tie them to @@ -155,7 +155,7 @@ class ThreadContext */ virtual void initMemProxies(ThreadContext *tc) = 0; - virtual SETranslatingPortProxy *getMemProxy() = 0; + virtual SETranslatingPortProxy &getMemProxy() = 0; virtual Process *getProcessPtr() = 0; @@ -319,13 +319,13 @@ class ProxyThreadContext : public ThreadContext TheISA::Kernel::Statistics *getKernelStats() { return actualTC->getKernelStats(); } - PortProxy* getPhysProxy() { return actualTC->getPhysProxy(); } + PortProxy &getPhysProxy() { return actualTC->getPhysProxy(); } - FSTranslatingPortProxy* getVirtProxy() { return actualTC->getVirtProxy(); } + FSTranslatingPortProxy &getVirtProxy() { return actualTC->getVirtProxy(); } void initMemProxies(ThreadContext *tc) { actualTC->initMemProxies(tc); } - SETranslatingPortProxy* getMemProxy() { return actualTC->getMemProxy(); } + SETranslatingPortProxy &getMemProxy() { return actualTC->getMemProxy(); } Process *getProcessPtr() { return actualTC->getProcessPtr(); } |