Deal with empty arrays better
commit2f7d8b066fbf219257c21cd3701d5d75d6506066
authorJordan DeLong <jdelong@fb.com>
Thu, 6 Mar 2014 02:52:28 +0000 (5 18:52 -0800)
committerSara Golemon <sgolemon@fb.com>
Wed, 12 Mar 2014 00:37:48 +0000 (11 17:37 -0700)
tree97101ebf1dd016290def44efc258bd26132a09d5
parenta821670f17ae785cf9cd228709c90d069b2349de
Deal with empty arrays better

Previously, all the specialized array types implied that the
array was non-empty.  This fails to get types in some common idioms
(e.g. populating a vector-like array in a loop, where it was empty
going into the loop.)  This diff just adds new bits for empty arrays,
so any of the specialized array types can be unioned with either
counted or uncounted empty arrays.

Reviewed By: @dariorussi

Differential Revision: D1208262
22 files changed:
hphp/hhbbc/analyze.cpp
hphp/hhbbc/hhbbc.h
hphp/hhbbc/index.cpp
hphp/hhbbc/interp-minstr.cpp
hphp/hhbbc/interp-state.cpp
hphp/hhbbc/interp.cpp
hphp/hhbbc/optimize.cpp
hphp/hhbbc/show.cpp
hphp/hhbbc/stats.cpp
hphp/hhbbc/test/type-system.cpp
hphp/hhbbc/type-system.cpp
hphp/hhbbc/type-system.h
hphp/test/slow/hhbbc/array_056.php [new file with mode: 0644]
hphp/test/slow/hhbbc/array_056.php.expect [new file with mode: 0644]
hphp/test/slow/hhbbc/array_057.php [new file with mode: 0644]
hphp/test/slow/hhbbc/array_057.php.expect [new file with mode: 0644]
hphp/test/slow/hhbbc/iter_004.php [new file with mode: 0644]
hphp/test/slow/hhbbc/iter_004.php.expect [new file with mode: 0644]
hphp/test/slow/hhbbc/iter_005.php [new file with mode: 0644]
hphp/test/slow/hhbbc/iter_005.php.expect [new file with mode: 0644]
hphp/test/slow/hhbbc/iter_006.php [new file with mode: 0644]
hphp/test/slow/hhbbc/iter_006.php.expect [new file with mode: 0644]