Skip to content

Commit b5d5ab2

Browse files
authored
[browser] WASM exception handling to use the standardized exnref (#129851)
1 parent 2636092 commit b5d5ab2

30 files changed

Lines changed: 156 additions & 110 deletions

eng/native/configureplatform.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ else()
503503
if(CLR_CMAKE_RUNTIME_CORECLR)
504504
if(CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CROSS_COMPONENTS_BUILD)
505505
add_link_options(-fwasm-exceptions)
506-
add_link_options(-sWASM_LEGACY_EXCEPTIONS=1)
506+
add_link_options(-sWASM_LEGACY_EXCEPTIONS=0)
507507
add_link_options(-Wno-unused-command-line-argument)
508508
add_link_options(-Wl,--error-limit=0)
509509

@@ -512,12 +512,12 @@ else()
512512
add_link_options(-lc)
513513
add_link_options(-lmalloc)
514514
add_link_options(-lcompiler_rt)
515-
add_link_options(-lc++)
516-
add_link_options(-lc++abi)
517-
add_link_options(-lunwind)
515+
add_link_options(-lc++-wasmexcept)
516+
add_link_options(-lc++abi-wasmexcept)
517+
add_link_options(-lunwind-wasmexcept)
518518

519519
add_compile_options(-fwasm-exceptions)
520-
add_compile_options(-sWASM_LEGACY_EXCEPTIONS=1)
520+
add_compile_options(-sWASM_LEGACY_EXCEPTIONS=0)
521521
add_compile_options(-mbulk-memory)
522522
add_compile_options(-msimd128)
523523
endif()

eng/pipelines/common/templates/pipeline-with-resources.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,12 @@ extends:
109109
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream-10-amd64@sha256:1849c00a1347f17dbdd167bc8d025b9e2c31273a1f8c2eddbfac3f2197932ee7
110110

111111
browser_wasm:
112-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:5ad583f9a503d9b5d71171ac27018db895f9b48f136d5d4fe3cdcf80bc28937e
112+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:0afc4daa90da131fd61de0751429a7dadf4cc2e4a159f0c60a0d24d02267bae8
113113
env:
114114
ROOTFS_DIR: /crossrootfs/x64
115115

116116
wasi_wasm:
117-
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:5ad583f9a503d9b5d71171ac27018db895f9b48f136d5d4fe3cdcf80bc28937e
117+
image: mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-net11.0-webassembly-amd64@sha256:0afc4daa90da131fd61de0751429a7dadf4cc2e4a159f0c60a0d24d02267bae8
118118
env:
119119
ROOTFS_DIR: /crossrootfs/x64
120120

eng/pipelines/common/templates/runtimes/build-runtime-tests-and-send-to-helix.yml

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ parameters:
2121
dependsOn: []
2222
extraHelixArguments: ''
2323
buildAllTestsAsStandalone: false
24+
sendToHelix: true
2425
#arcade-specific parameters
2526
condition: always()
2627
continueOnError: false
@@ -82,41 +83,48 @@ steps:
8283
env:
8384
__MonoToolPrefix: aarch64-linux-gnu-
8485

85-
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
86-
parameters:
87-
displayName: Send tests to Helix
88-
buildConfig: $(buildConfigUpper)
89-
archType: ${{ parameters.archType }}
90-
osGroup: ${{ parameters.osGroup }}
91-
osSubgroup: ${{ parameters.osSubgroup}}
92-
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
93-
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
94-
runtimeFlavor: ${{ parameters.runtimeFlavor }}
95-
runtimeVariant: ${{ parameters.runtimeVariant }}
86+
# Build the runtime tests above, but only send them to Helix when sendToHelix is true.
87+
# This is a compile-time exclusion (not a runtime condition): send-to-helix-inner-step.yml
88+
# wraps the passed-in condition into a string and compares it with ne(condition, false), so a
89+
# runtime 'condition: false' is swallowed and the send runs anyway. Excluding the template keeps
90+
# build coverage while reliably skipping execution on engines that can't run the tests yet
91+
# (e.g. browser/V8 without exnref support).
92+
- ${{ if eq(parameters.sendToHelix, true) }}:
93+
- template: /eng/pipelines/common/templates/runtimes/send-to-helix-step.yml
94+
parameters:
95+
displayName: Send tests to Helix
96+
buildConfig: $(buildConfigUpper)
97+
archType: ${{ parameters.archType }}
98+
osGroup: ${{ parameters.osGroup }}
99+
osSubgroup: ${{ parameters.osSubgroup}}
100+
coreClrRepoRoot: $(Build.SourcesDirectory)/src/coreclr
101+
shouldContinueOnError: ${{ parameters.shouldContinueOnError }}
102+
runtimeFlavor: ${{ parameters.runtimeFlavor }}
103+
runtimeVariant: ${{ parameters.runtimeVariant }}
96104

97-
${{ if eq(variables['System.TeamProject'], 'internal') }}:
98-
# Access token variable for internal project from the
99-
# DotNet-HelixApi-Access variable group
100-
helixAccessToken: $(HelixApiAccessToken)
101-
${{ else }}:
102-
creator: $(Build.DefinitionName)
105+
${{ if eq(variables['System.TeamProject'], 'internal') }}:
106+
# Access token variable for internal project from the
107+
# DotNet-HelixApi-Access variable group
108+
helixAccessToken: $(HelixApiAccessToken)
109+
${{ else }}:
110+
creator: $(Build.DefinitionName)
103111

104-
helixBuild: $(Build.BuildNumber)
105-
helixSource: $(_HelixSource)
106-
${{ if ne(parameters.readyToRun, true) }}:
107-
helixType: 'test/functional/cli/'
112+
helixBuild: $(Build.BuildNumber)
113+
helixSource: $(_HelixSource)
114+
${{ if ne(parameters.readyToRun, true) }}:
115+
helixType: 'test/functional/cli/'
108116

109-
helixQueues: ${{ parameters.helixQueues }}
110-
# This tests whether an array is empty
111-
${{ if eq(join('', parameters.helixQueues), '') }}:
112-
condition: false
113-
publishTestResults: true
114-
timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
115-
timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes)
116-
runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
117-
compositeBuildMode: ${{ parameters.compositeBuildMode }}
118-
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
119-
nativeAotTest: ${{ parameters.nativeAotTest }}
120-
helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj'
121-
extraHelixArguments: ${{ parameters.extraHelixArguments }}
122-
scenarios: ${{ parameters.scenarios }}
117+
helixQueues: ${{ parameters.helixQueues }}
118+
# This tests whether an array is empty
119+
${{ if eq(join('', parameters.helixQueues), '') }}:
120+
condition: false
121+
publishTestResults: true
122+
timeoutPerTestInMinutes: $(timeoutPerTestInMinutes)
123+
timeoutPerTestCollectionInMinutes: $(timeoutPerTestCollectionInMinutes)
124+
runCrossGen2: ${{ eq(parameters.readyToRun, true) }}
125+
compositeBuildMode: ${{ parameters.compositeBuildMode }}
126+
runInUnloadableContext: ${{ parameters.runInUnloadableContext }}
127+
nativeAotTest: ${{ parameters.nativeAotTest }}
128+
helixProjectArguments: '$(Build.SourcesDirectory)/src/tests/Common/helixpublishwitharcade.proj'
129+
extraHelixArguments: ${{ parameters.extraHelixArguments }}
130+
scenarios: ${{ parameters.scenarios }}

eng/pipelines/common/templates/wasm-runtime-tests.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,10 @@ jobs:
4848
creator: dotnet-bot
4949
testRunNamePrefixSuffix: Mono_$(_BuildConfig)
5050
testBuildArgs: /p:InstallV8ForTests=false
51+
# Build the runtime tests for browser, but don't send them to Helix to run on V8: the
52+
# V8 baked into the helix-webassembly container doesn't support --experimental-wasm-exnref
53+
# yet, so the tests abort at startup. Re-enable the run once the new V8 image is
54+
# available. See ActiveIssue https://github.com/dotnet/runtime/issues/129849
55+
sendToHelix: false
5156
extraVariablesTemplates:
5257
- template: /eng/pipelines/common/templates/runtimes/test-variables.yml

eng/pipelines/performance/runtime-wasm-perf.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,11 @@
44

55
trigger: none
66

7-
pr:
8-
branches:
9-
include:
10-
- main
11-
paths:
12-
include:
13-
- eng/pipelines/performance/*
14-
- eng/testing/performance/*
15-
- eng/testing/BrowserVersions.props
7+
# Disabled: the perf wasm v8 job installs V8 via jsvu, and the V8 binary it currently
8+
# installs does not support --experimental-wasm-exnref yet, so the MicroBenchmarks Helix
9+
# job aborts at startup. Re-enable once an exnref-capable V8 is pinned. See
10+
# ActiveIssue https://github.com/dotnet/runtime/issues/129849
11+
pr: none
1612

1713
resources:
1814
repositories:

eng/pipelines/runtime-linker-tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,11 @@ extends:
135135
postBuildSteps:
136136
- template: /eng/pipelines/libraries/execute-trimming-tests-steps.yml
137137
parameters:
138-
extraTestArgs: '/p:WasmBuildNative=false /p:RuntimeFlavor=Mono /p:ToolsConfiguration=Debug'
138+
# Publish the trimmed browser apps, but don't run them on V8: the V8 baked into
139+
# the helix-webassembly container doesn't support --experimental-wasm-exnref yet,
140+
# so run-v8.sh aborts at startup. SkipTrimmingTestsRun keeps the build/publish
141+
# coverage and only skips ExecuteApplications. Re-enable the run once the new V8
142+
# image is available. See
143+
# ActiveIssue https://github.com/dotnet/runtime/issues/129849
144+
extraTestArgs: '/p:WasmBuildNative=false /p:RuntimeFlavor=Mono /p:ToolsConfiguration=Debug /p:SkipTrimmingTestsRun=true'
139145
runAotTests: false

eng/pipelines/runtime-llvm.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pr:
5252
- src/mono/mono/mini/mini-exceptions.*
5353
- src/mono/mono/mini/exceptions-*.*
5454
- src/mono/mono/mini/mini-runtime.*
55+
- src/mono/mono/metadata/assembly-load-context.*
5556

5657
variables:
5758
- template: /eng/pipelines/common/variables.yml

eng/pipelines/runtime.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ extends:
997997
extraBuildArgs: /p:AotHostArchitecture=x64 /p:AotHostOS=$(_hostedOS)
998998
scenarios:
999999
- WasmTestOnFirefox
1000-
- WasmTestOnV8
1000+
# ActiveIssue https://github.com/dotnet/runtime/issues/129849
1001+
# - WasmTestOnV8
10011002

10021003
# EAT Library tests - only run on linux
10031004
- template: /eng/pipelines/common/templates/wasm-library-aot-tests.yml

eng/testing/BrowserVersions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<linux_ChromeVersion>149.0.7827.53</linux_ChromeVersion>
44
<linux_ChromeRevision>1625079</linux_ChromeRevision>
55
<linux_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Linux_x64/1625084</linux_ChromeBaseSnapshotUrl>
6-
<linux_V8Version>14.9.207</linux_V8Version>
6+
<linux_V8Version>15.1.103</linux_V8Version>
77
<macos_ChromeVersion>143.0.7499.40</macos_ChromeVersion>
88
<macos_ChromeRevision>1536371</macos_ChromeRevision>
99
<macos_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Mac_Arm/1536376</macos_ChromeBaseSnapshotUrl>
10-
<macos_V8Version>14.3.127</macos_V8Version>
10+
<macos_V8Version>15.1.103</macos_V8Version>
1111
<win_ChromeVersion>150.0.7871.24</win_ChromeVersion>
1212
<win_ChromeRevision>1639810</win_ChromeRevision>
1313
<win_ChromeBaseSnapshotUrl>https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1639827</win_ChromeBaseSnapshotUrl>
14-
<win_V8Version>15.0.245</win_V8Version>
14+
<win_V8Version>15.1.103</win_V8Version>
1515
<linux_FirefoxRevision>140.11.0esr</linux_FirefoxRevision>
1616
<linux_GeckoDriverRevision>0.37.0</linux_GeckoDriverRevision>
1717
<win_FirefoxRevision>140.11.0esr</win_FirefoxRevision>

eng/testing/WasmRunnerTemplate.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if /I [%XHARNESS_COMMAND%] == [test] (
4747
)
4848

4949
if [%JS_ENGINE_ARGS%] == [] (
50-
set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000"
50+
set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000 --engine-arg^=--experimental-wasm-exnref"
5151
)
5252
) else (
5353
if /I [%SCENARIO%] == [WasmTestOnChrome] (

0 commit comments

Comments
 (0)