@@ -41,9 +41,26 @@ class VariableNameInferrer {
4141 using Options = OptionSet<Flag>;
4242
4343private:
44- template <typename T, unsigned smallSize>
44+ // / A two phase stack data structure. The first phase only allows for two
45+ // / operations:
46+ // /
47+ // / 1. pushing elements onto the stack.
48+ // / 2. pushing/popping a "snapshot" of the stack (see description below).
49+ // /
50+ // / The second phase only allows for the stack to be drained.
51+ // /
52+ // / DISCUSSION: The snapshot operation stashes the current size of the
53+ // / variable name path array when the snapshot operation occurs. If one pops
54+ // / the snapshot, the data structure sets its current insertion point to be
55+ // / the old stack point effectively popping off all of the elements of the
56+ // / stack until the last snapshot. This is useful when working with things
57+ // / like phis where one wants to speculatively push items onto this stack
58+ // / while discovering if one has an actual interesting value from the phi. If
59+ // / one fails to find something interesting, then one can just pop the
60+ // / snapshot and go process the next phi incoming value.
61+ template <typename T, unsigned SmallSize>
4562 class VariableNamePathArray {
46- SmallVector<T, smallSize > data;
63+ SmallVector<T, SmallSize > data;
4764
4865 unsigned lastSnapShotIndex = 0 ;
4966 unsigned insertionPointIndex = 0 ;
0 commit comments