]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-120507: Double WASI memory (#120648)
authorVictor Stinner <vstinner@python.org>
Mon, 17 Jun 2024 16:08:05 +0000 (18:08 +0200)
committerGitHub <noreply@github.com>
Mon, 17 Jun 2024 16:08:05 +0000 (16:08 +0000)
Use 16 MiB stack with 40 MiB memory limit, instead of 8 MiB stack
with 20 MiB memory limit.

Tools/wasm/wasi.py
Tools/wasm/wasm_build.py
configure
configure.ac

index efb005e53ab989b488f68a40573ec413a235327a..f69299fd66280673372de9d71858b9306f6e01b6 100644 (file)
@@ -280,9 +280,8 @@ def main():
     default_host_runner = (f"{shutil.which('wasmtime')} run "
                         # Make sure the stack size will work for a pydebug
                         # build.
-                        # The 8388608 value comes from `ulimit -s` under Linux
-                        # which equates to 8291 KiB.
-                        "--wasm max-wasm-stack=8388608 "
+                        # Use 16 MiB stack.
+                        "--wasm max-wasm-stack=16777216 "
                         # Use WASI 0.2 primitives.
                         "--wasi preview2 "
                         # Enable thread support; causes use of preview1.
index 47a0abb8b5feef23e8420d7bbe1d80fb73da1fe4..bcb80212362b71fa465b1f46466e25f9fb969d77 100755 (executable)
@@ -329,7 +329,7 @@ WASI = Platform(
         # workaround for https://github.com/python/cpython/issues/95952
         "HOSTRUNNER": (
             "wasmtime run "
-            "--wasm max-wasm-stack=8388608 "
+            "--wasm max-wasm-stack=16777216 "
             "--wasi preview2 "
             "--dir {srcdir}::/ "
             "--env PYTHONPATH=/{relbuilddir}/build/lib.wasi-wasm32-{version}:/Lib"
index 4174633b51c30a5272305e420e66711bb9dd0aec..003f68afae2cab0678d9f3e689e50b9c7504477b 100755 (executable)
--- a/configure
+++ b/configure
@@ -7758,7 +7758,7 @@ then :
 fi
      ;; #(
               WASI/*) :
-    HOSTRUNNER='wasmtime run --wasm max-wasm-stack=8388608 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/' ;; #(
+    HOSTRUNNER='wasmtime run --wasm max-wasm-stack=16777216 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/' ;; #(
   *) :
     HOSTRUNNER=''
    ;;
@@ -9560,7 +9560,7 @@ then :
 
 fi
 
-                as_fn_append LDFLAGS_NODIST " -z stack-size=8388608 -Wl,--stack-first -Wl,--initial-memory=20971520"
+                as_fn_append LDFLAGS_NODIST " -z stack-size=16777216 -Wl,--stack-first -Wl,--initial-memory=41943040"
 
  ;; #(
   *) :
index d34ade389cf40cd9c643ade4ce7f4e62e7220eb2..f9612b3275d3f0bffa5864c0e602faea73eca17a 100644 (file)
@@ -1609,7 +1609,7 @@ then
     dnl TODO: support other WASI runtimes
     dnl wasmtime starts the proces with "/" as CWD. For OOT builds add the
     dnl directory containing _sysconfigdata to PYTHONPATH.
-    [WASI/*], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=8388608 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'],
+    [WASI/*], [HOSTRUNNER='wasmtime run --wasm max-wasm-stack=16777216 --wasi preview2 --env PYTHONPATH=/$(shell realpath --relative-to $(abs_srcdir) $(abs_builddir))/$(shell cat pybuilddir.txt):/Lib --dir $(srcdir)::/'],
     [HOSTRUNNER='']
   )
 fi
@@ -2403,10 +2403,10 @@ AS_CASE([$ac_sys_system],
       AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--max-memory=10485760"])
     ])
 
-    dnl gh-117645: Set the memory size to 20 MiB, the stack size to 8 MiB,
+    dnl gh-117645: Set the memory size to 40 MiB, the stack size to 16 MiB,
     dnl and move the stack first.
     dnl https://github.com/WebAssembly/wasi-libc/issues/233
-    AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=8388608 -Wl,--stack-first -Wl,--initial-memory=20971520"])
+    AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=16777216 -Wl,--stack-first -Wl,--initial-memory=41943040"])
   ]
 )