Add an array kind for the static empty array
commit446c6bc3bd65be3de6e80cb337e7f1435d1bc42f
authorJordan DeLong <jdelong@fb.com>
Thu, 20 Mar 2014 03:32:08 +0000 (19 20:32 -0700)
committerSara Golemon <sgolemon@fb.com>
Wed, 26 Mar 2014 05:32:43 +0000 (25 22:32 -0700)
tree3209e9925f2e20bf0bd823c3b7871e777d011854
parent5d913c82cb34718c67611bb8d5113be4197c5d5e
Add an array kind for the static empty array

The hope here is to reduce packed -> mixed transitions so we
can optimized packed better.  I measured that many of the CopyPacked
calls are happening on the static empty array, and many packedToMixed
calls occur on arrays where m_size == 0, but I haven't measured yet
how many of the latter actually occured immediately after a
CopyPacked.  (Also, it appeared that MakeReserve is still dynamically
a lot more frequent than MakePacked or MakeStruct, so there is
probably more to the story.)  Anyway a side benefit here is that we
can also do more efficient creation of the initial arrays because we
know the new size statically.

Reviewed By: @dariorussi

Differential Revision: D1235798
30 files changed:
hphp/runtime/base/apc-array.cpp
hphp/runtime/base/apc-typed-value.h
hphp/runtime/base/array-data.cpp
hphp/runtime/base/array-data.h
hphp/runtime/base/empty-array.cpp [new file with mode: 0644]
hphp/runtime/base/empty-array.h [new file with mode: 0644]
hphp/runtime/base/hphp-array-defs.h
hphp/runtime/base/hphp-array.cpp
hphp/runtime/base/hphp-array.h
hphp/runtime/ext/ext_array.cpp
hphp/test/slow/array/empty_array_001.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_001.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_002.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_002.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_003.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_003.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_004.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_004.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_005.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_005.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_006.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_006.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_007.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_007.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_008.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_008.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_009.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_009.php.expect [new file with mode: 0644]
hphp/test/slow/array/empty_array_010.php [new file with mode: 0644]
hphp/test/slow/array/empty_array_010.php.expectf [new file with mode: 0644]