Eliminate plain PackedArrays
Summary:
On the continuing quest to eliminate EmptyArray and plain PackedArrays...
In this diff, we eliminate the four PackedArray constructor methods that produce plain PackedArrays. These methods are still used to implement the NewArray, NewLikeArrayL, and NewPackedArray bytecodes, which we handle as follows:
- **NewArray:** Simply create a MixedArray with the given capacity instead of a PackedArray.
- **NewLikeArrayL:** Ignore the hinted local, and create a MixedArray with the given capacity.
- **NewPackedArray:** Create a vec, and cast it to a PHP array (which now results in a plain MixedArray).
NewArray, NewLikeArrayL, and NewMixedArray are all exactly equivalent now! I'll admit that the implementation of NewPackedArray is...inefficient, but it just doesn't matter; we've been using the type-checker to eliminate usages of this bytecode, and we're in the process of removing parser support.
One other change we have to make is to have EmptyArray escalate straight to MixedArray. That's easy.
We know we're done with this change because of the stricter rules in PackedArray::checkInvariants. If the array is a varray, it must have PackedKind; otherwise, it must have VecKind.
Reviewed By: dneiter
Differential Revision:
D21693490
fbshipit-source-id:
49f10f8940bdb756f0ff4b85dc4b95f7a34b8df0