From 9df6811626d11ecb6b0cb15cb3a4be6d7ad479a1 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 28 May 2025 16:26:47 +0200 Subject: Revert memory64 and improve frontend for web version --- build | 17 ++++++++++++----- web/adapter.cpp | 3 ++- web/http/index.html | 9 ++++++--- web/http/nissyapp.mjs | 26 +++++++++++++++++++++++--- web/worker.mjs | 16 +++++++++++++++- 5 files changed, 58 insertions(+), 13 deletions(-) diff --git a/build b/build index da71227..9d3c1e0 100755 --- a/build +++ b/build @@ -126,13 +126,20 @@ DFLAGS="-DDEBUG -g3 $(parsesanitize "$SANITIZE")" MFLAGS="-DTHREADS=$THREADS -D$ARCH" CPPFLAGS="-std=c++20 -pthread" +# TODO: +# MEMORY64 is supported on Firefox (from version 134) and Chrome (from 133), +# but not on Safari (nor on e.g. Firefox 128 ESR, current default on Debian). +# See also https://webassembly.org/features +# When it becomes widely available, we can support it by adding -sMEMORY64 +# to the WASMCFLAGS, WASMCPPFLAGS and WASMLINKFLAGS variables below, and +# -sMAXIMUM_MEMORY=10737418240 to WASMLINKFLAGS. This way we can enable +# solvers larger than h48h6k2 in the web version. + # Build flags for emscripten (WASM target) -WASMCFLAGS="-std=c11 -fPIC -D_POSIX_C_SOURCE=199309L -pthread \ - -sMEMORY64 -sMAXIMUM_MEMORY=10737418240 -sASSERTIONS" -WASMCPPFLAGS="-std=c++20 -pthread -sMEMORY64 -sMAXIMUM_MEMORY=10737418240 \ - -sASSERTIONS" +WASMCFLAGS="-std=c11 -fPIC -D_POSIX_C_SOURCE=199309L -pthread" +WASMCPPFLAGS="-std=c++20 -pthread" WASMMFLAGS="-DTHREADS=$THREADS -DWASMSIMD" -WASMLINKFLAGS="--no-entry -sEXPORT_NAME='Nissy' -sMODULARIZE -sMEMORY64 \ +WASMLINKFLAGS="--no-entry -sEXPORT_NAME='Nissy' -sMODULARIZE -sALLOW_MEMORY_GROWTH -sSTACK_SIZE=5MB -sPTHREAD_POOL_SIZE=$THREADS \ -sFETCH -sASYNCIFY -sLINKABLE -sEXPORT_ALL" diff --git a/web/adapter.cpp b/web/adapter.cpp index 676390c..31d00fe 100644 --- a/web/adapter.cpp +++ b/web/adapter.cpp @@ -23,7 +23,8 @@ const std::set available_solvers "h48h1k2", "h48h2k2", "h48h3k2", - "h48h7k2", + "h48h4k2", + "h48h5k2", }; std::map loaded_solvers; diff --git a/web/http/index.html b/web/http/index.html index 47ccc0d..04ddf4c 100644 --- a/web/http/index.html +++ b/web/http/index.html @@ -9,9 +9,12 @@