summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/MemoryTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Support] Renamed member 'Size' to 'AllocatedSize' in MemoryBlock and ↵Lang Hames2019-05-201-30/+30
| | | | | | | | | | | | | | | OwningMemoryBlock. Rename member 'Size' to 'AllocatedSize' in order to provide a hint that the allocated size may be different than the requested size. Comments are added to clarify this point. Updated the InMemoryBuffer in FileOutputBuffer.cpp to track the requested buffer size. Patch by Machiel van Hooren. Thanks Machiel! https://reviews.llvm.org/D61599 llvm-svn: 361195
* [Support] Add error handling to sys::Process::getPageSize().Lang Hames2019-05-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the return type of sys::Process::getPageSize to Expected<unsigned> to account for the fact that the underlying syscalls used to obtain the page size may fail (see below). For clients who use the page size as an optimization only this patch adds a new method, getPageSizeEstimate, which calls through to getPageSize but discards any error returned and substitues a "reasonable" page size estimate estimate instead. All existing LLVM clients are updated to call getPageSizeEstimate rather than getPageSize. On Unix, sys::Process::getPageSize is implemented in terms of getpagesize or sysconf, depending on which macros are set. The sysconf call is documented to return -1 on failure. On Darwin getpagesize is implemented in terms of sysconf and may also fail (though the manpage documentation does not mention this). These failures have been observed in practice when highly restrictive sandbox permissions have been applied. Without this patch, the result is that getPageSize returns -1, which wreaks havoc on any subsequent code that was assuming a sane page size value. <rdar://problem/41654857> Reviewers: dblaikie, echristo Subscribers: kristina, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59107 llvm-svn: 360221
* [Memory] Add basic support for large/huge memory pagesAlexandre Ganea2019-02-281-0/+16
| | | | | | | | | | | | | | | | | This patch introduces Memory::MF_HUGE_HINT which indicates that allocateMappedMemory() shall return a pointer to a large memory page. However the flag is a hint because we're not guaranteed in any way that we will get back a large memory page. There are several restrictions: - Large/huge memory pages aren't enabled by default on modern OSes (Windows 10 and Linux at least), and should be manually enabled/reserved. - Once enabled, it should be kept in mind that large pages are physical only, they can't be swapped. - Memory fragmentation can affect the availability of large pages, especially after running the OS for a long time and/or running along many other applications. Memory::allocateMappedMemory() will fallback to 4KB pages if it can't allocate 2MB large pages (if Memory::MF_HUGE_HINT is provided) Currently, Memory::MF_HUGE_HINT only works on Windows. The hint will be ignored on Linux, 4KB pages will always be returned. Differential Revision: https://reviews.llvm.org/D58718 llvm-svn: 355065
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* [unittest] Skip W+X MappedMemoryTests when MPROTECT is enabledMichal Gorny2018-11-201-0/+53
| | | | | | | | | | | Skip all MappedMemoryTest variants that rely on memory pages being mapped for MF_WRITE|MF_EXEC when MPROTECT is enabled on NetBSD. W^X protection causes all those mmap() calls to fail, causing the tests to fail. Differential Revision: https://reviews.llvm.org/D54080 llvm-svn: 347337
* Untabify.NAKAMURA Takumi2017-10-181-10/+10
| | | | llvm-svn: 316079
* Fixed warning: must specify at least one argument for '...' parameter.Galina Kistanova2017-06-041-1/+1
| | | | llvm-svn: 304677
* Remove dead code. NFC.Rafael Espindola2014-12-041-1/+1
| | | | | | This interface was added 2 years ago but users never developed. llvm-svn: 223368
* Remove the last uses of 'using std::error_code'Rafael Espindola2014-06-131-39/+39
| | | | | | This finishes the transition to std::error_code. llvm-svn: 210877
* Don't use 'using std::error_code' in include/llvm.Rafael Espindola2014-06-121-0/+1
| | | | | | This should make sure that most new uses use the std prefix. llvm-svn: 210835
* [C++11] Use 'nullptr'.Craig Topper2014-06-081-43/+50
| | | | llvm-svn: 210442
* Use error_code() instead of error_code::succes()Rafael Espindola2014-05-311-28/+28
| | | | | | | There is no std::error_code::success, so this removes much of the noise in transitioning to std::error_code. llvm-svn: 209952
* Go ahead and get rid of the old page size interface and convert all theChandler Carruth2012-12-311-1/+1
| | | | | | | users over to the new one. No sense maintaining this "compatibility" layer it seems. llvm-svn: 171331
* Do not run tests MappedMemoryTest.BasicWrite and MultipleWrite unless bothAkira Hatanaka2012-12-051-4/+6
| | | | | | MF_READ and MF_WRITE are set. llvm-svn: 169439
* Sort the #include lines for unittest/...Chandler Carruth2012-12-041-1/+0
| | | | llvm-svn: 169250
* Remove DOS line endings.Jakub Staszak2012-11-141-356/+356
| | | | llvm-svn: 167968
* This patch adds memory support functions which will later be used to ↵Andrew Kaylor2012-09-191-0/+356
implement section-specific protection handling in MCJIT. llvm-svn: 164249
OpenPOWER on IntegriCloud