Eliminate abstract "EmptyOrMonotype" layouts
Summary:
EmptyOrMonotypeVec<String> is an abstract bespoke::Layout with three concrete children:
- MonotypeVec<String>
- MonotypeVec<PersistentString>
- EmptyMonotypeVec
Now that colavitam has made it possible to use a MonotypeVec's methods on an EmptyMonotypeVec, we no longer need this abstract node. We can simply make EmptyMonotypeVec a child of MonotypeVec<T> for all DataTypes T. (We've long had the ability to have concrete layouts that are children of other concrete layouts; the difference now is that punning lets us have such relationships even when the exact native helpers of the parent and child don't match, as long as the parent's ones work on the child.)
Doing so cleans up some ugly types. It makes it easier to optimize layout tests, as the resulting type lattice is much more natural. We also do the same to dicts.
To get this change to work, we have to update a few implementation details:
- We make the type() of the empty vec and dict be kExtraInvalidDataType == 0. That's needed for the new unordered-code type tests.
- We update a few functions on MonotypeVec and MonotypeDict to work on empty inputs, notably: HeapSize, ToDVArray, ToHackArray, and SetLegacyArray.
Reviewed By: colavitam
Differential Revision:
D26655996
fbshipit-source-id:
d8c55ac681a4fd9dfc86eeaf2e366d1cede5ac1d