Initial refactoring of conflict-based instantiation (#7380)
This done an initial pass at refactoring conflict-based instantiation (the code has been largely unchanged since it was written in early 2014). This code is a bottleneck on some Facebook benchmarks and needs revisiting.
This changes the style so the parent modules are made data members instead of passed to methods. Otherwise, it changes int -> size_t wherever applicable, although int is often used to denote possibly valid indices where -1 means invalid.
It updates to use range-based for loops and mostly organizes the order of data members in classes to meet style guidelines.
Followup PRs will make more significant refactoring, e.g. to split the classes into multiple utilities.