diff options
author | Alp Toker <alp@nuanti.com> | 2014-05-19 16:13:28 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-05-19 16:13:28 +0000 |
commit | c9330138583fb186257146b26b3ca6685fa582f9 (patch) | |
tree | 8e59e4aded7b4d3918e480936246a7a64668286a /lib/Support | |
parent | b90ef82eb4f78d415c4bd2ebef85d76f2a8faff8 (diff) | |
download | llvm-c9330138583fb186257146b26b3ca6685fa582f9.tar.gz llvm-c9330138583fb186257146b26b3ca6685fa582f9.tar.bz2 llvm-c9330138583fb186257146b26b3ca6685fa582f9.tar.xz |
MemoryBuffer: Use GetNativeSystemInfo()
Removes old 4096 byte workaround. This functionality has been available since
Windows XP.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209137 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/MemoryBuffer.cpp | 9 | ||||
-rw-r--r-- | lib/Support/Windows/Process.inc | 14 |
2 files changed, 6 insertions, 17 deletions
diff --git a/lib/Support/MemoryBuffer.cpp b/lib/Support/MemoryBuffer.cpp index 9be05d6b7a..629d8855f3 100644 --- a/lib/Support/MemoryBuffer.cpp +++ b/lib/Support/MemoryBuffer.cpp @@ -310,15 +310,6 @@ static bool shouldUseMmap(int FD, if (End != FileSize) return false; -#if defined(_WIN32) || defined(__CYGWIN__) - // Don't peek the next page if file is multiple of *physical* pagesize(4k) - // but is not multiple of AllocationGranularity(64k), - // when a null terminator is required. - // FIXME: It's not good to hardcode 4096 here. dwPageSize shows 4096. - if ((FileSize & (4096 - 1)) == 0) - return false; -#endif - // Don't try to map files that are exactly a multiple of the system page size // if we need a null terminator. if ((FileSize & (PageSize -1)) == 0) diff --git a/lib/Support/Windows/Process.inc b/lib/Support/Windows/Process.inc index a87c9e88c7..c3df801dc0 100644 --- a/lib/Support/Windows/Process.inc +++ b/lib/Support/Windows/Process.inc @@ -82,16 +82,14 @@ TimeValue self_process::get_system_time() const { return getTimeValueFromFILETIME(KernelTime); } -// This function retrieves the page size using GetSystemInfo and is present -// solely so it can be called once to initialize the self_process member below. +// This function retrieves the page size using GetNativeSystemInfo() and is +// present solely so it can be called once to initialize the self_process member +// below. static unsigned getPageSize() { - // NOTE: A 32-bit application running under WOW64 is supposed to use - // GetNativeSystemInfo. However, this interface is not present prior - // to Windows XP so to use it requires dynamic linking. It is not clear - // how this affects the reported page size, if at all. One could argue - // that LLVM ought to run as 64-bits on a 64-bit system, anyway. + // GetNativeSystemInfo() provides the physical page size which may differ + // from GetSystemInfo() in 32-bit applications running under WOW64. SYSTEM_INFO info; - GetSystemInfo(&info); + GetNativeSystemInfo(&info); // FIXME: FileOffset in MapViewOfFile() should be aligned to not dwPageSize, // but dwAllocationGranularity. return static_cast<unsigned>(info.dwPageSize); |