Introduce TopStructLayout
commitc8c04bc5ff29863464377e988c8ee72c2c89debb
authorShaunak Kishore <kshaunak@fb.com>
Fri, 16 Apr 2021 02:48:13 +0000 (15 19:48 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 16 Apr 2021 02:49:28 +0000 (15 19:49 -0700)
treee953ed928abb6113181885c5f2c08a64b7cce376
parent351d7476ec0b7410a16a4ea24fcff18a34523344
Introduce TopStructLayout

Summary:
Introduce this abstract layout. It passes is_struct, so we can use LdStructDictElem and StructDictSet with it; modify those irlower routines to handle the abstract case. (We want to include the abstract layout in is_struct to match other predicates like "monotype", where it's essential; adding it in is not a problem because any caller that wants to limit to concrete StructLayout can still do so.)

Add type inference for TopStructLayout, extending StructLayout and fixing bugs while we're at it. For example, StructLayout::elemType would incorrectly return TBottom if its keyType couldBe TInt. It's safe because we don't have mixed key inputs for any of these ops, but we should fix it. Please review these changes carefully.

Add layout selection for TopStructLayout. We now will probabilistically specialize sinks to either a specific struct layout or to the top struct layout, even if they include some non-struct inputs.

Reviewed By: colavitam

Differential Revision: D27767113

fbshipit-source-id: fdd7255244aef59a9ae8edb494e4b6a31bdb571a
hphp/runtime/base/bespoke/layout-selection.cpp
hphp/runtime/base/bespoke/logging-profile.cpp
hphp/runtime/base/bespoke/struct-dict.cpp
hphp/runtime/base/bespoke/struct-dict.h
hphp/runtime/vm/jit/array-layout.cpp
hphp/runtime/vm/jit/irlower-bespoke.cpp