[PATCH] D35200: Don't use mmap on Windows

Ivan Donchevskii via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 10 07:36:50 PDT 2017


yvvan created this revision.

Memory mapping does not make llvm faster (at least I don't see any difference).
It also allows llvm not to lock files which is sometimes quite important.


https://reviews.llvm.org/D35200

Files:
  lib/Support/MemoryBuffer.cpp


Index: lib/Support/MemoryBuffer.cpp
===================================================================
--- lib/Support/MemoryBuffer.cpp
+++ lib/Support/MemoryBuffer.cpp
@@ -284,6 +284,10 @@
                           bool RequiresNullTerminator,
                           int PageSize,
                           bool IsVolatile) {
+#ifdef _WIN32
+  // Do not use mmap on Windows in order to avoid file locking
+  return false;
+#endif
   // mmap may leave the buffer without null terminator if the file size changed
   // by the time the last page is mapped in, so avoid it if the file size is
   // likely to change.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35200.105848.patch
Type: text/x-patch
Size: 621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170710/ecfcf99e/attachment.bin>


More information about the cfe-commits mailing list