From 3647f42c27761472e4ee204bade964e8ffad4679 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Tue, 1 Oct 2019 21:36:29 -0500 Subject: MoonchildProductions#1251 - Part 7: All the posix_m* memory-related stuff, gathered together. https://bugzilla.mozilla.org/show_bug.cgi?id=1158445 https://bugzilla.mozilla.org/show_bug.cgi?id=963983 https://bugzilla.mozilla.org/show_bug.cgi?id=1542758 Solaris madvise and malign don't perfectly map to their POSIX counterparts, and some Linux versions (especially Android) don't define the POSIX counterparts at all, so options are limited. Ideally posix_madvise and posix_malign should be the safer and more portable options for all platforms. --- js/src/gc/Memory.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'js/src/gc/Memory.cpp') diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp index 268e1e489..5cf0cd2f7 100644 --- a/js/src/gc/Memory.cpp +++ b/js/src/gc/Memory.cpp @@ -678,7 +678,11 @@ MarkPagesUnused(void* p, size_t size) return false; MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0); - int result = madvise(p, size, MADV_DONTNEED); +#if defined(XP_SOLARIS) + int result = posix_madvise(p, size, POSIX_MADV_DONTNEED); +#else + int result = madvise(p, size, MADV_DONTNEED); +#endif return result != -1; } -- cgit v1.2.3