Make DataWalker::LookupFeature reflect how we actually use it.
commite4bd89a1f2e3e1e33d6bb852e206e0da6d42ca6b
authorAlexey Toptygin <alexeyt@fb.com>
Mon, 1 Mar 2021 21:51:57 +0000 (1 13:51 -0800)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 1 Mar 2021 21:53:58 +0000 (1 13:53 -0800)
tree932d488040ce2c3881e1b4aecd835937b636538a
parenta2edc7e650b89f2f51ca3f626e0ca60721bca53c
Make DataWalker::LookupFeature reflect how we actually use it.

Summary:
DataWalker has exactly 3 callers; apc-array.cpp and apc-collection.cpp pass LookupFeature::DetectNonPersistable and apc-object.cpp passes LookupFeature::DetectSerializable. The callers that pass DetectNonPersistable care about isCircular, and if the data structure does not contain cycles they then care about hasNonPersistable. apc-object.cpp behaves the same whether we detected isCircular or hasSerializable.

In spite of this, DataWalker::LookupFeature is treated as a set of composable bits (with largely unused boolean operators and an unused DataWalker::LookupFeature::Default with no bits set). We don't use DataWalker like this, and we've encoded assumptions about which callers want us to stop early in DataWalker::canStopWalk. The way we've encoded them misbehaves if we e.g. try to set both DetectNonPersistable and DetectSerializable (we no longer stop as soon as we see hasSerializable).

Make DataWalker::LookupFeature a normal, non-bitset enum to reflect how we use it and add a doc comment about assumptions encoded in DataWalker::canStopWalk.

Reviewed By: ricklavoie

Differential Revision: D26703551

fbshipit-source-id: 70d03debad2536b7c96436e39ec2d47a03b1002e
hphp/runtime/base/data-walker.cpp
hphp/runtime/base/data-walker.h