Simplify Hack array migration logic with arrLikeVal
commit744571ce2e8c7f438067d6a6f35a987a327e0db6
authorShaunak Kishore <kshaunak@fb.com>
Fri, 3 Jan 2020 23:30:11 +0000 (3 15:30 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 3 Jan 2020 23:32:28 +0000 (3 15:32 -0800)
tree64ef4cc6dc7141a89cc843f4331643979e99c6d4
parent4ebc79607055522a5b5d6ac4c81f1fe9fd8be1d1
Simplify Hack array migration logic with arrLikeVal

Summary:
If t is a jit::Type* and t->hasConstVal(TArrLike), we can use t->arrLikeVal() to handle array-likes uniformly. Doing so makes the code simpler and should help with projects that plan on adding or changing array types, such as the Hack array migration (HAM).

There are a few places which are truly constrained to dicts, vecs, or keysets, where I left the current usage alone. I also did a quick audit of the code calling arrLikeVal to check whether it was indeed layout-agnostic, which was true except in a handful of places that got the value and then asserted e.g. hasMixedLayout. Packed and mixed layout assertions should work equally well before and after HAM.

Reviewed By: jjgriego

Differential Revision: D19248981

fbshipit-source-id: 9ab7f43ea15e6fb102a12e74425e40dfde39cda9
hphp/runtime/vm/jit/irgen-builtin.cpp
hphp/runtime/vm/jit/irgen-call.cpp
hphp/runtime/vm/jit/irgen-func-prologue.cpp
hphp/runtime/vm/jit/irgen-types.cpp
hphp/runtime/vm/jit/irlower-array.cpp
hphp/runtime/vm/jit/simplify.cpp
hphp/runtime/vm/jit/ssa-tmp.cpp
hphp/runtime/vm/jit/type-array-elem.cpp
hphp/runtime/vm/jit/type.cpp
hphp/runtime/vm/jit/type.h