Gets HphpArrays into a flat mode using MM().objMalloc()
instead of SmartAllocator. Various optimizations were needed to the
Make functions to get this to work out ok. Growth still creates a
non-flat HphpArray (leaving a PromotedPayload behind so we know how
big the original allocation was).
Reviewed By: @edwinsmith
Differential Revision: D969431
Various cleanups that I factored out of other work.
Eliminate ElmInd; it's usefulness is pretty low since we rely on
int32_t for the hashtable storage and ssize_t for locals and
and parameters that pass around array positions.
Renamed a few things for brevity & clarity.
Moved some inline functions to hphp-array-defs.h.
More use of auto, replace Elm* with auto& in several places.
Eliminate a bunch of unnecessary ssize_t() casts.
s/ElmIndEmpty/invalid_index in several places.
Reviewed By: bertrand
Differential Revision: D968744
This was a nice hack since lots of arrays are packed, however now that
enough are actually kPackedKind, this test doesn't appear to pay for
itself (not called as often as before, and nearly always false).
Reviewed By: @jdelong
Differential Revision: D963530
Get the data representation all at the end, and keep all
privates non-data members at the end too. Private ctors (eventually
should be removed and replaced by the Make functions) so we can change
its allocation behavior. The public members are still in a mostly
random order for now, and I left the bulk of the non-static private
member functions alone.
Reviewed By: @edwinsmith
Differential Revision: D960965
We only handle a few easy cases for these, but since these
operations renumber and compact elements on Mixed arrays,
there's no point in escalating from packed to mixed; we might
as well do memmove and leave the existing 0..N numbering.
Differential Revision: D945517
The AddLval methods were fairly cold, so reimplement them in
terms of lval(), but preserve the assert that ensures the keys
being added do not already exist. This reduces the number
of kind-specific methods we need to implement.
Added Array::setWithRef(key,value) to capture a common use
case for lvalAt(). Later this can implemented more efficiently
as a virtual method in ArrayData subclasses.
Differential Revision: D937227
Most strings used as keys are either small or not shared, where the
data pointers cannot be equal. Of the rest (shared), most could have
been small.
This diff copies small SharedVariant strings, so they don't refer
back to the SharedVariant, and don't need to be enlisted. Then,
this changes hitStringKey() to not check data pointers, making it
equivalent to StringData::same(). Lastly, hand-write the comparison
loop in StringData::same() so we compare words at a time, and the
loop can be inlined.
Differential Revision: D937233
Enable guarding tracelets on ArrayKind when we can generate
better code for a specific kind.
Added specialized helpers for CGetM, FPassM, and IssetM of
vector-shaped arrays. This eliminates an indirect call and allows the
entire array-access call stack to be inlined into the helper
Differential Revision: D873631