diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj
index 2088d661ad7943..15536e7ae22075 100644
--- a/src/mono/browser/browser.proj
+++ b/src/mono/browser/browser.proj
@@ -193,10 +193,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_EmccLinkFlags Include="-s TEXTDECODER=0"/>
+
<_EmccExportedLibraryFunction>"[@(EmccExportedLibraryFunction -> '%27%(Identity)%27', ',')]"
<_EmccExportedRuntimeMethods>"[@(EmccExportedRuntimeMethod -> '%27%(Identity)%27', ',')]"
<_EmccExportedFunctions>@(EmccExportedFunction -> '%(Identity)',',')
+ <_WasmOptConfigurationFlags>"@(WasmOptConfigurationFlags -> '%27%(Identity)%27', ',')"
33554432
5MB
@@ -209,6 +231,7 @@
<_EmccLinkFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-Wno-pthreads-mem-growth" />
<_EmccLinkFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-s PTHREAD_POOL_SIZE=0" />
<_EmccLinkFlags Condition="'$(WasmEnableThreads)' == 'true'" Include="-s PTHREAD_POOL_SIZE_STRICT=0" />
+ <_EmccLinkFlags Condition="'$(WasmEnableSIMD)' == 'true'" Include="-s BINARYEN_EXTRA_PASSES=$(_WasmOptConfigurationFlags)" />
<_EmccLinkFlags Include="-s ALLOW_MEMORY_GROWTH=1" />
<_EmccLinkFlags Include="-s ALLOW_TABLE_GROWTH=1" />
@@ -228,13 +251,6 @@
<_EmccLinkFlags Include="-Wno-limited-postlink-optimizations"/>
-
-
-
-
- <_EmccLinkFlags Include="-s TEXTDECODER=0"/>
-
-
<_EmccLinkFlags Include="--profiling-funcs" />
<_EmccFlags Include="@(_EmccCommonFlags)" />
@@ -307,13 +323,13 @@
-g -Os -DDEBUG=1
-Oz
+ $(CMakeConfigurationEmccFlags) -msimd128 -mbulk-memory
- $(CMakeConfigurationEmccFlags) -s ASSERTIONS=1
- -O2
+ $(CMakeConfigurationEmccFlags) --all-features -s ASSERTIONS=1
+ -O2 --all-features
$(CMakeConfigurationLinkFlags) -s EXPORT_ES6=1 -lexports.js
- $(CMakeConfigurationLinkFlags) -msimd128
$(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth
$(CMakeConfigurationLinkFlags) --emit-symbol-map
@@ -328,7 +344,7 @@
$(CMakeBuildRuntimeConfigureCmd) -DMONO_OBJ_INCLUDES="$(MonoObjDir.TrimEnd('\/').Replace('\','/'))"
$(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR="$(MonoArtifactsPath.TrimEnd('\/').Replace('\','/'))"
$(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/').Replace('\','/'))"
- $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTIONS="-msimd128" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd"
+ $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTION1="-msimd128" -DCONFIGURATION_COMPILE_OPTION2="-mbulk-memory" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd"
$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_INTERPSIMDTABLES_LIB="nosimd"
$(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0
$(CMakeBuildRuntimeConfigureCmd) -DENABLE_JS_INTEROP_BY_VALUE=1
diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets
index b42a869f811f57..f056be6c5912fb 100644
--- a/src/mono/browser/build/BrowserWasmApp.targets
+++ b/src/mono/browser/build/BrowserWasmApp.targets
@@ -56,7 +56,7 @@
<_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions
<_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions
- <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128
+ <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128 -mbulk-memory
<_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.native.wasm
diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt
index 1fd1db756049e3..09dbe43eab746a 100644
--- a/src/mono/browser/runtime/CMakeLists.txt
+++ b/src/mono/browser/runtime/CMakeLists.txt
@@ -9,7 +9,7 @@ set(CMAKE_EXECUTABLE_SUFFIX ".js")
add_executable(dotnet.native runtime.c corebindings.c driver.c pinvoke.c)
target_include_directories(dotnet.native PUBLIC ${MONO_INCLUDES} ${MONO_OBJ_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}/include/wasm)
-target_compile_options(dotnet.native PUBLIC @${NATIVE_BIN_DIR}/src/emcc-default.rsp @${NATIVE_BIN_DIR}/src/emcc-compile.rsp -DGEN_PINVOKE=1 ${CONFIGURATION_COMPILE_OPTIONS})
+target_compile_options(dotnet.native PUBLIC @${NATIVE_BIN_DIR}/src/emcc-default.rsp @${NATIVE_BIN_DIR}/src/emcc-compile.rsp -DGEN_PINVOKE=1 ${CONFIGURATION_COMPILE_OPTION1} ${CONFIGURATION_COMPILE_OPTION2})
set_target_properties(dotnet.native PROPERTIES COMPILE_FLAGS ${CONFIGURATION_EMCC_FLAGS})
@@ -39,12 +39,12 @@ set_target_properties(dotnet.native PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${NATIVE_BIN_DIR}")
set(ignoreMeWasmOptFlags "${CONFIGURATION_WASM_OPT_FLAGS}")
-set(ignoreMeWasmOptAdditionalFlags "${CONFIGURATION_COMPILE_OPTIONS}")
+set(ignoreMeWasmOptAdditionalFlags "${CONFIGURATION_COMPILE_OPTION1}" "${CONFIGURATION_COMPILE_OPTION2}")
set(ignoreMeEmsdkPath "${EMSDK_PATH}")
if(CMAKE_BUILD_TYPE STREQUAL "Release")
add_custom_command(TARGET dotnet.native
- POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt --enable-exception-handling --enable-simd --enable-bulk-memory ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm
+ POST_BUILD COMMAND ${EMSDK_PATH}/bin/wasm-opt ${CONFIGURATION_WASM_OPT_FLAGS} --strip-dwarf ${NATIVE_BIN_DIR}/dotnet.native.wasm -o ${NATIVE_BIN_DIR}/dotnet.native.wasm
COMMENT "Stripping debug symbols from dotnet.native.wasm using wasm-opt")
endif()
diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt
index 23b8d15bf708f1..9803dfd8ac32b9 100644
--- a/src/mono/mono/mini/CMakeLists.txt
+++ b/src/mono/mono/mini/CMakeLists.txt
@@ -484,7 +484,7 @@ endif()
if(HOST_BROWSER OR HOST_WASI)
add_library(mono-wasm-simd STATIC interp/interp-simd.c)
target_link_libraries (mono-wasm-simd PRIVATE monoapi eglib_api)
- set_target_properties(mono-wasm-simd PROPERTIES COMPILE_FLAGS "-msimd128")
+ set_target_properties(mono-wasm-simd PROPERTIES COMPILE_FLAGS "-msimd128 -mbulk-memory")
install(TARGETS mono-wasm-simd LIBRARY)
endif()
diff --git a/src/mono/wasi/wasi.proj b/src/mono/wasi/wasi.proj
index 266af5227107c6..b0692bb64d027f 100644
--- a/src/mono/wasi/wasi.proj
+++ b/src/mono/wasi/wasi.proj
@@ -59,8 +59,14 @@
+
+
+
+
+
+
-
+
@@ -156,7 +162,7 @@
$(CMakeBuildRuntimeConfigureCmd) -DMONO_OBJ_INCLUDES="$(MonoObjDir.TrimEnd('\/'))"
$(CMakeBuildRuntimeConfigureCmd) -DMONO_ARTIFACTS_DIR="$(MonoArtifactsPath.TrimEnd('\/'))"
$(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/'))"
- $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTIONS="-msimd128" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd"
+ $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTIONS="-msimd128 -mbulk-memory" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd"
$(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_INTERPSIMDTABLES_LIB="nosimd"
$(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0
call "$(RepositoryEngineeringDir)native\init-vs-env.cmd" wasm && $(CMakeBuildRuntimeConfigureCmd)
diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets
index d9bf8e3b931dae..264c4559c3ea42 100644
--- a/src/mono/wasm/build/WasmApp.Common.targets
+++ b/src/mono/wasm/build/WasmApp.Common.targets
@@ -462,12 +462,12 @@
+
+
+
-
-
-
@@ -911,8 +911,8 @@
-
-
+