summaryrefslogtreecommitdiff
path: root/src/python
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:07:06 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-10-15 08:07:06 -0400
commit8cc503f1dd535690a9e50188d0216844057125f8 (patch)
tree3cb664ed7bbc68456121f9894d7395f754782b6a /src/python
parent36d199b9a96838359230f1ae8a40446e05296145 (diff)
downloadgem5-8cc503f1dd535690a9e50188d0216844057125f8.tar.xz
Param: Fix proxy traversal to support chained proxies
This patch modifies how proxies are traversed and unproxied to allow chained proxies. The issue that is solved manifested itself when a proxy during its evaluation ended up being hitting another proxy, and the second one got evaluated using the object that was originally used for the first proxy. For a more tangible example, see the following patch on making the default clock being inherited from the parent. In this patch, the CPU clock is a proxy Parent.clock, which is overridden in the system to be an actual value. This all works fine, but the AlphaLinuxSystem has a boot_cpu_frequency parameter that is Self.cpu[0].clock.frequency. When the latter is evaluated, it all happens relative to the current object of the proxy, i.e. the system. Thus the cpu.clock is evaluated as Parent.clock, but using the system rather than the cpu as the object to enquire.
Diffstat (limited to 'src/python')
-rw-r--r--src/python/m5/proxy.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py
index 8c1a46909..4582b8f09 100644
--- a/src/python/m5/proxy.py
+++ b/src/python/m5/proxy.py
@@ -151,6 +151,10 @@ class AttrProxy(BaseProxy):
def find(self, obj):
try:
val = getattr(obj, self._attr)
+ # for any additional unproxying to be done, pass the
+ # current, rather than the original object so that proxy
+ # has the right context
+ obj = val
except:
return None, False
while isproxy(val):