[sanitizers][NFC] Change typesto avoid warnings

Warning was enabled by D94640
This commit is contained in:
Vitaly Buka 2021-02-26 14:32:01 -08:00
parent 3744ba24dc
commit 812a906133
2 changed files with 18 additions and 19 deletions

View File

@ -371,8 +371,7 @@ class SizeClassAllocator64 {
}
~PackedCounterArray() {
if (buffer) {
memory_mapper->UnmapPackedCounterArrayBuffer(
reinterpret_cast<uptr>(buffer), buffer_size);
memory_mapper->UnmapPackedCounterArrayBuffer(buffer, buffer_size);
}
}
@ -803,17 +802,16 @@ class SizeClassAllocator64 {
return released_bytes;
}
uptr MapPackedCounterArrayBuffer(uptr buffer_size) {
void *MapPackedCounterArrayBuffer(uptr buffer_size) {
// TODO(alekseyshl): The idea to explore is to check if we have enough
// space between num_freed_chunks*sizeof(CompactPtrT) and
// mapped_free_array to fit buffer_size bytes and use that space instead
// of mapping a temporary one.
return reinterpret_cast<uptr>(
MmapOrDieOnFatalError(buffer_size, "ReleaseToOSPageCounters"));
return MmapOrDieOnFatalError(buffer_size, "ReleaseToOSPageCounters");
}
void UnmapPackedCounterArrayBuffer(uptr buffer, uptr buffer_size) {
UnmapOrDie(reinterpret_cast<void *>(buffer), buffer_size);
void UnmapPackedCounterArrayBuffer(void *buffer, uptr buffer_size) {
UnmapOrDie(buffer, buffer_size);
}
// Releases [from, to) range of pages back to OS.

View File

@ -1081,11 +1081,11 @@ class NoMemoryMapper {
NoMemoryMapper() : last_request_buffer_size(0) {}
uptr MapPackedCounterArrayBuffer(uptr buffer_size) {
void *MapPackedCounterArrayBuffer(uptr buffer_size) {
last_request_buffer_size = buffer_size;
return 0;
return nullptr;
}
void UnmapPackedCounterArrayBuffer(uptr buffer, uptr buffer_size) {}
void UnmapPackedCounterArrayBuffer(void *buffer, uptr buffer_size) {}
};
class RedZoneMemoryMapper {
@ -1100,14 +1100,15 @@ class RedZoneMemoryMapper {
UnmapOrDie(buffer, 3 * GetPageSize());
}
uptr MapPackedCounterArrayBuffer(uptr buffer_size) {
void *MapPackedCounterArrayBuffer(uptr buffer_size) {
const auto page_size = GetPageSize();
CHECK_EQ(buffer_size, page_size);
memset(reinterpret_cast<void*>(reinterpret_cast<uptr>(buffer) + page_size),
0, page_size);
return reinterpret_cast<uptr>(buffer) + page_size;
void *p =
reinterpret_cast<void *>(reinterpret_cast<uptr>(buffer) + page_size);
memset(p, 0, page_size);
return p;
}
void UnmapPackedCounterArrayBuffer(uptr buffer, uptr buffer_size) {}
void UnmapPackedCounterArrayBuffer(void *buffer, uptr buffer_size) {}
private:
void *buffer;
@ -1227,12 +1228,12 @@ class ReleasedPagesTrackingMemoryMapper {
public:
std::set<u32> reported_pages;
uptr MapPackedCounterArrayBuffer(uptr buffer_size) {
void *MapPackedCounterArrayBuffer(uptr buffer_size) {
reported_pages.clear();
return reinterpret_cast<uptr>(calloc(1, buffer_size));
return calloc(1, buffer_size);
}
void UnmapPackedCounterArrayBuffer(uptr buffer, uptr buffer_size) {
free(reinterpret_cast<void*>(buffer));
void UnmapPackedCounterArrayBuffer(void *buffer, uptr buffer_size) {
free(buffer);
}
void ReleasePageRangeToOS(u32 from, u32 to) {