about summary refs log tree commit diff
path: root/absl/base/internal/low_level_alloc.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-09-12T18·03-0700
committerGennadiy Civil <misterg@google.com>2018-09-13T17·24-0400
commit8ff1374008259719b54a8cb128ef951c02da164c (patch)
treed6768eeb981f8e3a14668c329336faee20291346 /absl/base/internal/low_level_alloc.cc
parent02451914b9ad5320f81f56a89f3eef1f8683227c (diff)
Export of internal Abseil changes.
--
821196cfb2a3b943ffdc4c9e75daec92d7ffb28b by Abseil Team <absl-team@google.com>:

Performance improvements

PiperOrigin-RevId: 212668992

--
704858e2e767016bad27d53eec01d9d48e546b23 by Abseil Team <absl-team@google.com>:

Low-level Portability enchancements for Abseil Mutex on WebAssembly.

Emscripten Pthreads do not use signals, so remove use of pthread_sigmask or
other async-signal-safe related handling code.

PiperOrigin-RevId: 212527958

--
be3e38cb4d493b755132d20c8c2d1a51e45d5449 by Jon Cohen <cohenjon@google.com>:

Internal change.

PiperOrigin-RevId: 212523797
GitOrigin-RevId: 821196cfb2a3b943ffdc4c9e75daec92d7ffb28b
Change-Id: I5694e23e4e09364a15dd6fc4e2e3f15e38835687
Diffstat (limited to 'absl/base/internal/low_level_alloc.cc')
-rw-r--r--absl/base/internal/low_level_alloc.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/absl/base/internal/low_level_alloc.cc b/absl/base/internal/low_level_alloc.cc
index 0a6f30705345..6e636a02c5d1 100644
--- a/absl/base/internal/low_level_alloc.cc
+++ b/absl/base/internal/low_level_alloc.cc
@@ -401,16 +401,20 @@ bool LowLevelAlloc::DeleteArena(Arena *arena) {
     ABSL_RAW_CHECK(munmap_result != 0,
                    "LowLevelAlloc::DeleteArena: VitualFree failed");
 #else
+#ifndef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
     if ((arena->flags & LowLevelAlloc::kAsyncSignalSafe) == 0) {
       munmap_result = munmap(region, size);
     } else {
       munmap_result = base_internal::DirectMunmap(region, size);
     }
+#else
+    munmap_result = munmap(region, size);
+#endif  // ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
     if (munmap_result != 0) {
       ABSL_RAW_LOG(FATAL, "LowLevelAlloc::DeleteArena: munmap failed: %d",
                    errno);
     }
-#endif
+#endif  // _WIN32
   }
   section.Leave();
   arena->~Arena();
@@ -545,6 +549,7 @@ static void *DoAllocWithArena(size_t request, LowLevelAlloc::Arena *arena) {
                                MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
       ABSL_RAW_CHECK(new_pages != nullptr, "VirtualAlloc failed");
 #else
+#ifndef ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
       if ((arena->flags & LowLevelAlloc::kAsyncSignalSafe) != 0) {
         new_pages = base_internal::DirectMmap(nullptr, new_pages_size,
             PROT_WRITE|PROT_READ, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
@@ -552,10 +557,15 @@ static void *DoAllocWithArena(size_t request, LowLevelAlloc::Arena *arena) {
         new_pages = mmap(nullptr, new_pages_size, PROT_WRITE | PROT_READ,
                          MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
       }
+#else
+      new_pages = mmap(nullptr, new_pages_size, PROT_WRITE | PROT_READ,
+                       MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+#endif  // ABSL_LOW_LEVEL_ALLOC_ASYNC_SIGNAL_SAFE_MISSING
       if (new_pages == MAP_FAILED) {
         ABSL_RAW_LOG(FATAL, "mmap error: %d", errno);
       }
-#endif
+
+#endif  // _WIN32
       arena->mu.Lock();
       s = reinterpret_cast<AllocList *>(new_pages);
       s->header.size = new_pages_size;