diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake
index 046d630bc4793f..bdb9837b09d53a 100644
--- a/eng/native/configureplatform.cmake
+++ b/eng/native/configureplatform.cmake
@@ -503,7 +503,7 @@ else()
if(CLR_CMAKE_RUNTIME_CORECLR)
if(CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CROSS_COMPONENTS_BUILD)
add_link_options(-fwasm-exceptions)
- add_link_options(-sWASM_LEGACY_EXCEPTIONS=1)
+ add_link_options(-sWASM_LEGACY_EXCEPTIONS=0)
add_link_options(-Wno-unused-command-line-argument)
add_link_options(-Wl,--error-limit=0)
@@ -512,12 +512,12 @@ else()
add_link_options(-lc)
add_link_options(-lmalloc)
add_link_options(-lcompiler_rt)
- add_link_options(-lc++)
- add_link_options(-lc++abi)
- add_link_options(-lunwind)
+ add_link_options(-lc++-wasmexcept)
+ add_link_options(-lc++abi-wasmexcept)
+ add_link_options(-lunwind-wasmexcept)
add_compile_options(-fwasm-exceptions)
- add_compile_options(-sWASM_LEGACY_EXCEPTIONS=1)
+ add_compile_options(-sWASM_LEGACY_EXCEPTIONS=0)
add_compile_options(-mbulk-memory)
add_compile_options(-msimd128)
endif()
diff --git a/eng/pipelines/common/templates/pipeline-with-resources.yml b/eng/pipelines/common/templates/pipeline-with-resources.yml
index d643302049c0d0..1580b5842514e2 100644
--- a/eng/pipelines/common/templates/pipeline-with-resources.yml
+++ b/eng/pipelines/common/templates/pipeline-with-resources.yml
@@ -109,12 +109,12 @@ extends:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream-10-amd64@sha256:1849c00a1347f17dbdd167bc8d025b9e2c31273a1f8c2eddbfac3f2197932ee7
browser_wasm:
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:5ad583f9a503d9b5d71171ac27018db895f9b48f136d5d4fe3cdcf80bc28937e
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:0afc4daa90da131fd61de0751429a7dadf4cc2e4a159f0c60a0d24d02267bae8
env:
ROOTFS_DIR: /crossrootfs/x64
wasi_wasm:
- image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:5ad583f9a503d9b5d71171ac27018db895f9b48f136d5d4fe3cdcf80bc28937e
+ image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:0afc4daa90da131fd61de0751429a7dadf4cc2e4a159f0c60a0d24d02267bae8
env:
ROOTFS_DIR: /crossrootfs/x64
diff --git a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
index f88692190cc221..8bb1a1b287fbf9 100644
--- a/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
+++ b/eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml
@@ -21,6 +21,7 @@ parameters:
dependsOn: []
extraHelixArguments: ''
buildAllTestsAsStandalone: false
+ sendToHelix: true
#arcade-specific parameters
condition: always()
continueOnError: false
@@ -107,8 +108,9 @@ steps:
helixType: 'test/functional/cli/'
helixQueues: ${{ parameters.helixQueues }}
- # This tests whether an array is empty
- ${{ if eq(join('', parameters.helixQueues), '') }}:
+ # Skip the Helix send (and thus test execution) when there are no queues, or when the caller
+ # disabled it via sendToHelix=false (e.g. the target JS engine can't run the tests yet).
+ ${{ if or(eq(join('', parameters.helixQueues), ''), ne(parameters.sendToHelix, true)) }}:
condition: false
publishTestResults: true
timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
diff --git a/eng/pipelines/common/templates/wasm-runtime-tests.yml b/eng/pipelines/common/templates/wasm-runtime-tests.yml
index 8f84bdb93038db..8663a97a326286 100644
--- a/eng/pipelines/common/templates/wasm-runtime-tests.yml
+++ b/eng/pipelines/common/templates/wasm-runtime-tests.yml
@@ -48,5 +48,10 @@ jobs:
creator: dotnet-bot
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
testBuildArgs: /p:InstallV8ForTests=false
+ # Build the runtime tests for browser, but don't send them to Helix to run on V8: the
+ # V8 baked into the helix-webassembly container doesn't support --experimental-wasm-exnref
+ # yet, so the tests abort at startup. Re-enable the run once the new V8 image is
+ # available. See ActiveIssue https://github.com/dotnet/runtime/issues/129849
+ sendToHelix: false
extraVariablesTemplates:
- template: /eng/pipelines/common/templates/runtimes/test-variables.yml
diff --git a/eng/pipelines/performance/runtime-wasm-perf.yml b/eng/pipelines/performance/runtime-wasm-perf.yml
index bb99c421344af8..bb064eb87c49be 100644
--- a/eng/pipelines/performance/runtime-wasm-perf.yml
+++ b/eng/pipelines/performance/runtime-wasm-perf.yml
@@ -4,15 +4,11 @@
trigger: none
-pr:
- branches:
- include:
- - main
- paths:
- include:
- - eng/pipelines/performance/*
- - eng/testing/performance/*
- - eng/testing/BrowserVersions.props
+# Disabled: the perf wasm v8 job installs V8 via jsvu, and the V8 binary it currently
+# installs does not support --experimental-wasm-exnref yet, so the MicroBenchmarks Helix
+# job aborts at startup. Re-enable once an exnref-capable V8 is pinned. See
+# ActiveIssue https://github.com/dotnet/runtime/issues/129849
+pr: none
resources:
repositories:
diff --git a/eng/pipelines/runtime-linker-tests.yml b/eng/pipelines/runtime-linker-tests.yml
index d7fc85743e17dd..2337c2a1ff535e 100644
--- a/eng/pipelines/runtime-linker-tests.yml
+++ b/eng/pipelines/runtime-linker-tests.yml
@@ -135,5 +135,11 @@ extends:
postBuildSteps:
- template: /eng/pipelines/libraries/execute-trimming-tests-steps.yml
parameters:
- extraTestArgs: '/p:WasmBuildNative=false /p:RuntimeFlavor=Mono /p:ToolsConfiguration=Debug'
+ # Publish the trimmed browser apps, but don't run them on V8: the V8 baked into
+ # the helix-webassembly container doesn't support --experimental-wasm-exnref yet,
+ # so run-v8.sh aborts at startup. SkipTrimmingTestsRun keeps the build/publish
+ # coverage and only skips ExecuteApplications. Re-enable the run once the new V8
+ # image is available. See
+ # ActiveIssue https://github.com/dotnet/runtime/issues/129849
+ extraTestArgs: '/p:WasmBuildNative=false /p:RuntimeFlavor=Mono /p:ToolsConfiguration=Debug /p:SkipTrimmingTestsRun=true'
runAotTests: false
diff --git a/eng/pipelines/runtime-llvm.yml b/eng/pipelines/runtime-llvm.yml
index f2b1b278b88702..cccd41d60c8e3d 100644
--- a/eng/pipelines/runtime-llvm.yml
+++ b/eng/pipelines/runtime-llvm.yml
@@ -52,6 +52,7 @@ pr:
- src/mono/mono/mini/mini-exceptions.*
- src/mono/mono/mini/exceptions-*.*
- src/mono/mono/mini/mini-runtime.*
+ - src/mono/mono/metadata/assembly-load-context.*
variables:
- template: /eng/pipelines/common/variables.yml
diff --git a/eng/pipelines/runtime.yml b/eng/pipelines/runtime.yml
index 24217dc211b50d..ace076ad20afde 100644
--- a/eng/pipelines/runtime.yml
+++ b/eng/pipelines/runtime.yml
@@ -997,7 +997,8 @@ extends:
extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
scenarios:
- WasmTestOnFirefox
- - WasmTestOnV8
+ # ActiveIssue https://github.com/dotnet/runtime/issues/129849
+ # - WasmTestOnV8
# EAT Library tests - only run on linux
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml
diff --git a/eng/testing/BrowserVersions.props b/eng/testing/BrowserVersions.props
index a7ad7cdf44b5f6..58d3ec6527b78b 100644
--- a/eng/testing/BrowserVersions.props
+++ b/eng/testing/BrowserVersions.props
@@ -3,15 +3,15 @@
149.0.7827.53
1625079
https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1625084
- 14.9.207
+ 15.1.103
143.0.7499.40
1536371
https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1536376
- 14.3.127
+ 15.1.103
150.0.7871.24
1639810
https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1639827
- 15.0.245
+ 15.1.103
140.11.0esr
0.37.0
140.11.0esr
diff --git a/eng/testing/WasmRunnerTemplate.cmd b/eng/testing/WasmRunnerTemplate.cmd
index 463883384bde3d..0e8b6c9406ee29 100644
--- a/eng/testing/WasmRunnerTemplate.cmd
+++ b/eng/testing/WasmRunnerTemplate.cmd
@@ -47,7 +47,7 @@ if /I [%XHARNESS_COMMAND%] == [test] (
)
if [%JS_ENGINE_ARGS%] == [] (
- set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000"
+ set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000 --engine-arg^=--experimental-wasm-exnref"
)
) else (
if /I [%SCENARIO%] == [WasmTestOnChrome] (
diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh
index dc9339e1acdd62..91fcc162f4fbf4 100644
--- a/eng/testing/WasmRunnerTemplate.sh
+++ b/eng/testing/WasmRunnerTemplate.sh
@@ -44,7 +44,7 @@ if [[ "$XHARNESS_COMMAND" == "test" ]]; then
fi
if [[ -z "$JS_ENGINE_ARGS" ]]; then
- JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000"
+ JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref"
fi
else
if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then
diff --git a/eng/testing/linker/trimmingTests.targets b/eng/testing/linker/trimmingTests.targets
index 0418d28da14dbd..e7bc773611afcc 100644
--- a/eng/testing/linker/trimmingTests.targets
+++ b/eng/testing/linker/trimmingTests.targets
@@ -160,7 +160,7 @@
DependsOnTargets="PublishTrimmedProjects"
Inputs="%(TestConsoleApps.Identity)"
Outputs="_unused"
- Condition="'$(ArchiveTests)' != 'true'">
+ Condition="'$(ArchiveTests)' != 'true' and '$(SkipTrimmingTestsRun)' != 'true'">
diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj
index ea0216294c7247..975ea9271620ef 100644
--- a/src/mono/browser/browser.proj
+++ b/src/mono/browser/browser.proj
@@ -324,7 +324,7 @@
-g -Os -DDEBUG=1
-Oz
- $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1
+ $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0
$(CMakeConfigurationEmccFlags) -fexceptions
$(CMakeConfigurationEmccFlags) -s ASSERTIONS=1
@@ -335,7 +335,7 @@
$(CMakeConfigurationLinkFlags) -msimd128
$(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth
$(CMakeConfigurationLinkFlags) --emit-symbol-map
- $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1
+ $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0
$(CMakeConfigurationLinkFlags) -fexceptions
-DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/').Replace('\','/'))"
diff --git a/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets b/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets
index 6107ce3bfd3c75..7a2fca2545ccc6 100644
--- a/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets
+++ b/src/mono/browser/build/BrowserWasmApp.CoreCLR.targets
@@ -27,7 +27,7 @@
true
emcc
- <_WasmDefaultFlags>-fwasm-exceptions -msimd128
+ <_WasmDefaultFlags>-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 -msimd128
Build
Publish
@@ -465,6 +465,7 @@
<_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' == 'true'" />
<_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" />
<_EmccCommonFlags Include="-fwasm-exceptions" />
+ <_EmccCommonFlags Include="-sWASM_LEGACY_EXCEPTIONS=0" />
<_EmccCommonFlags Include="-msimd128" />
diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets
index 3937ca4624c841..d331f8313fb460 100644
--- a/src/mono/browser/build/BrowserWasmApp.targets
+++ b/src/mono/browser/build/BrowserWasmApp.targets
@@ -37,7 +37,7 @@
emcc
<_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions
- <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=1
+ <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=0
<_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128
<_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.native.wasm
@@ -181,7 +181,7 @@
<_EmccCommonFlags Include="-fexceptions" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
<_EmccCommonFlags Include="-s DISABLE_EXCEPTION_CATCHING=0" Condition="'$(WasmEnableExceptionHandling)' == 'false'" />
<_EmccCommonFlags Include="-fwasm-exceptions" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
- <_EmccCommonFlags Include="-s WASM_LEGACY_EXCEPTIONS=1" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
+ <_EmccCommonFlags Include="-s WASM_LEGACY_EXCEPTIONS=0" Condition="'$(WasmEnableExceptionHandling)' == 'true'" />
<_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" />
<_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" />
@@ -470,7 +470,7 @@
diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt
index 25338f761a6006..a133f625d40f89 100644
--- a/src/mono/browser/runtime/CMakeLists.txt
+++ b/src/mono/browser/runtime/CMakeLists.txt
@@ -44,7 +44,7 @@ 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-multivalue --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int ${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 --enable-exception-handling --enable-reference-types --enable-multivalue --enable-simd --enable-bulk-memory --enable-nontrapping-float-to-int ${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/browser/runtime/jiterpreter-jit-call.ts b/src/mono/browser/runtime/jiterpreter-jit-call.ts
index 3175cc5a758e5a..df012d2ffc465a 100644
--- a/src/mono/browser/runtime/jiterpreter-jit-call.ts
+++ b/src/mono/browser/runtime/jiterpreter-jit-call.ts
@@ -333,11 +333,11 @@ export function mono_interp_flush_jitcall_queue (): void {
return;
}
- if (builder.options.enableWasmEh) {
- if (!runtimeHelpers.featureWasmEh) {
+ if (builder.options.enableWasmFinalEh) {
+ if (!runtimeHelpers.featureWasmFinalEh) {
// The user requested to enable wasm EH but it's not supported, so turn the option back off
- applyOptions({ enableWasmEh: false });
- builder.options.enableWasmEh = false;
+ applyOptions({ enableWasmFinalEh: false });
+ builder.options.enableWasmFinalEh = false;
}
}
@@ -639,10 +639,16 @@ function generate_wasm_body (
): boolean {
let stack_index = 0;
- // If wasm EH is enabled we will perform the call inside a catch-all block and set a flag
- // if it throws any exception
- if (builder.options.enableWasmEh)
- builder.block(WasmValtype.void, WasmOpcode.try_);
+ // If wasm EH is enabled we perform the call inside a try_table (standardized exnref proposal)
+ // and set a flag if it throws a C++ exception. Structure:
+ // (block $outer (block $catch (result i32) (try_table (catch __cpp_exception $catch) ) br $outer) )
+ if (builder.options.enableWasmFinalEh) {
+ builder.block(WasmValtype.void); // $outer
+ builder.block(WasmValtype.i32); // $catch - receives the exception pointer
+ // try_table catch labels are resolved in the scope surrounding the try_table (its own
+ // block label is not counted), so depth 0 targets the immediately-enclosing $catch block.
+ builder.tryTable(WasmValtype.void, "__cpp_exception", 0); // catch __cpp_exception -> $catch
+ }
// Wrapper signature: [thisptr], [&retval], &arg0, ..., &funcdef
// Desired stack layout for direct calls: [&retval], [thisptr], arg0, ..., &rgctx
@@ -779,9 +785,12 @@ function generate_wasm_body (
}
// If the call threw a JS or wasm exception, set the thrown flag
- if (builder.options.enableWasmEh) {
- builder.appendU8(WasmOpcode.catch_);
- builder.appendULeb(builder.getTypeIndex("__cpp_exception"));
+ if (builder.options.enableWasmFinalEh) {
+ builder.endBlock(); // end try_table
+ // Normal completion (no exception): skip the handler by branching out to $outer
+ builder.appendU8(WasmOpcode.br);
+ builder.appendULeb(1);
+ builder.endBlock(); // end $catch - reached only when caught, stack: [exception ptr]
builder.callImport("begin_catch");
builder.callImport("end_catch");
builder.local("thrown");
@@ -789,7 +798,7 @@ function generate_wasm_body (
builder.appendU8(WasmOpcode.i32_store);
builder.appendMemarg(0, 2);
- builder.endBlock();
+ builder.endBlock(); // end $outer
}
builder.appendU8(WasmOpcode.return_);
diff --git a/src/mono/browser/runtime/jiterpreter-opcodes.ts b/src/mono/browser/runtime/jiterpreter-opcodes.ts
index 4d3ab5c3930f1c..27303091de9d07 100644
--- a/src/mono/browser/runtime/jiterpreter-opcodes.ts
+++ b/src/mono/browser/runtime/jiterpreter-opcodes.ts
@@ -81,11 +81,8 @@ export const enum WasmOpcode {
if_,
else_,
- try_ = 0x06,
- catch_,
- catch_all = 0x19,
- throw_ = 0x08,
- rethrow_ = 0x09,
+ throw_ref = 0x0a,
+ try_table = 0x1f,
end = 0x0b,
br,
diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts
index 3235406cae7894..740a05bb14b4a9 100644
--- a/src/mono/browser/runtime/jiterpreter-support.ts
+++ b/src/mono/browser/runtime/jiterpreter-support.ts
@@ -481,13 +481,13 @@ export class WasmBuilder {
if (includeFunctionTable !== false)
throw new Error("function table imports are disabled");
- const enableWasmEh = this.getExceptionTag() !== undefined;
+ const enableWasmFinalEh = this.getExceptionTag() !== undefined;
// Import section
this.beginSection(2);
this.appendULeb(
1 + // memory
- (enableWasmEh ? 1 : 0) + // c++ exception tag
+ (enableWasmFinalEh ? 1 : 0) + // c++ exception tag
importsToEmit.length +
((includeFunctionTable !== false) ? 1 : 0)
);
@@ -520,7 +520,7 @@ export class WasmBuilder {
this.appendULeb(0x01);
}
- if (enableWasmEh) {
+ if (enableWasmFinalEh) {
// import the c++ exception tag
this.appendName("x");
this.appendName("e");
@@ -856,6 +856,28 @@ export class WasmBuilder {
this.appendU8(WasmOpcode.end);
}
+ // Returns the index of an imported tag within the wasm tag index space, which is SEPARATE
+ // from the type index space (so getTypeIndex must not be used for catch/throw immediates).
+ // The jiterpreter module imports exactly one tag, __cpp_exception, so it is at tag index 0.
+ getTagIndex (name: string): number {
+ if (name !== "__cpp_exception")
+ throw new Error(`Unknown wasm tag '${name}'`);
+ return 0;
+ }
+
+ // Emits a try_table block (standardized exnref EH proposal) with a single
+ // 'catch -> label' clause. On catch, the tag's parameters are pushed and control
+ // branches out by catchLabelDepth levels. Must be closed with endBlock().
+ tryTable (type: WasmValtype, catchTagName: string, catchLabelDepth: number) {
+ this.appendU8(WasmOpcode.try_table);
+ this.appendU8(type);
+ this.appendULeb(1); // one catch clause
+ this.appendU8(0x00); // 0x00 = catch (tag): push tag params, then branch
+ this.appendULeb(this.getTagIndex(catchTagName)); // tag index (separate index space from types)
+ this.appendULeb(catchLabelDepth);
+ this.activeBlocks++;
+ }
+
arg (name: string | number, opcode?: WasmOpcode) {
const index = typeof (name) === "string"
? (this.locals.has(name) ? this.locals.get(name)! : undefined)
@@ -1969,7 +1991,7 @@ export type JiterpreterOptions = {
enableJitCall: boolean;
enableBackwardBranches: boolean;
enableCallResume: boolean;
- enableWasmEh: boolean;
+ enableWasmFinalEh: boolean;
enableSimd: boolean;
enableAtomics: boolean;
zeroPageOptimization: boolean;
@@ -2016,7 +2038,7 @@ const optionNames: { [jsName: string]: string } = {
"enableJitCall": "jiterpreter-jit-call-enabled",
"enableBackwardBranches": "jiterpreter-backward-branch-entries-enabled",
"enableCallResume": "jiterpreter-call-resume-enabled",
- "enableWasmEh": "jiterpreter-wasm-eh-enabled",
+ "enableWasmFinalEh": "jiterpreter-wasm-eh-enabled",
"enableSimd": "jiterpreter-simd-enabled",
"enableAtomics": "jiterpreter-atomics-enabled",
"zeroPageOptimization": "jiterpreter-zero-page-optimization",
diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts
index 503e926834cae6..8fd1ff269284f5 100644
--- a/src/mono/browser/runtime/loader/globals.ts
+++ b/src/mono/browser/runtime/loader/globals.ts
@@ -6,7 +6,7 @@
import WasmEnableThreads from "consts:wasmEnableThreads";
-import { exceptions, simd, relaxedSimd } from "wasm-feature-detect";
+import { simd, relaxedSimd, exceptionsFinal } from "wasm-feature-detect";
import gitHash from "consts:gitHash";
@@ -131,7 +131,7 @@ export function setLoaderGlobals (
isDebuggingSupported,
// from wasm-feature-detect npm package
- exceptions,
+ exceptionsFinal,
simd,
relaxedSimd
};
diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts
index 343283935a6cda..6093a03c4dae16 100644
--- a/src/mono/browser/runtime/startup.ts
+++ b/src/mono/browser/runtime/startup.ts
@@ -83,7 +83,7 @@ export function configureEmscriptenStartup (module: DotnetModuleInternal): void
mono_assert(runtimeHelpers.featureWasmSimd, "This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms");
}
if (runtimeHelpers.emscriptenBuildOptions.wasmEnableEH) {
- mono_assert(runtimeHelpers.featureWasmEh, "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms");
+ mono_assert(runtimeHelpers.featureWasmFinalEh, "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://learn.microsoft.com/aspnet/core/blazor/supported-platforms");
}
module.mainScriptUrlOrBlob = loaderHelpers.scriptUrl;// this is needed by worker threads
@@ -146,8 +146,8 @@ async function instantiateWasmWorker (
const instance = new WebAssembly.Instance(Module.wasmModule!, imports);
Module.wasmModule = null;
- preRunWorker();
successCallback(instance, undefined);
+ preRunWorker();
}
@@ -424,10 +424,10 @@ async function instantiate_wasm_module (
async function ensureUsedWasmFeatures () {
const simd = loaderHelpers.simd();
const relaxedSimd = loaderHelpers.relaxedSimd();
- const exceptions = loaderHelpers.exceptions();
+ const exceptions = loaderHelpers.exceptionsFinal();
runtimeHelpers.featureWasmSimd = await simd;
runtimeHelpers.featureWasmRelaxedSimd = await relaxedSimd;
- runtimeHelpers.featureWasmEh = await exceptions;
+ runtimeHelpers.featureWasmFinalEh = await exceptions;
}
export async function start_runtime () {
diff --git a/src/mono/browser/runtime/types/internal.ts b/src/mono/browser/runtime/types/internal.ts
index 48f989867fbc81..6c04f9b275b9b0 100644
--- a/src/mono/browser/runtime/types/internal.ts
+++ b/src/mono/browser/runtime/types/internal.ts
@@ -174,7 +174,7 @@ export type LoaderHelpers = {
isFirefox: boolean
// from wasm-feature-detect npm package
- exceptions: () => Promise,
+ exceptionsFinal: () => Promise,
simd: () => Promise,
relaxedSimd: () => Promise,
}
@@ -226,7 +226,7 @@ export type RuntimeHelpers = {
afterOnRuntimeInitialized: PromiseAndController,
afterPostRun: PromiseAndController,
- featureWasmEh: boolean,
+ featureWasmFinalEh: boolean,
featureWasmSimd: boolean,
featureWasmRelaxedSimd: boolean,
diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt
index 3b95c60c1f45da..33623aae258757 100644
--- a/src/mono/mono/mini/CMakeLists.txt
+++ b/src/mono/mono/mini/CMakeLists.txt
@@ -476,8 +476,8 @@ if(HOST_BROWSER)
add_library(mono-wasm-eh-wasm STATIC llvm-runtime.cpp)
target_link_libraries (mono-wasm-eh-wasm PRIVATE monoapi eglib_api)
- set_target_properties(mono-wasm-eh-wasm PROPERTIES COMPILE_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1")
- set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1")
+ set_target_properties(mono-wasm-eh-wasm PROPERTIES COMPILE_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0")
+ set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0")
install(TARGETS mono-wasm-eh-wasm LIBRARY)
endif()
diff --git a/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj b/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj
index 5e9ae0d965fe6f..65301b3087520a 100644
--- a/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj
+++ b/src/mono/sample/wasm/console-node/Wasm.Console.Node.Sample.csproj
@@ -6,7 +6,7 @@
true
2
- $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode)
+ $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode)
diff --git a/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj b/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj
index cbd591be53286b..dfc937e8569bea 100644
--- a/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj
+++ b/src/mono/sample/wasm/console-v8/Wasm.Console.V8.Sample.csproj
@@ -5,7 +5,7 @@
true
true
- $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar)
+ $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar)
diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk
index 22db9a0d89fa9e..658d77ead989b4 100644
--- a/src/mono/sample/wasm/wasm.mk
+++ b/src/mono/sample/wasm/wasm.mk
@@ -42,10 +42,10 @@ run-browser:
fi
run-console:
- cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --single-threaded $(MAIN_JS) -- $(ARGS)
+ cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) -- $(ARGS)
run-console-node:
- cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS)
+ cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS)
debug-console-node:
- cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS)
\ No newline at end of file
+ cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS)
\ No newline at end of file
diff --git a/src/mono/wasm/build/WasmApp.Common.targets b/src/mono/wasm/build/WasmApp.Common.targets
index d154d54a5b5104..a8e6211aab2741 100644
--- a/src/mono/wasm/build/WasmApp.Common.targets
+++ b/src/mono/wasm/build/WasmApp.Common.targets
@@ -930,8 +930,8 @@
<_WasmOptPostLinkFileName Condition="'$([System.IO.Path]::IsPathRooted($(_WasmOptPostLinkFileName)))' != 'true'">$([System.IO.Path]::Combine($(_WasmIntermediateOutputPath), $(_WasmOptPostLinkFileName)))
-
-
+
diff --git a/src/tests/Common/CLRTest.Execute.Bash.targets b/src/tests/Common/CLRTest.Execute.Bash.targets
index f6e69ad1ab0bb2..933b04c77a9942 100644
--- a/src/tests/Common/CLRTest.Execute.Bash.targets
+++ b/src/tests/Common/CLRTest.Execute.Bash.targets
@@ -404,7 +404,7 @@ else
echo CLRTestExecutionArguments: ${CLRTestExecutionArguments[@]}
echo node version: `node -v`
echo Timeout in ms: $__TestTimeout
- cmd=( node --stack-size=8192 "${CORE_ROOT}/corerun.js" -c "${CORE_ROOT}" "${PWD}/${ExePath}" "${CLRTestExecutionArguments[@]}" )
+ cmd=( node --stack-size=8192 --experimental-wasm-exnref "${CORE_ROOT}/corerun.js" -c "${CORE_ROOT}" "${PWD}/${ExePath}" "${CLRTestExecutionArguments[@]}" )
echo Running: "${cmd[@]}"
run_with_timeout $__TestTimeout "${cmd[@]}"
fi
diff --git a/src/tests/Common/CLRTest.Execute.Batch.targets b/src/tests/Common/CLRTest.Execute.Batch.targets
index f193266a921e2c..ac19dfcbab3718 100644
--- a/src/tests/Common/CLRTest.Execute.Batch.targets
+++ b/src/tests/Common/CLRTest.Execute.Batch.targets
@@ -364,7 +364,7 @@ IF NOT DEFINED RunWithNodeJS (
ECHO CLRTestExecutionArguments: %CLRTestExecutionArguments%
ECHO Timeout in ms: !__TestTimeout!
- set "__RunCmd=node --stack-size=8192 "!__CoreRootWin!\corerun.js" -c "!__CoreRootUnix!" "!__ExePathUnix!" %CLRTestExecutionArguments%"
+ set "__RunCmd=node --stack-size=8192 --experimental-wasm-exnref "!__CoreRootWin!\corerun.js" -c "!__CoreRootUnix!" "!__ExePathUnix!" %CLRTestExecutionArguments%"
ECHO Running: !__RunCmd!
call :RunWithTimeout !__TestTimeout!
set CLRTestExitCode=!ERRORLEVEL!