This is part of D31947 that is being split into several smaller changes.
This one deals with all the minor changes, more specifically:
- Rename some variables and functions to make their purpose clearer;
- Reorder some code;
- Mark the hot termination incurring checks as UNLIKELY; if they happen, the program will die anyway;
- Add a getScudoChunk method;
- Add an eraseHeader method to ScudoChunk that will clear a header with 0s;
- Add a parameter to allocate to know if the allocated chunk should be filled with zeros. This allows calloc to not have to call GetActuallyAllocatedSize; more changes to get rid of this function on the hot paths will follow;
- reallocate was missing a check to verify that the pointer is properly aligned on MinAlignment;
- The Stats in the secondary have to be protected by a mutex as the Add and Sub methods are actually not atomic;
- The software CRC32 function was moved to the header to allow for inlining.
StaticSpinMutex does not need initialization. If anything this can only do harm if the mutex turned out to be locked by somebody else at the moment.
Drop this.