[PATCH] D42696: [scudo] Minor Secondary changes
Kostya Kortchinsky via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 1 12:02:24 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rCRT323997: [scudo] Minor Secondary changes (authored by cryptoad, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D42696?vs=132000&id=132444#toc
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D42696
Files:
lib/scudo/scudo_allocator_secondary.h
Index: lib/scudo/scudo_allocator_secondary.h
===================================================================
--- lib/scudo/scudo_allocator_secondary.h
+++ lib/scudo/scudo_allocator_secondary.h
@@ -41,7 +41,7 @@
ReservedAddressRange AddressRange;
uptr MapBeg = AddressRange.Init(MapSize);
- if (MapBeg == ~static_cast<uptr>(0))
+ if (UNLIKELY(MapBeg == ~static_cast<uptr>(0)))
return ReturnNullOrDieOnFailure::OnOOM();
// A page-aligned pointer is assumed after that, so check it now.
CHECK(IsAligned(MapBeg, PageSize));
@@ -58,25 +58,25 @@
if (Alignment > MinAlignment) {
if (!IsAligned(UserBeg, Alignment)) {
UserBeg = RoundUpTo(UserBeg, Alignment);
- CHECK_GE(UserBeg, MapBeg);
- uptr NewMapBeg = RoundDownTo(UserBeg - HeadersSize, PageSize) -
+ DCHECK_GE(UserBeg, MapBeg);
+ const uptr NewMapBeg = RoundDownTo(UserBeg - HeadersSize, PageSize) -
PageSize;
- CHECK_GE(NewMapBeg, MapBeg);
+ DCHECK_GE(NewMapBeg, MapBeg);
if (NewMapBeg != MapBeg) {
AddressRange.Unmap(MapBeg, NewMapBeg - MapBeg);
MapBeg = NewMapBeg;
}
UserEnd = UserBeg + UserSize;
}
- uptr NewMapEnd = RoundUpTo(UserEnd, PageSize) + PageSize;
+ const uptr NewMapEnd = RoundUpTo(UserEnd, PageSize) + PageSize;
if (NewMapEnd != MapEnd) {
AddressRange.Unmap(NewMapEnd, MapEnd - NewMapEnd);
MapEnd = NewMapEnd;
}
MapSize = MapEnd - MapBeg;
}
- CHECK_LE(UserEnd, MapEnd - PageSize);
+ DCHECK_LE(UserEnd, MapEnd - PageSize);
// Actually mmap the memory, preserving the guard pages on either side
CHECK_EQ(MapBeg + PageSize,
AddressRange.Map(MapBeg + PageSize, MapSize - 2 * PageSize));
@@ -111,10 +111,10 @@
}
uptr GetActuallyAllocatedSize(void *Ptr) {
- ReservedAddressRange *StoredRange = getReservedAddressRange(Ptr);
+ const ReservedAddressRange *StoredRange = getReservedAddressRange(Ptr);
// Deduct PageSize as ReservedAddressRange size includes the trailing guard
// page.
- uptr MapEnd = reinterpret_cast<uptr>(StoredRange->base()) +
+ const uptr MapEnd = reinterpret_cast<uptr>(StoredRange->base()) +
StoredRange->size() - PageSizeCached;
return MapEnd - reinterpret_cast<uptr>(Ptr);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42696.132444.patch
Type: text/x-patch
Size: 2360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180201/11ccac41/attachment.bin>
More information about the llvm-commits
mailing list