webkit2gtk: enable WPE renderer, use large thread stacks on musl

This commit is contained in:
q66 2021-04-21 00:26:30 +02:00
parent 9b29bd5522
commit 2e369c38c6
2 changed files with 59 additions and 59 deletions

View file

@ -1,11 +1,7 @@
Source: @q66, @pullmoll
Original upstream: Alpine Linux
Reason: fixing machine context access for musl libc; reduce stack/heap usage for jsc; fix some overly restrictive __GLIBC__ checks
Source: https://github.com/WebKit/WebKit/commit/6884d13 (tweaked values)
Updated for latest webkit2gtk.
-diff --git Source/JavaScriptCore/runtime/MachineContext.h Source/JavaScriptCore/runtime/MachineContext.h
index ead9cdf..09dc28a 100644
diff --git Source/JavaScriptCore/runtime/MachineContext.h Source/JavaScriptCore/runtime/MachineContext.h
index ead9cdf..86b36ca 100644
--- Source/JavaScriptCore/runtime/MachineContext.h
+++ Source/JavaScriptCore/runtime/MachineContext.h
@@ -196,7 +196,7 @@ static inline void*& stackPointerImpl(mcontext_t& machineContext)
@ -13,7 +9,7 @@ index ead9cdf..09dc28a 100644
#endif
-#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
+#elif OS(FUCHSIA) || defined(__linux__)
+#elif OS(FUCHSIA) || OS(LINUX)
#if CPU(X86)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[REG_ESP]);
@ -22,7 +18,7 @@ index ead9cdf..09dc28a 100644
#endif
-#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
+#elif OS(FUCHSIA) || defined(__linux__)
+#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
@ -31,7 +27,7 @@ index ead9cdf..09dc28a 100644
#endif
-#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
+#elif OS(FUCHSIA) || defined(__linux__)
+#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
@ -40,7 +36,7 @@ index ead9cdf..09dc28a 100644
#endif
-#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
+#elif OS(FUCHSIA) || defined(__linux__)
+#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
@ -49,32 +45,34 @@ index ead9cdf..09dc28a 100644
#endif
-#elif OS(FUCHSIA) || defined(__GLIBC__) || defined(__BIONIC__)
+#elif OS(FUCHSIA) || defined(__linux__)
+#elif OS(FUCHSIA) || OS(LINUX)
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
diff --git Source/JavaScriptCore/runtime/OptionsList.h Source/JavaScriptCore/runtime/OptionsList.h
index bc1cedb..f161f1c 100644
index bc1cedb..f4a86a5 100644
--- Source/JavaScriptCore/runtime/OptionsList.h
+++ Source/JavaScriptCore/runtime/OptionsList.h
@@ -39,6 +39,16 @@ namespace JSC {
@@ -71,6 +71,18 @@ JS_EXPORT_PRIVATE bool canUseJITCage();
// On instantiation of the first VM instance, the Options will be write protected
// and cannot be modified thereafter.
JS_EXPORT_PRIVATE bool canUseJITCage();
+#if defined(__GLIBC__)
+#if OS(LINUX) && !defined(__BIONIC__) && !defined(__GLIBC__)
+// non-glibc/non-android options on linux ( musl )
+constexpr unsigned jscMaxPerThreadStack = 2 * MB;
+constexpr unsigned jscSoftReservedZoneSize = 64 * KB;
+constexpr unsigned jscReservedZoneSize = 32 * KB;
+#else
+// default
+constexpr unsigned jscMaxPerThreadStack = 5 * MB;
+constexpr unsigned jscSoftReservedZoneSize = 128 * KB;
+constexpr unsigned jscReservedZoneSize = 64 * KB;
+#else
+constexpr unsigned jscMaxPerThreadStack = 80 * KB;
+constexpr unsigned jscSoftReservedZoneSize = 32 * KB;
+constexpr unsigned jscReservedZoneSize = 16 * KB;
+#endif
+
// How do JSC VM options work?
// ===========================
// The FOR_EACH_JSC_OPTION() macro below defines a list of all JSC options in use,
@@ -86,9 +96,9 @@ JS_EXPORT_PRIVATE bool canUseJITCage();
#define FOR_EACH_JSC_OPTION(v) \
v(Bool, useKernTCSM, defaultTCSMValue(), Normal, "Note: this needs to go before other options since they depend on this value.") \
v(Bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \
@@ -86,9 +98,9 @@ JS_EXPORT_PRIVATE bool canUseJITCage();
\
v(Bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
\
@ -87,25 +85,29 @@ index bc1cedb..f161f1c 100644
\
v(Bool, crashOnDisallowedVMEntry, ASSERT_ENABLED, Normal, "Forces a crash if we attempt to enter the VM when disallowed") \
v(Bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
diff --git Source/WebCore/xml/XPathGrammar.cpp Source/WebCore/xml/XPathGrammar.cpp
index 0875a5e..98d5153 100644
--- Source/WebCore/xml/XPathGrammar.cpp
+++ Source/WebCore/xml/XPathGrammar.cpp
@@ -966,7 +966,7 @@ int yydebug;
#if YYERROR_VERBOSE
diff --git Source/WTF/wtf/PlatformHave.h Source/WTF/wtf/PlatformHave.h
index 41afbb4..ab5263c 100644
--- Source/WTF/wtf/PlatformHave.h
+++ Source/WTF/wtf/PlatformHave.h
@@ -206,7 +206,7 @@
#define HAVE_HOSTED_CORE_ANIMATION 1
#endif
# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
+# if defined __linux__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
@@ -989,7 +989,7 @@ yystrlen (yystr)
# endif
-#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || defined(__GLIBC__) || defined(__BIONIC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
+#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
#define HAVE_MACHINE_CONTEXT 1
#endif
# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
diff --git Source/WTF/wtf/Threading.cpp Source/WTF/wtf/Threading.cpp
index 99d09c0..723a8f4 100644
--- Source/WTF/wtf/Threading.cpp
+++ Source/WTF/wtf/Threading.cpp
@@ -52,6 +52,8 @@ static Optional<size_t> stackSize(ThreadType threadType)
#elif OS(DARWIN) && ASAN_ENABLED
if (threadType == ThreadType::Compiler)
return 1 * MB; // ASan needs more stack space (especially on Debug builds).
+#elif OS(LINUX) && !defined(__BIONIC__) && !defined(__GLIBC__) // MUSL default thread stack size.
+ return 2 * MB;
#else
UNUSED_PARAM(threadType);
#endif

View file

@ -2,23 +2,15 @@
# ping q66 before touching this
pkgname=webkit2gtk
version=2.32.0
revision=1
revision=2
wrksrc="webkitgtk-${version}"
build_style=cmake
build_helper="gir"
configure_args="-DPORT=GTK -DUSE_LD_GOLD=OFF
-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_CXX_FLAGS_DEBUG=-DNDEBUG
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=-DNDEBUG
-DCMAKE_CXX_FLAGS_NONE=-DNDEBUG
-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_C_FLAGS_DEBUG=-DNDEBUG
-DCMAKE_C_FLAGS_RELWITHDEBINFO=-DNDEBUG
-DCMAKE_C_FLAGS_NONE=-DNDEBUG
-DCMAKE_LINKER=${XBPS_CROSS_TRIPLET}-gcc
-DRUBY_VERSION=2.7
-DUSE_SYSTEMD=OFF
-DENABLE_GTKDOC=OFF -DUSE_GSTREAMER_GL=OFF -DUSE_WPE_RENDERER=OFF
-DUSE_SYSTEMD=OFF -DUSE_WOFF2=ON
-DENABLE_GTKDOC=OFF -DUSE_GSTREAMER_GL=OFF -DUSE_WPE_RENDERER=ON
-DENABLE_MINIBROWSER=$(vopt_if minibrowser ON OFF)
-DENABLE_JIT=$(vopt_if jit ON OFF)
-DENABLE_C_LOOP=$(vopt_if jit OFF ON)
@ -37,7 +29,8 @@ makedepends="at-spi2-core-devel libjpeg-turbo-devel libpng-devel
dbus-glib-devel libwebp-devel gtk+-devel gtk+3-devel libgudev-devel
libsecret-devel ruby-devel geoclue2-devel libnotify-devel hyphen-devel
woff2-devel freetype-devel libopenjpeg2-devel libatomic-devel
qt5-devel libmanette-devel $(vopt_if x11 libXt-devel)
qt5-devel libmanette-devel libwpe-devel wpebackend-fdo-devel
$(vopt_if x11 libXt-devel)
$(vopt_if wayland 'MesaLib-devel libxkbcommon-devel wayland-devel wayland-protocols')"
short_desc="GTK+3 port of the WebKit2 browser engine"
maintainer="q66 <daniel@octaforge.org>"
@ -54,8 +47,13 @@ desc_option_jit="JavaScript JIT (Only some architectures)"
desc_option_sampling_profiler="Sampling profiler support (JIT + glibc only)"
desc_option_minibrowser="Build the minibrowser"
# on musl this is not defined and webkit uses it, so define it
export CFLAGS="-D__WORDSIZE=${XBPS_TARGET_WORDSIZE}"
export CFLAGS="-DNDEBUG"
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
# this is not defined on musl and is occasionally used
export CFLAGS+=" -D__WORDSIZE=${XBPS_TARGET_WORDSIZE}"
fi
export CXXFLAGS="$CFLAGS"
# WebKitCCache.cmake set this variable