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. --- modules/libjar/nsZipArchive.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 429de1011..24da13072 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -688,7 +688,9 @@ MOZ_WIN_MEM_TRY_BEGIN // Success means optimized jar layout from bug 559961 is in effect uint32_t readaheadLength = xtolong(startp); if (readaheadLength) { -#if defined(XP_UNIX) +#if defined(XP_SOLARIS) + posix_madvise(const_cast(startp), readaheadLength, POSIX_MADV_WILLNEED); +#elif defined(XP_UNIX) madvise(const_cast(startp), readaheadLength, MADV_WILLNEED); #elif defined(XP_WIN) if (aFd) { -- cgit v1.2.3 From 4f6639a1b35d4941f52eb4c8901adf45b35bc10d Mon Sep 17 00:00:00 2001 From: athenian200 Date: Wed, 2 Oct 2019 17:38:39 -0500 Subject: MoonchildProductions#1251 - Part 15: fdlibm should provide definition for u_int32_t and u_int64_t. https://bugzilla.mozilla.org/show_bug.cgi?id=1350355 u_int32_t is not an stdint.h type. Windows already requires this, Solaris needs it too. If someone has a nit with this approach, the alternatives include: 1. Just replacing every instance of u_int32_t with uint32_t. 2. Including for Solaris only, which does define this. 3. Changing the original ifdef to be WIN32 || XP_SOLARIS But it really doesn't matter how you solve this problem, all of the approaches are functionally equivalent, and this one has been used in Firefox since version 55. As far as I can tell, all it does is apply a fix that was being done for Windows already to any platform that needs it. --- .../fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch | 4 +++- modules/fdlibm/src/math_private.h | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'modules') diff --git a/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch b/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch index b8f238c74..c0e9814aa 100644 --- a/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch +++ b/modules/fdlibm/patches/12_define_u_int32_t_and_u_int64_t_on_windows.patch @@ -10,8 +10,10 @@ diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private * endianness at run time. */ -+#ifdef WIN32 ++#ifndef u_int32_t +#define u_int32_t uint32_t ++#endif ++#ifndef u_int64_t +#define u_int64_t uint64_t +#endif + diff --git a/modules/fdlibm/src/math_private.h b/modules/fdlibm/src/math_private.h index 6947cecc0..86597e75f 100644 --- a/modules/fdlibm/src/math_private.h +++ b/modules/fdlibm/src/math_private.h @@ -38,8 +38,10 @@ * endianness at run time. */ -#ifdef WIN32 +#ifndef u_int32_t #define u_int32_t uint32_t +#endif +#ifndef u_int64_t #define u_int64_t uint64_t #endif -- cgit v1.2.3 From 687a798e6dedacb8b42826debcd8e89baa69ce94 Mon Sep 17 00:00:00 2001 From: athenian200 Date: Sat, 19 Oct 2019 14:24:49 -0500 Subject: MoonchildProductions#1251 - Part 27: Fix ifdef style. This should do it for all the commits to files I changed, but while I'm in here I could probably go ahead and turn ALL the singular if defined statements into ifdef statements by using grep/find on the tree. On the other hand, perhaps we should do that as a separate issue so that this doesn't become a case of scope creep. --- modules/libjar/nsZipArchive.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp index 24da13072..841503ebf 100644 --- a/modules/libjar/nsZipArchive.cpp +++ b/modules/libjar/nsZipArchive.cpp @@ -688,7 +688,7 @@ MOZ_WIN_MEM_TRY_BEGIN // Success means optimized jar layout from bug 559961 is in effect uint32_t readaheadLength = xtolong(startp); if (readaheadLength) { -#if defined(XP_SOLARIS) +#ifdef XP_SOLARIS posix_madvise(const_cast(startp), readaheadLength, POSIX_MADV_WILLNEED); #elif defined(XP_UNIX) madvise(const_cast(startp), readaheadLength, MADV_WILLNEED); -- cgit v1.2.3