1.1 --- a/optimiser.py Thu Feb 09 21:44:25 2017 +0100
1.2 +++ b/optimiser.py Fri Feb 10 16:01:18 2017 +0100
1.3 @@ -293,7 +293,7 @@
1.4 # Partition attributes into separate sections so that class and instance
1.5 # attributes are treated separately.
1.6
1.7 - for source, objtype in [
1.8 + for source, objkind in [
1.9 (self.importer.all_class_attrs, "<class>"),
1.10 (self.importer.all_instance_attrs, "<instance>"),
1.11 (self.importer.all_module_attrs, "<module>")
1.12 @@ -304,7 +304,7 @@
1.13 # Remove temporary names from structures.
1.14
1.15 attrnames = filter(lambda x: not x.startswith("$t"), attrnames)
1.16 - self.all_attrs[(objtype, name)] = attrnames
1.17 + self.all_attrs[(objkind, name)] = attrnames
1.18
1.19 self.locations = get_allocated_locations(self.all_attrs, get_attributes_and_sizes)
1.20
1.21 @@ -328,8 +328,8 @@
1.22
1.23 # Record the structures.
1.24
1.25 - for (objtype, name), attrnames in self.all_attrs.items():
1.26 - key = Reference(objtype, name)
1.27 + for (objkind, name), attrnames in self.all_attrs.items():
1.28 + key = Reference(objkind, name)
1.29 l = self.structures[key] = [None] * len(attrnames)
1.30 for attrname in attrnames:
1.31 position = attr_locations[attrname]
1.32 @@ -672,10 +672,10 @@
1.33
1.34 attrs = {}
1.35 sizes = {}
1.36 - objtypes = {}
1.37 + objkinds = {}
1.38
1.39 for name, attrnames in d.items():
1.40 - objtype, _name = name
1.41 + objkind, _name = name
1.42
1.43 for attrname in attrnames:
1.44
1.45 @@ -694,8 +694,8 @@
1.46
1.47 # Record the object types/kinds supporting the attribute.
1.48
1.49 - init_item(objtypes, attrname, set)
1.50 - objtypes[attrname].add(objtype)
1.51 + init_item(objkinds, attrname, set)
1.52 + objkinds[attrname].add(objkind)
1.53
1.54 # Obtain attribute details in order of size and occupancy.
1.55
1.56 @@ -703,7 +703,7 @@
1.57
1.58 rsizes = []
1.59 for attrname, size in sizes.items():
1.60 - priority = "<instance>" in objtypes[attrname] and 0.5 or 1
1.61 + priority = "<instance>" in objkinds[attrname] and 0.5 or 1
1.62 occupied = len(attrs[attrname])
1.63 key = (priority * size, size, len(names) - occupied, attrname)
1.64 rsizes.append(key)
1.65 @@ -789,7 +789,7 @@
1.66 """
1.67 Return a list where each element corresponds to a structure location and
1.68 contains a set of attribute names that may be stored at that location, given
1.69 - a mapping 'd' whose keys are (object type, object name) tuples and whose
1.70 + a mapping 'd' whose keys are (object kind, object name) tuples and whose
1.71 values are collections of attributes.
1.72 """
1.73