The BufferNode class has an index that indicates the start of the "active" region of the buffer. Entries before the index should be unused. However, this index is not consistently maintained. As a result, various places that enqueue buffers null out the entries before the index, and places that process buffers skip null entries or at least null leading entries.
The index need not match that in the PtrQueue currently using a BufferNode. We don't want to have to update two index values, and we don't want to have to do extra work to get the BufferNode index when the PtrQueue index is easier to access. The BufferNode index really only needs to be up to date when the node is added to the associated set's queue. That, and paying attention to the value when processing buffers, would eliminate the need for pre-enqueue filling with NULLs and post-fetch skipping of leading NULLs.
The SATBBufferQueue is particularly egregious in it's buffer nulling, as it always stores NULL into the source location before storing the previously obtained source value in the destination, even when the source and destination are the same location!
The index need not match that in the PtrQueue currently using a BufferNode. We don't want to have to update two index values, and we don't want to have to do extra work to get the BufferNode index when the PtrQueue index is easier to access. The BufferNode index really only needs to be up to date when the node is added to the associated set's queue. That, and paying attention to the value when processing buffers, would eliminate the need for pre-enqueue filling with NULLs and post-fetch skipping of leading NULLs.
The SATBBufferQueue is particularly egregious in it's buffer nulling, as it always stores NULL into the source location before storing the previously obtained source value in the destination, even when the source and destination are the same location!