Cached block may have nearly aligned address for a certain alignment so
that we don't have to round up the size in advance. The rounding should
only happen at determing the availability of a cached block.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Just reviewed this again. canCache() may still want to consider the size of headers. Instead of using Size nor RoundedSize, Size + size-of-all-headers is more reasonable here.
LGTM as long as I am correct about the one comment I left.
compiler-rt/lib/scudo/standalone/secondary.h | ||
---|---|---|
266 | I presume you are passing in the HeadersSize to avoid calling getHeadersSize() again. Or to add tests for the function in the future. If I'm wrong, let me know. |
compiler-rt/lib/scudo/standalone/secondary.h | ||
---|---|---|
266 | Calling getHeadersSize() in Cache will be MapAllocator<Config>::getHeadersSize(). Instead of adding direct dependency with MapAllocator, I tend to inject the dependency by passing the size. (However, it's called MapAllocatorCache...) No strong opinion here, let me know if you think calling getHeadersSize is better. |
LGTM.
compiler-rt/lib/scudo/standalone/secondary.h | ||
---|---|---|
266 | I think it's fine the way it is. Having the parameter does allow for testing that value in the future. |
I presume you are passing in the HeadersSize to avoid calling getHeadersSize() again. Or to add tests for the function in the future.
If I'm wrong, let me know.