From 9e3c8de30bafe33f35e4b9e82fb49418941f8cb7 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Fri, 24 Feb 2012 11:45:30 -0500 Subject: 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. --- src/cpu/thread_context.hh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/cpu/thread_context.hh') 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(); } -- cgit v1.2.3