Optimize idx/ArrayGet for OOB/undefined index on static arrays by keeping a side...
commit3ab677fc44cc0ced787c8d1534ad372da379ec1c
authorOguz Ulgen <oulgen@fb.com>
Tue, 5 May 2020 18:16:12 +0000 (5 11:16 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 5 May 2020 18:24:13 +0000 (5 11:24 -0700)
tree9789a0898f425837fd4d8fe4e558607bff397a8e
parent10248b2810761a2625af9fe241e83f206530974a
Optimize idx/ArrayGet for OOB/undefined index on static arrays by keeping a side table

Summary:
This diff adds a side table attached to static ArrayData* in order to quickly check whether an element exists on the ArrayData*. Since make use of bottom bits of hashes, the table can give false positives but never a false negative.
We make use of ArrayAccessProfile to choose when to run this optimization.

Differential Revision: D21026058

fbshipit-source-id: d794cb74a535113088004ae5f8bef2fe779e1bd5
20 files changed:
hphp/doc/ir.specification
hphp/runtime/base/array-data-inl.h
hphp/runtime/base/array-data.h
hphp/runtime/base/array-provenance.cpp
hphp/runtime/base/header-kind.h
hphp/runtime/base/mixed-array-defs.h
hphp/runtime/base/mixed-array.cpp
hphp/runtime/base/runtime-option.h
hphp/runtime/base/str-key-table.cpp [new file with mode: 0644]
hphp/runtime/base/str-key-table.h [new file with mode: 0644]
hphp/runtime/vm/jit/array-access-profile.cpp
hphp/runtime/vm/jit/array-access-profile.h
hphp/runtime/vm/jit/dce.cpp
hphp/runtime/vm/jit/ir-opcode.cpp
hphp/runtime/vm/jit/irgen-builtin.cpp
hphp/runtime/vm/jit/irgen-minstr.h
hphp/runtime/vm/jit/irlower-minstr.cpp
hphp/runtime/vm/jit/memory-effects.cpp
hphp/runtime/vm/jit/simplify.cpp
hphp/util/trace.h