1.1 --- a/optimiser.py Wed Feb 08 17:24:31 2017 +0100
1.2 +++ b/optimiser.py Thu Feb 09 00:36:41 2017 +0100
1.3 @@ -288,7 +288,7 @@
1.4
1.5 "Populate objects using attribute and usage information."
1.6
1.7 - all_attrs = {}
1.8 + self.all_attrs = {}
1.9
1.10 # Partition attributes into separate sections so that class and instance
1.11 # attributes are treated separately.
1.12 @@ -298,10 +298,11 @@
1.13 (self.importer.all_instance_attrs, "<instance>"),
1.14 (self.importer.all_module_attrs, "<module>")
1.15 ]:
1.16 - for name, attrs in source.items():
1.17 - all_attrs[(objtype, name)] = attrs
1.18
1.19 - self.locations = get_allocated_locations(all_attrs, get_attributes_and_sizes)
1.20 + for name, attrnames in source.items():
1.21 + self.all_attrs[(objtype, name)] = attrnames
1.22 +
1.23 + self.locations = get_allocated_locations(self.all_attrs, get_attributes_and_sizes)
1.24
1.25 def populate_parameters(self):
1.26
1.27 @@ -323,20 +324,14 @@
1.28
1.29 # Record the structures.
1.30
1.31 - for source, objtype in [
1.32 - (self.importer.all_class_attrs, "<class>"),
1.33 - (self.importer.all_instance_attrs, "<instance>"),
1.34 - (self.importer.all_module_attrs, "<module>")
1.35 - ]:
1.36 -
1.37 - for name, attrnames in source.items():
1.38 - key = Reference(objtype, name)
1.39 - l = self.structures[key] = [None] * len(attrnames)
1.40 - for attrname in attrnames:
1.41 - position = attr_locations[attrname]
1.42 - if position >= len(l):
1.43 - l.extend([None] * (position - len(l) + 1))
1.44 - l[position] = attrname
1.45 + for (objtype, name), attrnames in self.all_attrs.items():
1.46 + key = Reference(objtype, name)
1.47 + l = self.structures[key] = [None] * len(attrnames)
1.48 + for attrname in attrnames:
1.49 + position = attr_locations[attrname]
1.50 + if position >= len(l):
1.51 + l.extend([None] * (position - len(l) + 1))
1.52 + l[position] = attrname
1.53
1.54 def initialise_access_instructions(self):
1.55