Skip to content

Commit

Permalink
[wasm] Turn Wasm exception handling on by default and use WasmEnableE…
Browse files Browse the repository at this point in the history
…xceptio… (#84573)

* Turn Wasm exception handling on by default and use WasmEnableExceptionHandling as the default value for WasmEnableSIMD

* Update WasmApp.targets

fix typo

* Add --experimental-wasm-eh to nodejs arguments

---------

Co-authored-by: Radek Doulik <radekdoulik@gmail.com>
  • Loading branch information
lewing and radekdoulik authored Apr 15, 2023
1 parent 72586a7 commit b9483f3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/mono/wasm/Wasm.Build.Tests/HostRunner/NodeJSHostRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace Wasm.Build.Tests;
public class NodeJSHostRunner : IHostRunner
{
public string GetTestCommand() => "wasm test";
public string GetXharnessArgsWindowsOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --engine-arg=--experimental-wasm-simd";
public string GetXharnessArgsOtherOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --locale={options.environmentLocale} --engine-arg=--experimental-wasm-simd";
public string GetXharnessArgsWindowsOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh";
public string GetXharnessArgsOtherOS(XHarnessArgsOptions options) => $"--js-file={options.jsRelativePath} --engine=NodeJS -v trace --locale={options.environmentLocale} --engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh";
public bool UseWasmConsoleOutput() => true;
public bool CanRunWBT() => true;
}
4 changes: 2 additions & 2 deletions src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void Build_NoAOT_ShouldNotRelink(BuildArgs buildArgs, RunHost host, strin
Assert.DoesNotContain("Compiling native assets with emcc", output);

RunAndTestWasmApp(buildArgs,
extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd" : "",
extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh" : "",
expectedExitCode: 42,
test: output =>
{
Expand All @@ -67,7 +67,7 @@ public void PublishWithSIMD_AOT(BuildArgs buildArgs, RunHost host, string id)
DotnetWasmFromRuntimePack: false));

RunAndTestWasmApp(buildArgs,
extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd" : "",
extraXHarnessArgs: host == RunHost.NodeJS ? "--engine-arg=--experimental-wasm-simd --engine-arg=--experimental-wasm-eh" : "",
expectedExitCode: 42,
test: output =>
{
Expand Down
9 changes: 5 additions & 4 deletions src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
Defaults to false.
- $(WasmAotProfilePath) - Path to an AOT profile file.
- $(WasmEnableLegacyJsInterop) - Include support for legacy JS interop. Defaults to true.
- $(WasmEnableExceptionHandling) - Enable support for the WASM Exception Handling feature.
- $(WasmEnableSIMD) - Enable support for the WASM SIMD feature.
- $(WasmEnableExceptionHandling) - Enable support for the WASM post MVP Exception Handling runtime extension.
- $(WasmEnableSIMD) - Enable support for the WASM post MVP SIMD runtime extension.
- $(WasmEnableWebcil) - Enable conversion of assembly .dlls to .webcil
- $(WasmIncludeFullIcuData) - Loads full ICU data (icudt.dat). Defaults to false. Only applicable when InvariantGlobalization=false.
- $(WasmIcuDataFileName) - Name/path of ICU globalization file loaded to app. Only when InvariantGloblization=false and WasmIncludeFullIcuData=false.
Expand Down Expand Up @@ -99,8 +99,9 @@

<PropertyGroup>
<WasmDedup Condition="'$(WasmDedup)' == ''">true</WasmDedup>
<WasmEnableExceptionHandling Condition="'$(WasmEnableExceptionHandling)' == ''">false</WasmEnableExceptionHandling>
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">true</WasmEnableSIMD>
<!-- Post Wasm MVP features -->
<WasmEnableExceptionHandling Condition="'$(WasmEnableExceptionHandling)' == ''">true</WasmEnableExceptionHandling>
<WasmEnableSIMD Condition="'$(WasmEnableSIMD)' == ''">$(WasmEnableExceptionHandling)</WasmEnableSIMD>
<WasmEnableLegacyJsInterop Condition="'$(WasmEnableLegacyJsInterop)' == ''">true</WasmEnableLegacyJsInterop>

<!--<WasmStripAOTAssemblies Condition="'$(AOTMode)' == 'LLVMOnlyInterp'">false</WasmStripAOTAssemblies>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"js-path": "main.mjs",
"Host": "nodejs",
"host-args": [
"--experimental-wasm-simd"
"--experimental-wasm-simd",
"--experimental-wasm-eh"
]
}
]
Expand Down

0 comments on commit b9483f3

Please sign in to comment.