diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2019-07-11 19:55:53 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2019-07-11 19:55:53 +0000 |
commit | 5ec1a38f6ce0aeca2fbd4a79cac4ef10aef061a5 (patch) | |
tree | 2de88d363b0d3fe4f20164b0d84e0db6ac64e4bc /lib/scudo/standalone/primary32.h | |
parent | 449e644b30b34b5ec2bd5d264663268d8bb5971a (diff) | |
download | compiler-rt-5ec1a38f6ce0aeca2fbd4a79cac4ef10aef061a5.tar.gz |
[scudo][standalone] NFC corrections
Summary:
A few corrections:
- rename `TransferBatch::MaxCached` to `getMaxCached` to conform with
the style guide;
- move `getBlockBegin` from `Chunk::` to `Allocator::`: I believe it
was a fallacy to have this be a `Chunk` method, as chunks'
relationship to backend blocks are up to the frontend allocator. It
makes more sense now, particularly with regard to the offset. Update
the associated chunk test as the method isn't available there
anymore;
- add a forgotten `\n` to a log string;
- for `releaseToOs`, instead of starting at `1`, start at `0` and
`continue` on `BatchClassId`: in the end it's identical but doesn't
assume a particular class id for batches;
- change a `CHECK` to a `reportOutOfMemory`: it's a clearer message
Reviewers: hctim, morehouse, eugenis, vitalybuka
Reviewed By: hctim
Subscribers: delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D64570
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@365816 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo/standalone/primary32.h')
-rw-r--r-- | lib/scudo/standalone/primary32.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/scudo/standalone/primary32.h b/lib/scudo/standalone/primary32.h index eade88a45..2b2fa8b3d 100644 --- a/lib/scudo/standalone/primary32.h +++ b/lib/scudo/standalone/primary32.h @@ -162,7 +162,9 @@ public: } void releaseToOS() { - for (uptr I = 1; I < NumClasses; I++) { + for (uptr I = 0; I < NumClasses; I++) { + if (I == SizeClassMap::BatchClassId) + continue; SizeClassInfo *Sci = getSizeClassInfo(I); ScopedLock L(Sci->Mutex); releaseToOSMaybe(Sci, I, /*Force=*/true); @@ -291,7 +293,7 @@ private: return nullptr; C->getStats().add(StatMapped, RegionSize); const uptr Size = getSizeByClassId(ClassId); - const u32 MaxCount = TransferBatch::MaxCached(Size); + const u32 MaxCount = TransferBatch::getMaxCached(Size); DCHECK_GT(MaxCount, 0); const uptr NumberOfBlocks = RegionSize / Size; DCHECK_GT(NumberOfBlocks, 0); |