Eliminate vanilla checks when flag is off
commit400d93b432b4b9fc4bf2f7310a8331daa32378dc
authorShaunak Kishore <kshaunak@fb.com>
Tue, 3 Mar 2020 15:12:49 +0000 (3 07:12 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 3 Mar 2020 15:16:20 +0000 (3 07:16 -0800)
tree610611e5d223d110ad03a8463559cf379c978160
parent014340f38958cc251281c393bbdfd00c032f9223
Eliminate vanilla checks when flag is off

Summary:
In D20195212, I added an assertion that we never do a runtime vanilla check if the AllowBespokeArrayLikes flag is off. This assertion can actually fire, and is almost certainly the cause of the 0.2-0.5% branch miss regression - in fact, we may do fully Θ(n) vanilla checks for a specialized iterator over a Hack array of size n. The problem arises because the "base type" for a specialized array is used in both checks and assertions, so if we don't have sufficient type information, we can emit a CheckType<Vec=Vanilla> even with the flag off.

To fix this problem, I opted to go back to the behavior before D19819685 where jit/check.cpp doesn't require vanilla types with the AllowBespokeArrayLikes flag unset. This behavior allows us to completely short-circuit any vanilla-related logic for opt builds with the flag unset.

Reviewed By: ricklavoie

Differential Revision: D20205671

fbshipit-source-id: ee63d85f31bd78b11de7ab2a80ef396fa1ecdee4
hphp/runtime/test/simplifier.cpp
hphp/runtime/vm/jit/check.cpp
hphp/runtime/vm/jit/guard-constraint.cpp
hphp/runtime/vm/jit/irgen-bespoke.cpp
hphp/runtime/vm/jit/irgen-iter-spec.cpp
hphp/runtime/vm/jit/simplify.cpp