summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2022-08-26 09:49:52 +0200
committerMorten Sørvig <morten.sorvig@qt.io>2022-09-01 15:42:28 +0200
commitdf76a0585f2badb30aa90ccfb52fa9fa33a00784 (patch)
tree056592131e94ae15384c1b58f5005f6b167885ef /mkspecs
parent50b05e3e2ad969abf4b939d5db2253380e47d775 (diff)
wasm: set ALLOW_MEMORY_GROWTH for multi-threaded builds
Unify the settings for single-threaded and multi-threaded builds; Qt now always enables heap growth by default. This means we don't have to reserve a large (1GB) fixed memory size, but can instead set the smaller (50 MB) initial memory size, like the single-threaded build does. Enabling threads + memory growth can potentially cause a performance regression when accessing heap memory from JavaScript (https://github.com/WebAssembly/design/issues/1271). We leave it for the application to decide if this applies, and if the switch to fixed memory should be made. Change-Id: I96988b072506456685086e55aca4007a146bd70f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io> Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/wasm/wasm.prf19
1 files changed, 3 insertions, 16 deletions
diff --git a/mkspecs/features/wasm/wasm.prf b/mkspecs/features/wasm/wasm.prf
index 5e6501ed99..5b7dbaf493 100644
--- a/mkspecs/features/wasm/wasm.prf
+++ b/mkspecs/features/wasm/wasm.prf
@@ -29,29 +29,16 @@ exists($$QMAKE_QT_CONFIG) {
message("Setting PTHREAD_POOL_SIZE to" $$POOL_SIZE)
EMCC_LFLAGS += -s PTHREAD_POOL_SIZE=$$POOL_SIZE
- } else {
- EMCC_LFLAGS += -s ALLOW_MEMORY_GROWTH=1
}
+ # Set memory options
+ EMCC_LFLAGS += -sALLOW_MEMORY_GROWTH
isEmpty(QT_WASM_INITIAL_MEMORY) {
- # Hardcode wasm memory size.
-
- qtConfig(thread) {
- # Pthreads and ALLOW_MEMORY_GROWTH can cause javascript wasm memory access to
- # be slow. Instead, we specify the memory size
- # at build time. Further, browsers limit the maximum initial memory size to 1GB.
- # https://github.com/WebAssembly/design/issues/1271
- INITIAL_MEMORY = 1GB
- } else {
- INITIAL_MEMORY = 50MB # emscripten default is 16MB, we need slightly more
- }
+ INITIAL_MEMORY = 50MB # emscripten default is 16MB, we need slightly more
} else {
- # QT_WASM_INITIAL_MEMORY must be a multiple of 64KB (i.e. 65536)
INITIAL_MEMORY = $$QT_WASM_INITIAL_MEMORY
- message("Setting INITIAL_MEMORY to" $$INITIAL_MEMORY)
}
EMCC_LFLAGS += -s INITIAL_MEMORY=$$INITIAL_MEMORY
- message("Setting INITIAL_MEMORY to" $$INITIAL_MEMORY)
qtConfig(sse2) {
QMAKE_CFLAGS += -O2 -msimd128 -msse -msse2