More HHBBC preresolve logic a bit more deterministic
commitc9afa88399c53a649b6dbbfbec1457c38b9ad47c
authorRick Lavoie <rlavoie@fb.com>
Tue, 10 Aug 2021 17:59:37 +0000 (10 10:59 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 10 Aug 2021 18:03:33 +0000 (10 11:03 -0700)
tree90b08973da1bd4b1fd5f6207b412c6e36d4da751
parent181e32eb5a2ad06ee9ab23a3f3d1a70ce7d4e449
More HHBBC preresolve logic a bit more deterministic

Summary:
While doing some A/B diffs on HHBBC, I noticed a large number of
non-deterministic differences. I tracked it down to some
non-determinism in the preresolve logic, mainly around trait
flattening. We processed every class individually (in multiple
threads), but manipulated shared per-Unit state, meaning identical
runs could get different results. We also iterated over the map of
closures, which has a non-deterministic iteration order.

Instead, do the processing on a per-Unit basis, and keep track of
insertion order of the closures.

I don't think any of this has perf implications. It just makes
comparing differences easier.

Reviewed By: mofarrell

Differential Revision: D30203510

fbshipit-source-id: 2322f7a29975560b86897f3de0bbf3c11e3fbb5f
hphp/hhbbc/index.cpp