Clear mark state implicitly by incrementing a 2-bit version
commitf1ca2511d0efc109db6fe1d87e9788918855ccad
authorEdwin Smith <smith@fb.com>
Thu, 21 Sep 2017 13:55:25 +0000 (21 06:55 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Thu, 21 Sep 2017 14:02:21 +0000 (21 07:02 -0700)
tree3824820140d23027849399ed71643fe2618b5663
parentf34e265447768031edc939dac57f38520e48a37e
Clear mark state implicitly by incrementing a 2-bit version

Summary:
The GC init phase currently scans the whole heap, clearing the
mark bit for every object. By using a two-bit version, the
clear becomes O(1) by incrementing a global "version". Any object
with a different version is "unmarked".

This uses 2 bits instead of 1, so newly allocated objects can
hardcode the version value 0, instead of loading a global value.
The actual global version counter cycles between 1-2-3.

Implicit clearing of mark-state eliminates a lot of stores, but
doesn't eliminate the whole-heap scan yet; we still need it to
reconstruct crossing maps. That will be optimized separately.

Reviewed By: ricklavoie

Differential Revision: D5827657

fbshipit-source-id: bbba9666275c1e1386ee5231f713fe3b01b304af
hphp/runtime/base/header-kind.h
hphp/runtime/base/heap-collect.cpp
hphp/runtime/base/memory-manager-defs.h
hphp/runtime/base/memory-manager.h
hphp/runtime/test/slab-xmap-test.cpp