File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -350,8 +350,6 @@ void multiThreadedPageInBackground(DeferredFiles &deferred) {
350
350
const StringRef &buff = deferredFile.buffer .getBuffer ();
351
351
if (buff.size () > largeArchive)
352
352
return ;
353
- if (((uintptr_t )buff.data () & (pageSize - 1 )))
354
- return ; // Not mmap()'d (not page aligned).
355
353
356
354
totalBytes += buff.size ();
357
355
numDeferedFilesAdvised += 1 ;
@@ -363,7 +361,9 @@ void multiThreadedPageInBackground(DeferredFiles &deferred) {
363
361
LLVM_ATTRIBUTE_UNUSED volatile char t = *page;
364
362
#else
365
363
#define DEBUG_TYPE " lld-madvise"
366
- if (madvise ((void *)buff.data (), buff.size (), MADV_WILLNEED) < 0 )
364
+ auto aligned = llvm::alignAddr (buff.data (), Align (pageSize));
365
+ auto rounded = llvm::alignTo (buff.size (), Align (pageSize));
366
+ if (madvise ((void *)aligned, rounded, MADV_WILLNEED) < 0 )
367
367
LLVM_DEBUG (llvm::dbgs () << " madvise() error: " << strerror (errno));
368
368
#undef DEBUG_TYPE
369
369
#endif
Original file line number Diff line number Diff line change @@ -217,7 +217,8 @@ std::optional<MemoryBufferRef> macho::readFile(StringRef path) {
217
217
if (entry != cachedReads.end ())
218
218
return entry->second ;
219
219
220
- ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr = MemoryBuffer::getFile (path);
220
+ ErrorOr<std::unique_ptr<MemoryBuffer>> mbOrErr =
221
+ MemoryBuffer::getFile (path, false , /* RequiresNullTerminator*/ false );
221
222
if (std::error_code ec = mbOrErr.getError ()) {
222
223
error (" cannot open " + path + " : " + ec.message ());
223
224
return std::nullopt;
Original file line number Diff line number Diff line change @@ -584,7 +584,8 @@ Expected<StringRef> Archive::Child::getBuffer() const {
584
584
if (!FullNameOrErr)
585
585
return FullNameOrErr.takeError ();
586
586
const std::string &FullName = *FullNameOrErr;
587
- ErrorOr<std::unique_ptr<MemoryBuffer>> Buf = MemoryBuffer::getFile (FullName);
587
+ ErrorOr<std::unique_ptr<MemoryBuffer>> Buf =
588
+ MemoryBuffer::getFile (FullName, false , /* RequiresNullTerminator*/ false );
588
589
if (std::error_code EC = Buf.getError ())
589
590
return errorCodeToError (EC);
590
591
Parent->ThinBuffers .push_back (std::move (*Buf));
You can’t perform that action at this time.
0 commit comments