Changeset 258857 in webkit
- Timestamp:
- Mar 23, 2020 10:34:43 AM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r258825 r258857 1 2020-03-23 Michael Catanzaro <mcatanzaro@gnome.org> 2 3 REGRESSION(r249808): [GTK] Crash in JSC Config::permanentlyFreeze() on architecture ppc64el 4 https://bugs.webkit.org/show_bug.cgi?id=209236 5 6 Reviewed by Mark Lam. 7 8 * heap/MarkedBlock.h: Use new CeilingOnPageSize. 9 * runtime/JSCConfig.cpp: 10 (JSC::Config::permanentlyFreeze): Use pageSize instead of vmPageSize. 11 * runtime/JSCConfig.h: Use new CeilingOnPageSize. 12 1 13 2020-03-22 Yusuke Suzuki <ysuzuki@apple.com> 2 14 -
trunk/Source/JavaScriptCore/heap/MarkedBlock.h
r254087 r258857 27 27 #include "IterationStatus.h" 28 28 #include "WeakSet.h" 29 #include <algorithm> 29 30 #include <wtf/Atomics.h> 30 31 #include <wtf/Bitmap.h> 32 #include <wtf/CountingLock.h> 31 33 #include <wtf/HashFunctions.h> 32 #include <wtf/ CountingLock.h>34 #include <wtf/PageBlock.h> 33 35 #include <wtf/StdLibExtras.h> 34 36 … … 71 73 72 74 // Block size must be at least as large as the system page size. 73 #if CPU(PPC64) || CPU(PPC64LE) || CPU(PPC) || CPU(UNKNOWN) 74 static constexpr size_t blockSize = 64 * KB; 75 #else 76 static constexpr size_t blockSize = 16 * KB; 77 #endif 75 static constexpr size_t blockSize = std::max(16 * KB, CeilingOnPageSize); 78 76 79 77 static constexpr size_t blockMask = ~(blockSize - 1); // blockSize must be a power of two. -
trunk/Source/JavaScriptCore/runtime/JSCConfig.cpp
r258460 r258857 54 54 void Config::permanentlyFreeze() 55 55 { 56 #if PLATFORM(COCOA) 57 RELEASE_ASSERT(roundUpToMultipleOf(vmPageSize(), ConfigSizeToProtect) == ConfigSizeToProtect); 58 #endif 56 RELEASE_ASSERT(roundUpToMultipleOf(pageSize(), ConfigSizeToProtect) == ConfigSizeToProtect); 59 57 60 58 if (!g_jscConfig.isPermanentlyFrozen) -
trunk/Source/JavaScriptCore/runtime/JSCConfig.h
r258463 r258857 27 27 28 28 #include "OptionsList.h" 29 #include <wtf/PageBlock.h> 29 30 #include <wtf/StdLibExtras.h> 30 31 … … 35 36 class VM; 36 37 37 #if !OS(WINDOWS) 38 constexpr size_t ConfigSizeToProtect = 16 * KB; 39 #else 40 constexpr size_t ConfigSizeToProtect = 4 * KB; 41 #endif 38 constexpr size_t ConfigSizeToProtect = CeilingOnPageSize; 42 39 43 40 #if ENABLE(SEPARATED_WX_HEAP) -
trunk/Source/WTF/ChangeLog
r258841 r258857 1 2020-03-23 Michael Catanzaro <mcatanzaro@gnome.org> 2 3 REGRESSION(r249808): [GTK] Crash in JSC Config::permanentlyFreeze() on architecture ppc64el 4 https://bugs.webkit.org/show_bug.cgi?id=209236 5 6 Reviewed by Mark Lam. 7 8 Add new CeilingOnPageSize constants, for use in JSC, in order to centralize our compile-time 9 page size guessing into one place. Improve the implementation of pageSize() to 10 RELEASE_ASSERT() when CeilingOnPageSize is wrong, so we can detect and fix it if so. (It 11 will be even easier to detect if we change RELEASE_ASSERT_WITH_MESSAGE() to actually print 12 its message in release builds.) Change pageSize() to use sysconf(_SC_PAGESIZE), which is 13 specified by POSIX, instead of getpagesize(), which is nonstandard. 14 15 * wtf/PageBlock.cpp: 16 (WTF::systemPageSize): 17 (WTF::pageSize): 18 * wtf/PageBlock.h: 19 1 20 2020-03-23 Jacob Uphoff <jacob_uphoff@apple.com> 2 21 -
trunk/Source/WTF/wtf/PageBlock.cpp
r237099 r258857 45 45 inline size_t systemPageSize() 46 46 { 47 return getpagesize();47 return sysconf(_SC_PAGESIZE); 48 48 } 49 49 … … 63 63 size_t pageSize() 64 64 { 65 if (!s_pageSize) 65 if (!s_pageSize) { 66 66 s_pageSize = systemPageSize(); 67 ASSERT(isPowerOfTwo(s_pageSize)); 67 RELEASE_ASSERT(isPowerOfTwo(s_pageSize)); 68 RELEASE_ASSERT_WITH_MESSAGE(s_pageSize <= CeilingOnPageSize, "CeilingOnPageSize is too low, raise it in PageBlock.h!"); 69 } 68 70 return s_pageSize; 69 71 } -
trunk/Source/WTF/wtf/PageBlock.h
r248546 r258857 26 26 #pragma once 27 27 28 #include <wtf/StdLibExtras.h> 29 28 30 namespace WTF { 31 32 // We attempt to guess a value that is *AT LEAST* as large as the system's actual page size. 33 // This is impossible to do correctly at build time, but JSC really needs it at build time, so 34 // we have a RELEASE_ASSERT() inside WTF::pageSize to make sure it is set properly at runtime. 35 // All of these values are going to be incorrect on systems configured to use larger than normal 36 // page size, so on such systems it is expected that WebKit will crash until this value is changed 37 // and recompiled. Sorry. 38 // 39 // macOS x86_64 uses 4 KiB, but Apple's aarch64 systems use 16 KiB. Use 16 KiB on all Apple systems 40 // for consistency. 41 // 42 // Most Linux and Windows systems use a page size of 4 KiB. 43 // 44 // On Linux, Power systems normally use 64 KiB pages. 45 // 46 // aarch64 systems seem to be all over the place. Most Linux distros use 4 KiB, but RHEL uses 47 // 64 KiB. (Apple uses 16 KiB.) 48 // 49 // Use 64 KiB for any unknown CPUs to be conservative. 50 #if OS(DARWIN) 51 constexpr size_t CeilingOnPageSize = 16 * KB; 52 #elif OS(WINDOWS) || CPU(MIPS) || CPU(X86) || CPU(X86_64) || CPU(ARM) 53 constexpr size_t CeilingOnPageSize = 4 * KB; 54 #elif CPU(UNKNOWN) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(ARM64) 55 constexpr size_t CeilingOnPageSize = 64 * KB; 56 #else 57 #error Must set CeilingOnPageSize in PageBlock.h when adding a new CPU architecture! 58 #endif 29 59 30 60 WTF_EXPORT_PRIVATE size_t pageSize(); … … 81 111 } // namespace WTF 82 112 113 using WTF::CeilingOnPageSize; 83 114 using WTF::pageSize; 84 115 using WTF::isPageAligned;
Note: See TracChangeset
for help on using the changeset viewer.