No more Decl_store.get_class when folding decls
commit5a3bd211a8dfc631ea98bef4909691b1694ff1d1
authorHenri Verroken <hverr@fb.com>
Thu, 3 Feb 2022 10:41:59 +0000 (3 02:41 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Thu, 3 Feb 2022 10:43:31 +0000 (3 02:43 -0800)
tree796e1550d5118f527a14e44a7ef44babcfcde78b
parent6013e836ccd85bb5bf96c887d34ef4603a2e7240
No more Decl_store.get_class when folding decls

Summary:
While folding a class under eviction, we can't rely on the invariant that shared memory contains the folded decls of the parents.

Luckily, CatherineGasnier already did most of the plumbing in D24565546 (https://github.com/facebook/hhvm/commit/90fd38cfe65406aa582ebf35dea14ab8823fc98d), carrying around a `class_cache` that contains entries for (almost; you'll see I had to add `Stringish`) parent decls.

This diff removes calls to `Decl_store.get_class` while folding a class.

It does so by:

1. In `decl_folded_class`: Invoke the new `Decl_env.get_class_and_add_dep ~shmem_fallback:false` which
    1. no longer falls back to `Decl_store.get`
    2. doesn't try to refold a decl when a parent one is missing
2. In `decl_init_check`: Invoke `Decl_env.get_class_and_add_dep ~shmem_fallback:true ~fallback:...` which
    1. will query the shmem heap
    2. if not on zoncolan, try to refold the decl (in zoncolan, refolding craches because shallow decls are unavailable)

We have to manually specify the `~fallback` function to avoid a circular dependency between `Decl_env <-> Decl_folded_class`

Reviewed By: CatherineGasnier

Differential Revision: D32759800

fbshipit-source-id: 9b9fffa8477f9de3389df1fd92570240a66fa0d5
hphp/hack/src/decl/decl_env.ml
hphp/hack/src/decl/decl_env.mli
hphp/hack/src/decl/decl_folded_class.ml
hphp/hack/src/decl/decl_folded_class.mli
hphp/hack/src/decl/decl_init_check.ml
hphp/hack/src/decl/decl_init_check.mli
hphp/hack/src/decl/decl_requirements.ml
hphp/hack/src/providers/provider_backend.ml
hphp/hack/src/providers/provider_backend.mli
hphp/hack/src/typing/nastInitCheck.ml