+ # Layouts
+ var method_layout_builder: PropertyLayoutBuilder[PropertyLayoutElement]
+ var attribute_layout_builder: PropertyLayoutBuilder[MAttribute]
+ #FIXME PH and BM layouts too slow for large programs
+ #if modelbuilder.toolcontext.opt_bm_typing.value then
+ # method_layout_builder = new MMethodBMizer(self.mainmodule)
+ # attribute_layout_builder = new MAttributeBMizer(self.mainmodule)
+ #else if modelbuilder.toolcontext.opt_phmod_typing.value then
+ # method_layout_builder = new MMethodHasher(new PHModOperator, self.mainmodule)
+ # attribute_layout_builder = new MAttributeHasher(new PHModOperator, self.mainmodule)
+ #else if modelbuilder.toolcontext.opt_phand_typing.value then
+ # method_layout_builder = new MMethodHasher(new PHAndOperator, self.mainmodule)
+ # attribute_layout_builder = new MAttributeHasher(new PHAndOperator, self.mainmodule)
+ #else
+
+ var class_layout_builder = new MClassColorer(self.mainmodule)
+ class_layout_builder.build_layout(mclasses)
+ method_layout_builder = new MPropertyColorer[PropertyLayoutElement](self.mainmodule, class_layout_builder)
+ attribute_layout_builder = new MPropertyColorer[MAttribute](self.mainmodule, class_layout_builder)
+ #end
+
+ # lookup properties to build layout with
+ var mmethods = new HashMap[MClass, Set[PropertyLayoutElement]]
+ var mattributes = new HashMap[MClass, Set[MAttribute]]
+ for mclass in mclasses do
+ mmethods[mclass] = new HashSet[PropertyLayoutElement]
+ mattributes[mclass] = new HashSet[MAttribute]
+ for mprop in self.mainmodule.properties(mclass) do
+ if mprop isa MMethod then
+ mmethods[mclass].add(mprop)
+ else if mprop isa MAttribute then
+ mattributes[mclass].add(mprop)
+ end
+ end
+ end
+
+ # Collect all super calls (dead or not)
+ var all_super_calls = new HashSet[MMethodDef]
+ for mmodule in self.mainmodule.in_importation.greaters do
+ for mclassdef in mmodule.mclassdefs do
+ for mpropdef in mclassdef.mpropdefs do
+ if not mpropdef isa MMethodDef then continue
+ if mpropdef.has_supercall then
+ all_super_calls.add(mpropdef)
+ end
+ end
+ end
+ end
+
+ # lookup super calls and add it to the list of mmethods to build layout with
+ var super_calls
+ if runtime_type_analysis != null then
+ super_calls = runtime_type_analysis.live_super_sends
+ else
+ super_calls = all_super_calls
+ end
+
+ for mmethoddef in super_calls do
+ var mclass = mmethoddef.mclassdef.mclass
+ mmethods[mclass].add(mmethoddef)
+ for descendant in mclass.in_hierarchy(self.mainmodule).smallers do
+ mmethods[descendant].add(mmethoddef)
+ end
+ end
+