- Reland rL324263, this time allowing for a compile-time decision as to whether or not use the 32-bit division. A single test is using a class map covering a maximum size greater than 4GB, this can be checked via the template parameters, and allows SizeClassAllocator64PopulateFreeListOOM to pass;
- MaxCachedHint is always called on a class id for which we have already computed the size, but we still recompute Size(class_id). Change the prototype of the function to work on sizes instead of class ids. This also allows us to get rid of the kBatchClassID special case. Update the callers accordingly;
- InitCache and Drain will start iterating at index 1: index 0 contents are unused and can safely be left to be 0. Plus we do not pay the cost of going through an UNLIKELY in MaxCachedHint, and touching memory that is otherwise not used;
- const some variables in the areas modified;
- Remove an spurious extra line at the end of a file.
Details
Diff Detail
- Repository
- rCRT Compiler Runtime
Event Timeline
lib/sanitizer_common/sanitizer_allocator_local_cache.h | ||
---|---|---|
101 | Does c->class_size = Allocator::ClassIdToSize(i); c->max_count = 2 * SizeClassMap::MaxCachedHint(c->class_size); lead to less optimal code? | |
223–224 | I think we should either use size everywhere in this function or assign c->class_size first and then use it everywhere. |
lib/sanitizer_common/sanitizer_allocator_local_cache.h | ||
---|---|---|
101 | It leads to almost exactly the same asm (at least for x64). |
lib/sanitizer_common/sanitizer_allocator_local_cache.h | ||
---|---|---|
234 | If keeping the size construct, I can use size instead of c->class_size here. |
lib/sanitizer_common/sanitizer_allocator_local_cache.h | ||
---|---|---|
101 | After discussion, having a const uptr size looks safer to prevent a potential refetching. So this will stay as is. |
lib/sanitizer_common/sanitizer_allocator_local_cache.h | ||
---|---|---|
101 | As discussed offline, let's keep the current version and switch to 'size' in InitCache. |
Does
lead to less optimal code?