Rework interp-minstr logic in HHBBC
Summary:
The interp-minstr logic in HHBBC was quite old, had undergone a lot of
changes, and was quite confusing. In addition, it was dealing with a
number of cases which don't happen anymore (various array and stdclass
promotions). Rounds of edits to the logic also left a lot of
non-sensical code (loading values and never using them, calling empty
functions, etc etc).
I audited all of the interp-minstr logic related to elem accesses and
brought it all up to date with the current runtime behavior. This
allowed me to refine the analysis so now we can detect effect-free
minstr sequences a lot better and const fold then more
aggressively. In addition, previously we weren't accounting for a
number of corner cases (Uninit locals, base ClsMeth promotion,
etc). This is all dealt with now. I didn't touch logic related to
properties that much. It's less complicated anyways.
There are a number of improvements, but I'd like to single out that we
now have array_like_set, array_like_elem, and
array_like_newelem. Unlike the others, this can handle arbitrary
TOptArrLike types. If the type is a union of different array types, it
will automatically call the appropriate specific functions and union
together the results. This leads to better analysis because we no
longer need to give up if we have an union.
While I was at it, change a number of nothrow() calls in interp.cc to
effect_free() because they're actually effect-free. This makes const
prop more effective.
Differential Revision:
D25510513
fbshipit-source-id:
67e3970ddacb75e678214158ec49297be01d93b3