From af4402c672728f99692f98e7039d4c487e03d0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 18:44:17 +0200 Subject: [PATCH 01/55] Upgrade emsdk to 5.0.6 --- eng/Version.Details.props | 78 ++++----- eng/Version.Details.xml | 156 +++++++++--------- eng/Versions.props | 2 +- eng/common/SetupNugetSources.ps1 | 5 + eng/common/SetupNugetSources.sh | 5 + .../core-templates/job/helix-job-monitor.yml | 2 +- eng/common/core-templates/job/job.yml | 6 + .../steps/enable-internal-sources.yml | 24 +++ eng/common/cross/build-rootfs.sh | 10 +- .../native/LocateNativeCompiler.targets | 27 +++ eng/common/templates/job/job.yml | 5 - eng/common/templates/vmr-build-pr.yml | 2 +- eng/native/tryrun.browser.cmake | 4 +- global.json | 8 +- src/mono/browser/emscripten-version.txt | 2 +- src/mono/mono.proj | 2 +- 16 files changed, 202 insertions(+), 136 deletions(-) create mode 100644 eng/common/native/LocateNativeCompiler.targets diff --git a/eng/Version.Details.props b/eng/Version.Details.props index ae9bc9d9cb1a5f..a557b85a51f85a 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -6,46 +6,46 @@ This file should be imported by eng/Versions.props - 5.9.0-1.26302.118 - 5.9.0-1.26302.118 - 5.9.0-1.26302.118 - 5.9.0-1.26302.118 - 11.0.100-preview.6.26302.118 - 11.0.100-preview.6.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 0.11.5-preview.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 - 11.0.0-beta.26302.118 + 5.9.0-1.26311.101 + 5.9.0-1.26311.101 + 5.9.0-1.26311.101 + 5.9.0-1.26311.101 + 11.0.100-preview.6.26311.101 + 11.0.100-preview.6.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 0.11.5-preview.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 + 11.0.0-beta.26311.101 3.2.2-beta.26257.113 - 2.9.3-beta.26302.118 - 11.0.0-beta.26302.118 - 5.9.0-1.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.100-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 7.9.0-rc.30318 - 7.9.0-rc.30318 - 7.9.0-rc.30318 - 7.9.0-rc.30318 - 11.0.0-preview.6.26302.118 - 3.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 - 11.0.0-preview.6.26302.118 + 2.9.3-beta.26311.101 + 11.0.0-beta.26311.101 + 5.9.0-1.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.100-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 7.9.0-rc.31201 + 7.9.0-rc.31201 + 7.9.0-rc.31201 + 7.9.0-rc.31201 + 11.0.0-preview.6.26311.101 + 3.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 + 11.0.0-preview.6.26311.101 11.0.0-alpha.0.26180.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1b7caa3bb024bc..330a6578080d21 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -37,91 +37,91 @@ https://github.com/dotnet/llvm-project 64a0a6a5130929ccaa47b52ad28997b7922920cc - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/dotnet 0eae08ed2f094f44e0151e4815e7cdd1a334fcdf - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/runtime-assets @@ -259,33 +259,33 @@ https://github.com/dotnet/llvm-project 64a0a6a5130929ccaa47b52ad28997b7922920cc - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/xharness @@ -299,9 +299,9 @@ https://github.com/dotnet/xharness fa7fbebf9168e8858971f9d0c71b2b08f2f7b106 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -327,33 +327,33 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://dev.azure.com/dnceng/internal/_git/dotnet-optimization @@ -365,21 +365,21 @@ - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 - + https://github.com/dotnet/dotnet - 6f5c5dc027109e572313690b0fc81dacbb2baba5 + 0d94f75beb811109f9992d20998c35e8b7f91144 https://github.com/dotnet/node diff --git a/eng/Versions.props b/eng/Versions.props index 4625dbb9864ccb..c3817ef6345fda 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -172,7 +172,7 @@ $(MicrosoftNETCoreAppRefPackageVersion) $(runtimewinx64MicrosoftNETCoreRuntimeWasmNodeTransportPackageVersion) - 3.1.56 + 5.0.6 1.1.87-gba258badda 1.0.0-v3.14.0.5722 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index fc8d618014e0da..58002808bc841a 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -32,6 +32,11 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +# This script only consumes helper functions from tools.ps1 to configure NuGet feeds. +# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring +# a bootstrap SDK) is not triggered as a side effect of feed configuration. +$disableConfigureToolsetImport = $true + . $PSScriptRoot\tools.ps1 # Adds or enables the package source with the given name diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index b97cc536379dfe..67e7e0942ca14e 100755 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -40,6 +40,11 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +# This script only consumes helper functions from tools.sh to configure NuGet feeds. +# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring +# a bootstrap SDK) is not triggered as a side effect of feed configuration. +disable_configure_toolset_import=1 + . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then diff --git a/eng/common/core-templates/job/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml index 767450da2fcb03..a8162c51166735 100644 --- a/eng/common/core-templates/job/helix-job-monitor.yml +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -170,7 +170,7 @@ jobs: toolArgs=( --helix-base-uri '${{ parameters.helixBaseUri }}' --polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}' - --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 2))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. + --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. --stage-name '$(System.StageName)' ) diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index 66c7988f222a65..cb60f5297844a4 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -75,6 +75,12 @@ jobs: variables: - name: AllowPtrToDetectTestRunRetryFiles value: true + # Component Governance detection and CodeQL are not run in the public project + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - name: skipComponentGovernanceDetection + value: true + - name: Codeql.SkipTaskAutoInjection + value: true - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml index 4085512b690910..51af9a017091ff 100644 --- a/eng/common/core-templates/steps/enable-internal-sources.yml +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -15,32 +15,56 @@ steps: - ${{ if ne(variables['System.TeamProject'], 'public') }}: - ${{ if ne(parameters.legacyCredential, '') }}: - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token env: Token: ${{ parameters.legacyCredential }} + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + targetType: inline + script: | + "$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token" + env: + Token: ${{ parameters.legacyCredential }} # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - ${{ else }}: - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh + arguments: $(System.DefaultWorkingDirectory)/NuGet.config - ${{ else }}: - template: /eng/common/templates/steps/get-federated-access-token.yml parameters: federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} outputVariableName: 'dnceng-artifacts-feeds-read-access-token' - task: PowerShell@2 + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) + - task: Bash@3 + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + displayName: Setup Internal Feeds + inputs: + filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh + arguments: $(System.DefaultWorkingDirectory)/NuGet.config $(dnceng-artifacts-feeds-read-access-token) # This is required in certain scenarios to install the ADO credential provider. # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others # (e.g. dotnet msbuild). diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index f06854ccc1865e..273cae651a2b1e 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -618,15 +618,15 @@ elif [[ "$__CodeName" == "openbsd" ]]; then [[ -z "$PKG_FILE" ]] && { echo "ERROR: Package $pkg not found"; exit 1; } if [[ "$__hasWget" == 1 ]]; then - wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - + wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - else - curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - + curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - fi done echo "Creating versionless symlinks for shared libraries..." # Find all versioned .so files and create the base .so symlink - for lib in "$__RootfsDir/usr/lib/libc++.so."* "$__RootfsDir/usr/lib/libc++abi.so."* "$__RootfsDir/usr/lib/libpthread.so."*; do + for lib in "$__RootfsDir"/usr/lib/lib*.so.*; do if [ -f "$lib" ]; then # Extract the filename (e.g., libc++.so.12.0) VERSIONED_NAME=$(basename "$lib") @@ -636,6 +636,10 @@ elif [[ "$__CodeName" == "openbsd" ]]; then ln -sf "$VERSIONED_NAME" "$__RootfsDir/usr/lib/$BASE_NAME" fi done + + echo "Cleaning up unnecessary paths" + # we don't use executables and kernel in rootfs (as we use host's compiler with -sysroot) + rm -rf "$__RootfsDir/usr/share" "$__RootfsDir/usr/bin" elif [[ "$__CodeName" == "illumos" ]]; then mkdir "$__RootfsDir/tmp" pushd "$__RootfsDir/tmp" diff --git a/eng/common/native/LocateNativeCompiler.targets b/eng/common/native/LocateNativeCompiler.targets new file mode 100644 index 00000000000000..028b33d944416f --- /dev/null +++ b/eng/common/native/LocateNativeCompiler.targets @@ -0,0 +1,27 @@ + + + + + clang + $(ROOTFS_DIR) + + + + + + + + $(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';')))) + <_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1)))) + lld + + + diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 5e261f34db421b..85501406a541b6 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -21,11 +21,6 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} - # we don't run CG in public - - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" - displayName: Set skipComponentGovernanceDetection variable - artifactPublishSteps: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml index 2f3694fa13239e..d24de935248a68 100644 --- a/eng/common/templates/vmr-build-pr.yml +++ b/eng/common/templates/vmr-build-pr.yml @@ -33,7 +33,7 @@ resources: - repository: vmr type: github name: dotnet/dotnet - endpoint: dotnet + endpoint: public ref: refs/heads/main # Set to whatever VMR branch the PR build should insert into stages: diff --git a/eng/native/tryrun.browser.cmake b/eng/native/tryrun.browser.cmake index ed8ac60a55a576..ecee89e501f7dd 100644 --- a/eng/native/tryrun.browser.cmake +++ b/eng/native/tryrun.browser.cmake @@ -6,7 +6,7 @@ # IMPORTANT: This file is specific to the Emscripten version and WebAssembly target. # # Valid for: -# - Emscripten version: 3.1.56 +# - Emscripten version: 5.0.6 # - Target: wasm32-unknown-emscripten (browser-wasm) # - Architecture: wasm32 # - OS: browser/Emscripten @@ -85,7 +85,7 @@ # mv eng/native/tryrun.browser.cmake.bak eng/native/tryrun.browser.cmake # Version tracking: This cache is valid for the following Emscripten version -set(TRYRUN_BROWSER_EMSCRIPTEN_VERSION "3.1.56" CACHE INTERNAL "Emscripten version this cache was generated for") +set(TRYRUN_BROWSER_EMSCRIPTEN_VERSION "5.0.6" CACHE INTERNAL "Emscripten version this cache was generated for") # Macro to set cache values (same as eng/native/tryrun.cmake) macro(set_cache_value) diff --git a/global.json b/global.json index 8d47900ffba1b7..8f6f1ee63b47d5 100644 --- a/global.json +++ b/global.json @@ -13,11 +13,11 @@ "dotnet": "11.0.100-preview.5.26227.104" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26302.118", - "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26302.118", - "Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26302.118", + "Microsoft.DotNet.Arcade.Sdk": "11.0.0-beta.26311.101", + "Microsoft.DotNet.Helix.Sdk": "11.0.0-beta.26311.101", + "Microsoft.DotNet.SharedFramework.Sdk": "11.0.0-beta.26311.101", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0", - "Microsoft.NET.Sdk.IL": "11.0.0-preview.6.26302.118" + "Microsoft.NET.Sdk.IL": "11.0.0-preview.6.26311.101" } } diff --git a/src/mono/browser/emscripten-version.txt b/src/mono/browser/emscripten-version.txt index 4a8bd23c1443d4..4d5e5283b97fb2 100644 --- a/src/mono/browser/emscripten-version.txt +++ b/src/mono/browser/emscripten-version.txt @@ -1 +1 @@ -3.1.56 \ No newline at end of file +5.0.6 \ No newline at end of file diff --git a/src/mono/mono.proj b/src/mono/mono.proj index c3844d6351437a..e936acfb2ce67f 100644 --- a/src/mono/mono.proj +++ b/src/mono/mono.proj @@ -757,7 +757,7 @@ <_PythonCmd Condition="'$(HostOS)' != 'windows'">python3 <_PythonCmd Condition="'$(HostOS)' == 'windows'">python - <_PythonCmd Condition="'$(HostOS)' == 'windows' and ('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true')">$([MSBuild]::NormalizePath('$(PkgMicrosoft_NET_Runtime_Emscripten_3_1_56_Python_win-x64)', 'tools', 'python.exe')) + <_PythonCmd Condition="'$(HostOS)' == 'windows' and ('$(TargetsBrowser)' == 'true' or '$(TargetsWasi)' == 'true')">$([MSBuild]::NormalizePath('$(PkgMicrosoft_NET_Runtime_Emscripten_5_0_6_Python_win-x64)', 'tools', 'python.exe')) From 64a07bfb6d47b5d125b016a5e72faa65cab00c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 18:50:07 +0200 Subject: [PATCH 02/55] Add general-testing feed --- NuGet.config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.config b/NuGet.config index 8d2d351914d014..d89fa51e4679ea 100644 --- a/NuGet.config +++ b/NuGet.config @@ -22,6 +22,7 @@ + From 5c431c3242f608042b0b48ba93d3ef79c2cea279 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Tue, 26 May 2026 14:05:56 +0200 Subject: [PATCH 03/55] rebase (cherry picked from commit ea0ec7c019dbf7ce2da317b285004a1232479407) --- src/mono/mono/mini/mini-llvm-cpp.cpp | 26 +++++++++++++------------- src/mono/mono/mini/mini-llvm-cpp.h | 4 ++-- src/mono/mono/mini/mini-llvm.c | 12 ++++++------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm-cpp.cpp b/src/mono/mono/mini/mini-llvm-cpp.cpp index 80d99c341c6802..18db74f8da5e4f 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.cpp +++ b/src/mono/mono/mini/mini-llvm-cpp.cpp @@ -308,12 +308,12 @@ mono_llvm_replace_uses_of (LLVMValueRef var, LLVMValueRef v) } LLVMValueRef -mono_llvm_create_constant_data_array (const uint8_t *data, int len) +mono_llvm_create_constant_data_array (LLVMContextRef ctx, const uint8_t *data, int len) { #if LLVM_API_VERSION >= 1600 - return wrap(ConstantDataArray::get (*unwrap(LLVMGetGlobalContext ()), ArrayRef(data, len))); + return wrap(ConstantDataArray::get (*unwrap(ctx), ArrayRef(data, len))); #else - return wrap(ConstantDataArray::get (*unwrap(LLVMGetGlobalContext ()), makeArrayRef(data, len))); + return wrap(ConstantDataArray::get (*unwrap(ctx), makeArrayRef(data, len))); #endif } @@ -514,7 +514,7 @@ mono_llvm_add_param_attr_with_type (LLVMValueRef param, AttrKind kind, LLVMTypeR switch (kind) { case LLVM_ATTR_STRUCT_RET: - func->addParamAttr (n, Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + func->addParamAttr (n, Attribute::getWithStructRetType (func->getContext (), unwrap (type))); break; default: g_assert_not_reached (); @@ -526,7 +526,7 @@ mono_llvm_add_param_byval_attr (LLVMValueRef param, LLVMTypeRef type) { Function *func = unwrap (param)->getParent (); int n = unwrap (param)->getArgNo (); - func->addParamAttr (n, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + func->addParamAttr (n, Attribute::getWithByValType (func->getContext (), unwrap (type))); } void @@ -542,7 +542,7 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, switch (kind) { case LLVM_ATTR_STRUCT_RET: - attr = Attribute::getWithStructRetType (*unwrap (LLVMGetGlobalContext ()), unwrap (type)); + attr = Attribute::getWithStructRetType (unwrap (val)->getContext (), unwrap (type)); unwrap (val)->addParamAttr (index - 1, attr); break; default: @@ -553,7 +553,7 @@ mono_llvm_add_instr_attr_with_type (LLVMValueRef val, int index, AttrKind kind, void mono_llvm_add_instr_byval_attr (LLVMValueRef val, int index, LLVMTypeRef type) { - unwrap (val)->addParamAttr (index - 1, Attribute::getWithByValType (*unwrap (LLVMGetGlobalContext ()), unwrap (type))); + unwrap (val)->addParamAttr (index - 1, Attribute::getWithByValType (unwrap (val)->getContext (), unwrap (type))); } void* @@ -603,7 +603,7 @@ mono_llvm_di_create_file (void *di_builder, const char *dir, const char *file) void* mono_llvm_di_create_location (void *di_builder, void *scope, int row, int column) { - return DILocation::get (*unwrap(LLVMGetGlobalContext ()), row, column, (Metadata*)scope); + return DILocation::get (cast((Metadata*)scope)->getContext (), row, column, (Metadata*)scope); } void @@ -631,7 +631,7 @@ mono_llvm_di_builder_finalize (void *di_builder) LLVMValueRef mono_llvm_get_or_insert_gc_safepoint_poll (LLVMModuleRef module) { - llvm::FunctionCallee callee = unwrap(module)->getOrInsertFunction("gc.safepoint_poll", FunctionType::get(unwrap(LLVMVoidType()), false)); + llvm::FunctionCallee callee = unwrap(module)->getOrInsertFunction("gc.safepoint_poll", FunctionType::get(Type::getVoidTy(unwrap(module)->getContext()), false)); return wrap (dyn_cast (callee.getCallee ())); } @@ -725,7 +725,7 @@ mono_llvm_register_intrinsic (LLVMModuleRef module, IntrinsicId id, LLVMTypeRef outs () << id << "\n"; g_assert_not_reached (); } - auto type = Intrinsic::getType (*unwrap(LLVMGetGlobalContext ()), intrins_id); + auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id); *out_type = wrap (type); return wrap (f); } else { @@ -749,7 +749,7 @@ mono_llvm_register_overloaded_intrinsic (LLVMModuleRef module, IntrinsicId id, L for (int i = 0; i < ntypes; ++i) arr [i] = unwrap (types [i]); auto f = Intrinsic::getDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); - auto type = Intrinsic::getType (*unwrap(LLVMGetGlobalContext ()), intrins_id, { arr, (size_t)ntypes }); + auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id, { arr, (size_t)ntypes }); *out_type = wrap (type); return wrap (f); } @@ -784,8 +784,8 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type, } LLVMTypeRef -mono_llvm_get_ptr_type (void) +mono_llvm_get_ptr_type (LLVMContextRef ctx) { - PointerType *t = PointerType::get (*unwrap (LLVMGetGlobalContext ()), 0); + PointerType *t = PointerType::get (*unwrap (ctx), 0); return wrap (t); } diff --git a/src/mono/mono/mini/mini-llvm-cpp.h b/src/mono/mono/mini/mini-llvm-cpp.h index 9f40accf3043ac..7882ee1ce8ce52 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.h +++ b/src/mono/mono/mini/mini-llvm-cpp.h @@ -111,7 +111,7 @@ void mono_llvm_set_must_tailcall (LLVMValueRef call_ins); LLVMValueRef -mono_llvm_create_constant_data_array (const uint8_t *data, int len); +mono_llvm_create_constant_data_array (LLVMContextRef ctx, const uint8_t *data, int len); void mono_llvm_set_is_constant (LLVMValueRef global_var); @@ -234,7 +234,7 @@ mono_llvm_inline_asm (LLVMBuilderRef builder, LLVMTypeRef type, const char *name); LLVMTypeRef -mono_llvm_get_ptr_type (void); +mono_llvm_get_ptr_type (LLVMContextRef ctx); G_END_DECLS diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index f310f7364f5d88..0fad7c29a9c4c4 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -8075,7 +8075,7 @@ MONO_RESTORE_WARNING LLVMValueRef info_var = LLVMAddGlobal (ctx->lmodule, LLVMArrayType (LLVMInt8Type (), 8), "@OBJC_IMAGE_INFO"); int32_t objc_imageinfo [] = { 0, 0 }; - LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array ((uint8_t *) &objc_imageinfo, 8)); + LLVMSetInitializer (info_var, mono_llvm_create_constant_data_array (ctx->module->context, (uint8_t *) &objc_imageinfo, 8)); LLVMSetLinkage (info_var, LLVMPrivateLinkage); LLVMSetExternallyInitialized (info_var, TRUE); LLVMSetSection (info_var, "__DATA, __objc_imageinfo,regular,no_dead_strip"); @@ -8091,7 +8091,7 @@ MONO_RESTORE_WARNING LLVMTypeRef name_var_type = LLVMArrayType (LLVMInt8Type (), (unsigned int)(strlen (name) + 1)); LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, name_var_type, "@OBJC_METH_VAR_NAME_"); - LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((const uint8_t*)name, (int)(strlen (name) + 1))); + LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array (ctx->module->context, (const uint8_t*)name, (int)(strlen (name) + 1))); LLVMSetLinkage (name_var, LLVMPrivateLinkage); LLVMSetSection (name_var, "__TEXT,__objc_methname,cstring_literals"); mark_as_used (ctx->module, name_var); @@ -13619,7 +13619,7 @@ emit_method_inner (EmitContext *ctx) LLVMValueRef name_var = LLVMAddGlobal (ctx->lmodule, type, "missing_method_name"); LLVMSetVisibility (name_var, LLVMHiddenVisibility); LLVMSetLinkage (name_var, LLVMInternalLinkage); - LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array ((guint8*)name, len + 1)); + LLVMSetInitializer (name_var, mono_llvm_create_constant_data_array (ctx->module->context, (guint8*)name, len + 1)); mono_llvm_set_is_constant (name_var); g_free (name); @@ -14058,7 +14058,7 @@ add_types (MonoLLVMModule *module) void mono_llvm_init (gboolean enable_jit) { - ptr_t = mono_llvm_get_ptr_type (); + ptr_t = mono_llvm_get_ptr_type (LLVMGetGlobalContext ()); intrin_types [0][0] = i1_t = LLVMInt8Type (); intrin_types [0][1] = i2_t = LLVMInt16Type (); @@ -14469,7 +14469,7 @@ mono_llvm_emit_aot_data_aligned (const char *symbol, guint8 *data, int data_len, d = LLVMAddGlobal (module->lmodule, type, symbol); LLVMSetVisibility (d, LLVMHiddenVisibility); LLVMSetLinkage (d, LLVMInternalLinkage); - LLVMSetInitializer (d, mono_llvm_create_constant_data_array (data, data_len)); + LLVMSetInitializer (d, mono_llvm_create_constant_data_array (module->context, data, data_len)); if (align != 1) LLVMSetAlignment (d, align); mono_llvm_set_is_constant (d); @@ -14911,7 +14911,7 @@ mono_llvm_emit_aot_module (const char *filename, const char *cu_name) LLVMDeleteGlobal (cfg->llvm_dummy_info_var); } else { // FIXME: How can this happen ? - LLVMSetInitializer (cfg->llvm_dummy_info_var, mono_llvm_create_constant_data_array (NULL, 0)); + LLVMSetInitializer (cfg->llvm_dummy_info_var, mono_llvm_create_constant_data_array (module->context, NULL, 0)); } } } From 1cc4928b5e5c45640ae2c2fbc1d5c1ddd4619db4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 19:41:07 +0200 Subject: [PATCH 04/55] Remove lbulkmemory --- eng/native/configureplatform.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 5626751cd9c885..e45fd26203320c 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -507,7 +507,6 @@ else() add_link_options(-Wl,--error-limit=0) add_link_options(-nostdlib) - add_link_options(-lbulkmemory) add_link_options(-lstubs) add_link_options(-lc) add_link_options(-lmalloc) From f0619f9e876b7290e390e536627033bfa9633872 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 19:42:16 +0200 Subject: [PATCH 05/55] Update to llvm 23.x --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index a557b85a51f85a..468c756144805f 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 - 19.1.0-alpha.1.26256.1 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26261.2 11.0.0-alpha.1.26279.1 11.0.0-alpha.1.26279.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 330a6578080d21..d89a3b753fa61d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b - + https://github.com/dotnet/llvm-project - 64a0a6a5130929ccaa47b52ad28997b7922920cc + 0b467a806dc5812f978c1a9e3c5ab3f49417d48b https://github.com/dotnet/dotnet From ea8bd080d6679e7f186775166d34d5eea6796ce4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 11 Jun 2026 20:17:02 +0200 Subject: [PATCH 06/55] Fix llvm version check in src/mono/CMakeLists.txt --- src/mono/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index 4ef4acb0eee17d..0fc53433128438 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -637,21 +637,21 @@ if(LLVM_PREFIX) string(REGEX REPLACE ".*MONO_API_VERSION ([0-9]+)" "\\1" llvm_api_version ${llvm_api_version_line}) # IMPORTANT: when bumping LLVM make sure to rerun the llvm-config commands below and update the variables accordingly - if (NOT ${llvm_api_version} EQUAL 1900) + if (NOT ${llvm_api_version} EQUAL 2300) message(FATAL_ERROR "Unexpected LLVM version: ${llvm_api_version}.") endif() # llvm-config --libs analysis core bitwriter mcjit orcjit - set(MONO_llvm_core_libs "LLVMOrcJIT" "LLVMPasses" "LLVMIRPrinter" "LLVMHipStdPar" "LLVMCoroutines" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendOffloading" "LLVMCodeGen" "LLVMScalarOpts" "LLVMInstCombine" "LLVMObjCARCOpts" "LLVMCodeGenTypes" "LLVMCFGuard" "LLVMAggressiveInstCombine" "LLVMTransformUtils" "LLVMWindowsDriver" "LLVMJITLink" "LLVMOption" "LLVMMCJIT" "LLVMExecutionEngine" "LLVMTarget" "LLVMRuntimeDyld" "LLVMOrcTargetProcess" "LLVMOrcShared" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_core_libs "LLVMOrcJIT" "LLVMPasses" "LLVMIRPrinter" "LLVMHipStdPar" "LLVMCoroutines" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMSandboxIR" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendDirective" "LLVMFrontendAtomic" "LLVMFrontendOffloading" "LLVMObjectYAML" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCodeGen" "LLVMScalarOpts" "LLVMInstCombine" "LLVMObjCARCOpts" "LLVMCodeGenTypes" "LLVMCGData" "LLVMCFGuard" "LLVMAggressiveInstCombine" "LLVMTransformUtils" "LLVMWindowsDriver" "LLVMJITLink" "LLVMOption" "LLVMMCJIT" "LLVMExecutionEngine" "LLVMTarget" "LLVMRuntimeDyld" "LLVMOrcTargetProcess" "LLVMOrcShared" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBitReader" "LLVMFrontendHLSL" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") # llvm-config --libs x86codegen - set(MONO_llvm_extra_libs_x86codegen "LLVMX86CodeGen" "LLVMX86Desc" "LLVMX86Info" "LLVMMCDisassembler" "LLVMInstrumentation" "LLVMIRPrinter" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCodeGenTypes" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_extra_libs_x86codegen "LLVMX86CodeGen" "LLVMX86Desc" "LLVMX86Info" "LLVMMCDisassembler" "LLVMInstrumentation" "LLVMIRPrinter" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCodeGenTypes" "LLVMCGData" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBitReader" "LLVMFrontendHLSL" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") # llvm-config --libs armcodegen - set(MONO_llvm_extra_libs_armcodegen "LLVMARMCodeGen" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendOffloading" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMARMDesc" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMMCDisassembler" "LLVMCodeGenTypes" "LLVMARMUtils" "LLVMARMInfo" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_extra_libs_armcodegen "LLVMARMCodeGen" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMSandboxIR" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendDirective" "LLVMFrontendAtomic" "LLVMFrontendOffloading" "LLVMObjectYAML" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCGData" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMFrontendHLSL" "LLVMARMDesc" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMMCDisassembler" "LLVMCodeGenTypes" "LLVMARMUtils" "LLVMARMInfo" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") # llvm-config --libs aarch64codegen - set(MONO_llvm_extra_libs_aarch64codegen "LLVMAArch64CodeGen" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMAArch64Desc" "LLVMCodeGenTypes" "LLVMAArch64Utils" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMAArch64Info" "LLVMMC" "LLVMDebugInfoCodeView" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") + set(MONO_llvm_extra_libs_aarch64codegen "LLVMAArch64CodeGen" "LLVMPasses" "LLVMIRPrinter" "LLVMHipStdPar" "LLVMCoroutines" "LLVMipo" "LLVMInstrumentation" "LLVMVectorize" "LLVMSandboxIR" "LLVMLinker" "LLVMFrontendOpenMP" "LLVMFrontendDirective" "LLVMFrontendAtomic" "LLVMFrontendOffloading" "LLVMObjectYAML" "LLVMGlobalISel" "LLVMSelectionDAG" "LLVMCFGuard" "LLVMAsmPrinter" "LLVMCodeGen" "LLVMTarget" "LLVMScalarOpts" "LLVMInstCombine" "LLVMAggressiveInstCombine" "LLVMObjCARCOpts" "LLVMTransformUtils" "LLVMCGData" "LLVMBitWriter" "LLVMAnalysis" "LLVMProfileData" "LLVMSymbolize" "LLVMDebugInfoBTF" "LLVMDebugInfoPDB" "LLVMDebugInfoMSF" "LLVMDebugInfoCodeView" "LLVMDebugInfoGSYM" "LLVMDebugInfoDWARF" "LLVMObject" "LLVMTextAPI" "LLVMMCParser" "LLVMIRReader" "LLVMAsmParser" "LLVMBitReader" "LLVMFrontendHLSL" "LLVMCore" "LLVMRemarks" "LLVMBitstreamReader" "LLVMAArch64Desc" "LLVMCodeGenTypes" "LLVMAArch64Utils" "LLVMAArch64Info" "LLVMMC" "LLVMDebugInfoDWARFLowLevel" "LLVMBinaryFormat" "LLVMTargetParser" "LLVMSupport" "LLVMDemangle") if(HOST_LINUX AND NOT HOST_WASM AND NOT HOST_WASI) set(MONO_stdlib "-nostdinc++ -nostdlib++") From 813760c2b13eb0b3cdfc5aa3125af71ba3b40ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 01:20:54 +0200 Subject: [PATCH 07/55] Fix llvm warnings/errors --- src/mono/mono/mini/mini-llvm-cpp.cpp | 8 ++++++++ src/mono/mono/mini/mini-llvm.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/mono/mono/mini/mini-llvm-cpp.cpp b/src/mono/mono/mini/mini-llvm-cpp.cpp index 18db74f8da5e4f..a01db4d29a29fe 100644 --- a/src/mono/mono/mini/mini-llvm-cpp.cpp +++ b/src/mono/mono/mini/mini-llvm-cpp.cpp @@ -720,7 +720,11 @@ mono_llvm_register_intrinsic (LLVMModuleRef module, IntrinsicId id, LLVMTypeRef auto intrins_id = get_intrins_id (id); if (intrins_id != not_intrinsic) { +#if LLVM_API_VERSION >= 2100 + Function *f = Intrinsic::getOrInsertDeclaration (unwrap (module), intrins_id); +#else Function *f = Intrinsic::getDeclaration (unwrap (module), intrins_id); +#endif if (!f) { outs () << id << "\n"; g_assert_not_reached (); @@ -748,7 +752,11 @@ mono_llvm_register_overloaded_intrinsic (LLVMModuleRef module, IntrinsicId id, L Type *arr [max_types]; for (int i = 0; i < ntypes; ++i) arr [i] = unwrap (types [i]); +#if LLVM_API_VERSION >= 2100 + auto f = Intrinsic::getOrInsertDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); +#else auto f = Intrinsic::getDeclaration (unwrap (module), intrins_id, { arr, (size_t)ntypes }); +#endif auto type = Intrinsic::getType (unwrap (module)->getContext (), intrins_id, { arr, (size_t)ntypes }); *out_type = wrap (type); return wrap (f); diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 0fad7c29a9c4c4..b8ca295a11b144 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -30,6 +30,16 @@ #define __STDC_CONSTANT_MACROS #endif +// Mono's LLVM backend uses the global-context LLVM-C type accessors (LLVMInt32Type, etc.) +// pervasively. These are deprecated in newer LLVM versions in favor of the *InContext variants. +// Suppress the deprecation warnings rather than threading an LLVMContextRef through every call site. +#if defined(__clang__) || defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif +#ifdef _MSC_VER +#pragma warning(disable:4996) +#endif + #include "llvm-c/Core.h" #include "llvm-c/BitWriter.h" #include "llvm-c/Analysis.h" From b6e6b73d3b28581212fe92767446275483db7da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 12:57:43 +0200 Subject: [PATCH 08/55] Don't mark Browser as LowTemporalResolution anymore --- .../tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index d1205dc6ba7148..6cbe1a949ca607 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -19,7 +19,7 @@ public abstract class BaseGetSetTimes : FileSystemTest protected static bool isHFS => driveFormat != null && driveFormat.Equals(HFS, StringComparison.InvariantCultureIgnoreCase); - protected static bool LowTemporalResolution => PlatformDetection.IsBrowser || isHFS; + protected static bool LowTemporalResolution => isHFS; protected static bool HighTemporalResolution => !LowTemporalResolution; private static void CheckHighTemporalResolution() From 4113f8e52586234464f2d00d6846d62c13eb3453 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:20 +0200 Subject: [PATCH 09/55] don't node flush streams in a browser --- src/mono/browser/runtime/loader/exit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/browser/runtime/loader/exit.ts b/src/mono/browser/runtime/loader/exit.ts index b57d06b993cc48..bfddfbf3f29097 100644 --- a/src/mono/browser/runtime/loader/exit.ts +++ b/src/mono/browser/runtime/loader/exit.ts @@ -204,6 +204,7 @@ function set_exit_code_and_quit_now (exit_code: number, reason?: any): void { } async function flush_node_streams () { + if (!ENVIRONMENT_IS_NODE) return; try { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: From fa8db40e4e2a6f9f2544d9f632a4086584bf9daa Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:56 +0200 Subject: [PATCH 10/55] export memory from Module --- eng/native.wasm.targets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index 8b86ba9b2df243..a34f0bce2fea24 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -55,6 +55,16 @@ + + + + + + + + + + From 89d50f1128d4f2aa174beb14d06a5ef9da52badf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 19:25:39 +0200 Subject: [PATCH 11/55] [mono][llvm] Fix sign-extension bug in const_int8/const_int32 When passing a negative C int to LLVMConstInt, the value is implicitly converted to unsigned long long via sign-extension. In LLVM 23, LLVMConstInt now retains those upper bits when SignExtend is FALSE, which broke constant folding of subsequent ZExt instructions (e.g. 'zext i32 -1 to i64' produced i64 -1 instead of i64 4294967295). This manifested as wrong results for decimal arithmetic in mono+LLVM AOT, e.g. the inlined Decimal..ctor(uint) with a constant argument sign-extending to _lo64. Many CoreLib tests (System.Tests.DecimalTests, System.Text.Tests.RuneTests, Vector128.NarrowWithSaturation*) were failing as a result. Mask the value to the destination width before passing to LLVMConstInt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/mono/mono/mini/mini-llvm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index b8ca295a11b144..a14802d61b2545 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -568,13 +568,19 @@ const_int1 (int v) static LLVMValueRef const_int8 (int v) { - return LLVMConstInt (LLVMInt8Type (), v, FALSE); + /* Mask to 8 bits so a negative int is not implicitly sign-extended via + * the (unsigned long long) parameter conversion. Starting with LLVM 23, + * LLVMConstInt retains the upper bits when SignExtend is FALSE, which + * caused constant folding of subsequent ZExt to produce wrong results + * (e.g. zext i8 -1 to i64 yielding -1 instead of 255). */ + return LLVMConstInt (LLVMInt8Type (), (guint8)v, FALSE); } static LLVMValueRef const_int32 (int v) { - return LLVMConstInt (LLVMInt32Type (), v, FALSE); + /* See const_int8 for why we mask. */ + return LLVMConstInt (LLVMInt32Type (), (guint32)v, FALSE); } static LLVMValueRef From 64eaad9ed0110015f3c61739516bf42034cf3bc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 20:05:31 +0200 Subject: [PATCH 12/55] Update llvm --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 468c756144805f..8c72d7b5dee5cf 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 - 23.1.0-alpha.1.26261.2 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26312.1 11.0.0-alpha.1.26279.1 11.0.0-alpha.1.26279.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index d89a3b753fa61d..70ab1de18ed779 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 - + https://github.com/dotnet/llvm-project - 0b467a806dc5812f978c1a9e3c5ab3f49417d48b + 20fe1e08459611d5b9bf0348ba65476d444c8933 https://github.com/dotnet/dotnet From 3bcf4d0407494dab5c17593ce9d8b2449e26f296 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:50:02 +0200 Subject: [PATCH 13/55] balance clearTimeout --- src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts | 1 + src/mono/browser/runtime/scheduling.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts index d0d503db4d5ceb..d11c2834828368 100644 --- a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts +++ b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts @@ -23,6 +23,7 @@ export function collectGcDump (options?:DiagnosticCommandOptions):Promise { stopSent = true; diff --git a/src/mono/browser/runtime/scheduling.ts b/src/mono/browser/runtime/scheduling.ts index 93dde2a5525281..1a374630d3d18e 100644 --- a/src/mono/browser/runtime/scheduling.ts +++ b/src/mono/browser/runtime/scheduling.ts @@ -70,18 +70,19 @@ export function SystemJS_ScheduleTimerImpl (shortestDueTimeMs: number): void { if (lastScheduledTimeoutId) { globalThis.clearTimeout(lastScheduledTimeoutId); lastScheduledTimeoutId = undefined; + Module.runtimeKeepalivePop(); } lastScheduledTimeoutId = Module.safeSetTimeout(mono_wasm_schedule_timer_tick, shortestDueTimeMs); } function mono_wasm_schedule_timer_tick () { if (WasmEnableThreads) return; + lastScheduledTimeoutId = undefined; Module.maybeExit(); forceThreadMemoryViewRefresh(); if (!loaderHelpers.is_runtime_running()) { return; } - lastScheduledTimeoutId = undefined; try { cwraps.mono_wasm_execute_timer(); } catch (ex) { From 0dab167d17a670eac27902b56db8af048ad4df6c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 22:22:52 +0200 Subject: [PATCH 14/55] balance runtimeKeepalivePop --- src/mono/browser/runtime/startup.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index c086c6b7c4bb6e..8f0887c90ef81a 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -291,7 +291,6 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc await mono_wasm_after_user_runtime_initialized(); endMeasure(mark, MeasuredBlock.onRuntimeInitialized); } catch (err) { - Module.runtimeKeepalivePop(); mono_log_error("onRuntimeInitializedAsync() failed", err); loaderHelpers.mono_exit(1, err); throw err; From 5ad201d14a0a9d809056e05e71063ffdc127b509 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 19:53:10 +0200 Subject: [PATCH 15/55] WASM_BIGINT=0 for node testing --- src/coreclr/hosts/corerun/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 93909d44fe034c..23c950a564ef83 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -97,11 +97,6 @@ else() -Wl,--error-limit=0) if (CORERUN_IN_BROWSER) - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. - target_link_options(corerun PRIVATE - -sWASM_BIGINT=1) - # Include the virtual file system data for the # browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") @@ -110,6 +105,10 @@ else() --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() + # Node.js doesn't have good support for WASM_BIGINT + # so it only is added when running in the browser. + target_link_options(corerun PRIVATE + -sWASM_BIGINT=0) # If not running in the browser, add # Node.js file system support. target_link_options(corerun PRIVATE From 8c992afea874db6cc7479eec0853d36775beab8c Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:09:14 +0200 Subject: [PATCH 16/55] fix WasmEnableExceptionHandling=false --- src/mono/browser/build/BrowserWasmApp.targets | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index ea0b33bb83ebeb..7fc58f51f13d0d 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -38,7 +38,8 @@ <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions - <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">-msimd128 + + <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128 <_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.native.wasm @@ -178,6 +179,10 @@ <_EmccCommonFlags Include="$(EmccFlags)" /> <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" /> <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" /> + + <_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 MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" /> From 273e1e18bca92954c54d6f1ac7812a69ff0fffdf Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:09:32 +0200 Subject: [PATCH 17/55] improve sample --- .../sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj b/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj index 815953ebc35a40..365a61629523a8 100644 --- a/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj +++ b/src/mono/sample/wasm/browser-advanced/Wasm.Advanced.Sample.csproj @@ -8,6 +8,8 @@ true true web,worker + false + <_WasmAllowAOTDebug>true -s USE_CLOSURE_COMPILER=1 -s LEGACY_GL_EMULATION=1 -lGL -lSDL -lidbfs.js From 95feacdb34ce7a44fbf62c13faf7ee7f784de8fa Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 22:52:52 +0200 Subject: [PATCH 18/55] Use the standardized Wasm EH proposal (exnref / try_table / throw_ref), not the legacy one --- eng/native/configureplatform.cmake | 2 ++ src/mono/browser/build/BrowserWasmApp.targets | 5 ++++- src/mono/mono/mini/CMakeLists.txt | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index e45fd26203320c..163b68190894ae 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -503,6 +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=0) add_link_options(-Wno-unused-command-line-argument) add_link_options(-Wl,--error-limit=0) @@ -516,6 +517,7 @@ else() add_link_options(-lunwind) add_compile_options(-fwasm-exceptions) + add_compile_options(-sWASM_LEGACY_EXCEPTIONS=0) add_compile_options(-mbulk-memory) add_compile_options(-msimd128) endif() diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 7fc58f51f13d0d..40d9c07a5340a5 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -37,7 +37,8 @@ emcc <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions - <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions + + <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=0 <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128 @@ -185,6 +186,8 @@ <_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=0" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" /> <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" /> diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 23b8d15bf708f1..57e3786f9f1cf8 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -474,10 +474,12 @@ if(HOST_BROWSER) set_target_properties(mono-wasm-eh-js PROPERTIES LINK_FLAGS "-fexceptions") install(TARGETS mono-wasm-eh-js LIBRARY) + # Use the standardized Wasm EH proposal (exnref / try_table / throw_ref), not the legacy one. + # WASM_LEGACY_EXCEPTIONS is a [compile+link] setting, so it must be set on both. 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") - set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions") + 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() From a374f19e018e474c240bb71c18a3edc0954b491d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 12 Jun 2026 23:06:59 +0200 Subject: [PATCH 19/55] Refine comments regarding millisecond granularity support Updated comments to clarify that OSX HFS driver format does not support millisecond granularity. --- .../tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index 6cbe1a949ca607..0cc91d011a301e 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -83,7 +83,6 @@ private void SettingUpdatesPropertiesCore(T item, T? linkTarget = default) bool isLink = linkTarget is not null; // Checking that milliseconds are not dropped after setter. - // Emscripten drops milliseconds in Browser DateTime dt = new DateTime(2014, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, function.Kind); function.Setter(item, dt); @@ -245,7 +244,7 @@ public void CanGetAllTimesAfterCreation() ValidateSetTimes(item, beforeTime, afterTime); } - [ConditionalFact] // OSX HFS driver format and Browser platform do not support millisec granularity + [ConditionalFact] // OSX HFS driver format does not support millisec granularity public void TimesIncludeMillisecondPart() { CheckHighTemporalResolution(); @@ -283,7 +282,7 @@ public void TimesIncludeMillisecondPart_LowTempRes() { CheckLowTemporalResolution(); T item = GetExistingItem(); - // OSX HFS driver format and Browser do not support millisec granularity + // OSX HFS driver format does not support millisec granularity Assert.All(TimeFunctions(), (function) => { DateTime time = function.Getter(item); From 696eb47643b0e9664d17b9832d241d9c2222b1ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 13 Jun 2026 11:37:36 +0200 Subject: [PATCH 20/55] [mono][llvm] Fix sign-extension bug in emit_div_check and il_state init LLVMConstInt(IntTy, N, FALSE) requires N to fit in IntTy's unsigned width (i.e. no bits set beyond IntTy's bit count). Passing -1 (= 0xFF..FF as unsigned long long) to a sub-64-bit type violates this. Under LLVM 23 the resulting constant is wrong, which in emit_div_check caused the rhs == -1 comparison to constant-fold to false and the OverflowException check for INT_MIN / -1 and INT_MIN % -1 to be eliminated by the optimizer. Use LLVMConstAllOnes() which is the LLVM C API's idiomatic way to build an all-ones constant of any integer width, sidestepping the issue. Also fix the same pattern in emit_entry_bb where il_state->il_offset is initialized to -1. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/mono/mono/mini/mini-llvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index a14802d61b2545..082c7fb219fda3 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -3826,7 +3826,7 @@ emit_div_check (EmitContext *ctx, LLVMBuilderRef builder, MonoBasicBlock *bb, Mo /* b == -1 && a == 0x80000000 */ if (is_signed) { LLVMValueRef c = (LLVMTypeOf (lhs) == LLVMInt32Type ()) ? LLVMConstInt (LLVMTypeOf (lhs), 0x80000000, FALSE) : LLVMConstInt (LLVMTypeOf (lhs), 0x8000000000000000LL, FALSE); - LLVMValueRef cond1 = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstInt (LLVMTypeOf (rhs), -1, FALSE), ""); + LLVMValueRef cond1 = LLVMBuildICmp (builder, LLVMIntEQ, rhs, LLVMConstAllOnes (LLVMTypeOf (rhs)), ""); LLVMValueRef cond2 = LLVMBuildICmp (builder, LLVMIntEQ, lhs, c, ""); cmp = LLVMBuildICmp (builder, LLVMIntEQ, LLVMBuildAnd (builder, cond1, cond2, ""), LLVMConstInt (LLVMInt1Type (), 1, FALSE), ""); @@ -4369,7 +4369,7 @@ emit_entry_bb (EmitContext *ctx, LLVMBuilderRef builder) index [0] = const_int32 (0); index [1] = const_int32 (1); addr = LLVMBuildGEP2 (builder, il_state_type, ctx->il_state, index, 2, ""); - LLVMBuildStore (ctx->builder, LLVMConstInt (types [1], -1, FALSE), addr); + LLVMBuildStore (ctx->builder, LLVMConstAllOnes (types [1]), addr); /* * Set il_state->data [i] to either the address of the arg/local, or NULL. From 938a82e2ac966ec8ae89d81867a593d3e324d03e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 13 Jun 2026 16:35:06 +0200 Subject: [PATCH 21/55] Update llvm --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index 8c72d7b5dee5cf..ee4c00f01cdcb7 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 - 23.1.0-alpha.1.26312.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26313.1 11.0.0-alpha.1.26279.1 11.0.0-alpha.1.26279.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 70ab1de18ed779..e288e7d47e54ec 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 - + https://github.com/dotnet/llvm-project - 20fe1e08459611d5b9bf0348ba65476d444c8933 + 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 https://github.com/dotnet/dotnet From 53a6d163992d4d016677b73e4f6561b274d6ce5a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 20:50:49 +0200 Subject: [PATCH 22/55] disable WASM_BIGINT for corerun - NodeJS --- docs/workflow/building/coreclr/wasm.md | 3 ++- eng/native.wasm.targets | 5 +++-- src/coreclr/runtime.proj | 12 +++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/workflow/building/coreclr/wasm.md b/docs/workflow/building/coreclr/wasm.md index b2de062d88b066..99dd2911483441 100644 --- a/docs/workflow/building/coreclr/wasm.md +++ b/docs/workflow/building/coreclr/wasm.md @@ -146,7 +146,8 @@ In config below please replace `/path/to/runtime/` by a **absolute unix path** t "/**" ], "runtimeArgs": [ - "--stack-trace-limit=1000" + "--stack-trace-limit=10000", + "--experimental-wasm-exnref" ], "args": [ "HelloWorld.dll" diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a34f0bce2fea24..d40145458ecd7c 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,8 +63,9 @@ - - + + + diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 2c968913b26f4c..a0a11f404243b1 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,7 +15,17 @@ - + + + + + <_WasmDisableBigInt>true + + + From 6860d5c333e189f5b8dd3ade2ae35e940f06f90a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 20:59:26 +0200 Subject: [PATCH 23/55] for nodejs: --experimental-wasm-exnref for wasm-opt: --enable-reference-types --enable-multivalue for runtime default build: new instructions -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 for no-EH runtime:-fexceptions JS exceptions --- eng/testing/WasmRunnerTemplate.cmd | 2 +- eng/testing/WasmRunnerTemplate.sh | 2 +- src/mono/browser/browser.proj | 10 ++++++++++ src/mono/browser/runtime/CMakeLists.txt | 4 ++-- .../wasm/console-node/Wasm.Console.Node.Sample.csproj | 2 +- .../wasm/console-v8/Wasm.Console.V8.Sample.csproj | 2 +- src/mono/sample/wasm/wasm.mk | 6 +++--- src/mono/wasm/build/WasmApp.Common.targets | 4 ++-- 8 files changed, 21 insertions(+), 11 deletions(-) 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/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index b9f72ca324b0fd..50ccb7a426aa63 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -321,6 +321,10 @@ -g -Os -DDEBUG=1 -Oz + + $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationEmccFlags) -fexceptions $(CMakeConfigurationEmccFlags) -s ASSERTIONS=1 -O2 @@ -330,6 +334,9 @@ $(CMakeConfigurationLinkFlags) -msimd128 $(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth $(CMakeConfigurationLinkFlags) --emit-symbol-map + + $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationLinkFlags) -fexceptions -DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/').Replace('\','/'))" @@ -344,6 +351,9 @@ $(CMakeBuildRuntimeConfigureCmd) -DNATIVE_BIN_DIR="$(NativeBinDir.TrimEnd('\/').Replace('\','/'))" $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_COMPILE_OPTIONS="-msimd128" -DCONFIGURATION_INTERPSIMDTABLES_LIB="simd" $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_INTERPSIMDTABLES_LIB="nosimd" + + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EH_LIB="eh-wasm" + $(CMakeBuildRuntimeConfigureCmd) -DCONFIGURATION_EH_LIB="eh-js" $(CMakeBuildRuntimeConfigureCmd) -DDISABLE_THREADS=0 $(CMakeBuildRuntimeConfigureCmd) -DENABLE_JS_INTEROP_BY_VALUE=1 $(CMakeBuildRuntimeConfigureCmd) $(CMakeConfigurationEmsdkPath) diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt index 788707244c11bd..a133f625d40f89 100644 --- a/src/mono/browser/runtime/CMakeLists.txt +++ b/src/mono/browser/runtime/CMakeLists.txt @@ -22,7 +22,7 @@ target_link_libraries(dotnet.native ${MONO_ARTIFACTS_DIR}/libmono-ee-interp.a ${MONO_ARTIFACTS_DIR}/libmonosgen-2.0.a ${MONO_ARTIFACTS_DIR}/libmono-icall-table.a - ${MONO_ARTIFACTS_DIR}/libmono-wasm-eh-js.a + ${MONO_ARTIFACTS_DIR}/libmono-wasm-${CONFIGURATION_EH_LIB}.a ${MONO_ARTIFACTS_DIR}/libmono-wasm-${CONFIGURATION_INTERPSIMDTABLES_LIB}.a ${NATIVE_BIN_DIR}/libSystem.Native.a ${NATIVE_BIN_DIR}/libSystem.Native.TimeZoneData.a @@ -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-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/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 86c53bcec5609c..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))) - - + From d38a699fe740789d2bcd81f64129086532c973c7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 21:00:25 +0200 Subject: [PATCH 24/55] - change wasm exception instructions detection - change jiterp to use new wasm exception instructions --- .../browser/runtime/jiterpreter-jit-call.ts | 31 ++++++++++++------- .../browser/runtime/jiterpreter-opcodes.ts | 7 ++--- .../browser/runtime/jiterpreter-support.ts | 15 ++++++++- src/mono/browser/runtime/loader/globals.ts | 4 +-- src/mono/browser/runtime/startup.ts | 6 ++-- src/mono/browser/runtime/types/internal.ts | 4 +-- 6 files changed, 42 insertions(+), 25 deletions(-) diff --git a/src/mono/browser/runtime/jiterpreter-jit-call.ts b/src/mono/browser/runtime/jiterpreter-jit-call.ts index 3175cc5a758e5a..cbb50e23118633 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,14 @@ 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 + builder.tryTable(WasmValtype.void, "__cpp_exception", 1); // catch __cpp_exception -> $catch + } // Wrapper signature: [thisptr], [&retval], &arg0, ..., &funcdef // Desired stack layout for direct calls: [&retval], [thisptr], arg0, ..., &rgctx @@ -779,9 +783,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 +796,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..2eda8267ca12e0 100644 --- a/src/mono/browser/runtime/jiterpreter-support.ts +++ b/src/mono/browser/runtime/jiterpreter-support.ts @@ -856,6 +856,19 @@ export class WasmBuilder { this.appendU8(WasmOpcode.end); } + // 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, catchTagTypeName: 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.getTypeIndex(catchTagTypeName)); + 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 +1982,7 @@ export type JiterpreterOptions = { enableJitCall: boolean; enableBackwardBranches: boolean; enableCallResume: boolean; - enableWasmEh: boolean; + enableWasmFinalEh: boolean; enableSimd: boolean; enableAtomics: boolean; zeroPageOptimization: boolean; diff --git a/src/mono/browser/runtime/loader/globals.ts b/src/mono/browser/runtime/loader/globals.ts index 98f6dfd30bf24c..379f9e99f40de6 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 8f0887c90ef81a..6a43fbf78e52e4 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 @@ -419,10 +419,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 5412d6292ec6ad..e8af600df33e8f 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, From 65e869af8b7834e2ee8c77bd0ecd5984febecc14 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 21:30:21 +0200 Subject: [PATCH 25/55] bump nodejs --- eng/Version.Details.props | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index ee4c00f01cdcb7..b12b2593e84c7f 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -81,14 +81,14 @@ This file should be imported by eng/Versions.props 23.1.0-alpha.1.26313.1 23.1.0-alpha.1.26313.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 - 11.0.0-alpha.1.26279.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 + 11.0.0-alpha.1.26309.1 1.0.0-prerelease.26276.2 1.0.0-prerelease.26276.2 From 25cf5aed4f34f60930b9dc91d3548d6547058303 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 22:10:55 +0200 Subject: [PATCH 26/55] kg feedback --- src/mono/browser/runtime/jiterpreter-support.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 2eda8267ca12e0..8083478493c81e 100644 --- a/src/mono/browser/runtime/jiterpreter-support.ts +++ b/src/mono/browser/runtime/jiterpreter-support.ts @@ -856,15 +856,24 @@ 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, catchTagTypeName: string, catchLabelDepth: number) { + 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.getTypeIndex(catchTagTypeName)); + this.appendULeb(this.getTagIndex(catchTagName)); // tag index (separate index space from types) this.appendULeb(catchLabelDepth); this.activeBlocks++; } From 09623f552171dca485fb42ee6f5bd8b9bde21d69 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 12:12:18 +0200 Subject: [PATCH 27/55] v8 --experimental-wasm-exnref --- src/mono/browser/build/BrowserWasmApp.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 40d9c07a5340a5..61ea562c3bb8f4 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -474,7 +474,7 @@ From 7f3a8399ae9ea7bf42c4a6c50492cee3fcd84dbe Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 12:25:06 +0200 Subject: [PATCH 28/55] Bump FireFox to 140.11.0esr --- eng/testing/BrowserVersions.props | 8 ++++---- eng/testing/wasm-provisioning.targets | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/testing/BrowserVersions.props b/eng/testing/BrowserVersions.props index 31f40bbf8ba605..45640424f61f2e 100644 --- a/eng/testing/BrowserVersions.props +++ b/eng/testing/BrowserVersions.props @@ -12,9 +12,9 @@ 1625079 https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1625123 14.9.207 - 125.0.1 - 0.34.0 - 125.0.1 - 0.34.0 + 140.11.0esr + 0.37.0 + 140.11.0esr + 0.37.0 \ No newline at end of file diff --git a/eng/testing/wasm-provisioning.targets b/eng/testing/wasm-provisioning.targets index 20e1e00ddef184..b2cb4f1b1a92d9 100644 --- a/eng/testing/wasm-provisioning.targets +++ b/eng/testing/wasm-provisioning.targets @@ -28,7 +28,7 @@ $(ArtifactsBinDir)geckodriver\ - https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.bz2 + https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.xz https://github.com/mozilla/geckodriver/releases/download/v$(linux_GeckoDriverRevision)/geckodriver-v$(linux_GeckoDriverRevision)-linux64.tar.gz firefox geckodriver From 720eeb77043de0df65d82e79241a3d346193b3e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 14:31:32 +0200 Subject: [PATCH 29/55] Update llvm --- eng/Version.Details.props | 58 +++++++++---------- eng/Version.Details.xml | 116 +++++++++++++++++++------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/eng/Version.Details.props b/eng/Version.Details.props index b12b2593e84c7f..f34ee7fa68bc56 100644 --- a/eng/Version.Details.props +++ b/eng/Version.Details.props @@ -51,35 +51,35 @@ This file should be imported by eng/Versions.props 11.0.0-alpha.1.26281.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 - 23.1.0-alpha.1.26313.1 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 + 23.1.0-alpha.1.26314.2 11.0.0-alpha.1.26309.1 11.0.0-alpha.1.26309.1 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e288e7d47e54ec..b3889d271f5f9f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -5,37 +5,37 @@ https://github.com/dotnet/icu d94093d6935a845e9a508e023ae1a94102a801b6 - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c https://github.com/dotnet/dotnet @@ -175,89 +175,89 @@ https://github.com/dotnet/runtime-assets 0dfda3e1e2da87cd6637ecb40e40a4fb6782a505 - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c - + https://github.com/dotnet/llvm-project - 7def0d4c3eecf15a2f7509ea4688912a93a62ee2 + 921a6f0c606b4504c5d221aede62d4e35339ec1c https://github.com/dotnet/dotnet From 3f12bfc4619d284a5b92515accd4d5347565efbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sat, 13 Jun 2026 19:49:16 +0200 Subject: [PATCH 30/55] [mono][llvm] Sign-extend OP_COMPARE_IMM immediate to pointer width When IntPtrType() is i32 (wasm32) and ins->inst_imm is a negative target_mgreg_t (gint32), the implicit conversion to unsigned long long sign-extends to 0xFFFFFFFFXXXXXXXX. LLVM 23 made ConstantInt::get strict by default about values outside the target type's unsigned width, so passing such a value with SignExtend=FALSE silently produces a malformed ConstantInt in release builds (and asserts in debug builds), miscompiling comparisons against negative immediates. This path is reachable on wasm32 from the long-to-bounded-int overflow checks emitted by decompose.c (OP_LCONV_TO_OVF_I1/I2 and friends), which emit OP_COMPARE_IMM with inst_imm=-1. Pass SignExtend=TRUE so signed inst_imm values are correctly extended to whatever width IntPtrType() resolves to on the target. --- src/mono/mono/mini/mini-llvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/mono/mini/mini-llvm.c b/src/mono/mono/mini/mini-llvm.c index 082c7fb219fda3..7c87297671bf8a 100644 --- a/src/mono/mono/mini/mini-llvm.c +++ b/src/mono/mono/mini/mini-llvm.c @@ -6406,7 +6406,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) cmp = LLVMBuildICmp (builder, llvm_pred, lhs, LLVMConstNull (LLVMTypeOf (lhs)), ""); } else { - cmp = LLVMBuildICmp (builder, llvm_pred, convert (ctx, lhs, IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), ""); + cmp = LLVMBuildICmp (builder, llvm_pred, convert (ctx, lhs, IntPtrType ()), LLVMConstInt (IntPtrType (), ins->inst_imm, TRUE), ""); } } else if (ins->opcode == OP_LCOMPARE_IMM) { cmp = LLVMBuildICmp (builder, cond_to_llvm_cond [rel], lhs, rhs, ""); From e844864587091191d6b1b67235d47624a6e979cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 12:24:36 +0200 Subject: [PATCH 31/55] Patch WABT dotnet-install script so it can install the CI build --- .../Sdk/WorkloadTesting.Core.targets | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index c8a742387b7183..8f160c76328786 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -84,6 +84,13 @@ Retries="3" Condition="!Exists($(_DotNetInstallScriptPath))"/> + + + + + + + From 42c178c2b3f2ad55f677386eea04445fd3ec2ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 14:49:02 +0200 Subject: [PATCH 32/55] Log output of HasNonZeroNanoseconds --- .../System.IO.FileSystem.Tests/File/GetSetTimes.cs | 2 +- .../FileInfo/GetSetTimes.cs | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs index 566d52cf35058d..36ebfbfe046a8f 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs @@ -153,7 +153,7 @@ public void SetLastWriteTimeTicks() Assert.True(firstFileTicks <= secondFileTicks, $"First File Ticks\t{firstFileTicks}\nSecond File Ticks\t{secondFileTicks}"); } - [ConditionalFact(typeof(File_GetSetTimes), nameof(HighTemporalResolution))] // OSX HFS driver format/Browser Platform do not support nanosecond granularity. + [ConditionalFact(typeof(File_GetSetTimes), nameof(HighTemporalResolution))] // OSX HFS driver format does not support nanosecond granularity. public void SetUptoNanoseconds() { string file = GetTestFilePath(); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs index 8f6000cf957787..03b6dcbb94996a 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs @@ -60,7 +60,7 @@ public FileInfo GetNonZeroNanoseconds() fileinfo.LastWriteTime = dt; } - Assert.True(HasNonZeroNanoseconds(fileinfo.LastWriteTime)); + Assert.True(HasNonZeroNanoseconds(fileinfo.LastWriteTime), "Expected non-zero nanoseconds, got: " + fileinfo.LastWriteTime.Ticks); return fileinfo; } @@ -140,7 +140,7 @@ public void CopyToNanosecondsPresent() output = input.CopyTo(output.FullName, true); Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); - Assert.True(HasNonZeroNanoseconds(output.LastWriteTime)); + Assert.True(HasNonZeroNanoseconds(output.LastWriteTime), "Expected non-zero nanoseconds, got: " + output.LastWriteTime.Ticks); } [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] @@ -153,13 +153,8 @@ public void CopyToNanosecondsPresent_LowTempRes() output.Directory.Create(); output = input.CopyTo(output.FullName, true); - // On Browser, we sometimes see a difference of exactly 10M, eg., - // Expected: 637949564520000000 - // Actual: 637949564530000000 - double tolerance = PlatformDetection.IsBrowser ? 10_000_000 : 0; - - Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks, tolerance); - Assert.False(HasNonZeroNanoseconds(output.LastWriteTime)); + Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); + Assert.False(HasNonZeroNanoseconds(output.LastWriteTime), "Expected zero nanoseconds, got: " + output.LastWriteTime.Ticks); } [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] From 2d47b4c63a9a2c8b40fd4e69da45bb625eca4f0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 14:53:37 +0200 Subject: [PATCH 33/55] Reenable some tests now that emscripten 3.1.74+ supports distinct file atime/mtime/ctime --- .../System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs | 1 - .../tests/System.IO.FileSystem.Tests/File/Copy.cs | 10 +--------- .../System.IO.FileSystem.Tests/File/GetSetTimes.cs | 2 -- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index 0cc91d011a301e..7af200ac203af9 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -180,7 +180,6 @@ public void SettingPropertiesOnSymlink(bool targetExists) } [Fact] - [PlatformSpecific(~TestPlatforms.Browser)] // Browser is excluded as there is only 1 effective time store. public void SettingUpdatesPropertiesAfterAnother() { T item = GetExistingItem(); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs index a3a8c7526bd045..bfe2dd3040937b 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/Copy.cs @@ -142,15 +142,7 @@ public void CopyFileWithData(char[] data, bool readOnly) } // Ensure last write/access time on the new file is appropriate - // - // For browser, there is technically only 1 time. It's the max - // of LastWrite and LastAccess. On browser, File.SetLastWriteTime - // overwrites LastWrite and LastAccess, and File.Copy - // overwrites LastWrite , so this check doesn't apply. - if (PlatformDetection.IsNotBrowser) - { - Assert.InRange(File.GetLastWriteTimeUtc(testFileDest), lastWriteTime.AddSeconds(-1), lastWriteTime.AddSeconds(1)); - } + Assert.InRange(File.GetLastWriteTimeUtc(testFileDest), lastWriteTime.AddSeconds(-1), lastWriteTime.AddSeconds(1)); Assert.Equal(readOnly, (File.GetAttributes(testFileDest) & FileAttributes.ReadOnly) != 0); if (readOnly) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs index 36ebfbfe046a8f..f238f5e37a2e8b 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs @@ -138,7 +138,6 @@ public override IEnumerable TimeFunctions(bool requiresRoundtrippi } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/83197", TestPlatforms.Browser)] public void SetLastWriteTimeTicks() { string firstFile = GetTestFilePath(); @@ -185,7 +184,6 @@ public void SetDateTimeMax() } [Fact] - [ActiveIssue("https://github.com/dotnet/runtime/issues/83197", TestPlatforms.Browser)] public void SetLastAccessTimeTicks() { string firstFile = GetTestFilePath(); From d9a5256b126ef4b3e80b605a2770c138c672c1c2 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:56 +0200 Subject: [PATCH 34/55] export memory from Module (cherry picked from commit fa8db40e4e2a6f9f2544d9f632a4086584bf9daa) --- eng/native.wasm.targets | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index 5c1238f58dc590..a61e4863d08d6b 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -55,6 +55,16 @@ + + + + + + + + + + From a7a8e0db115d971b81d3cfefcfe0e5842cffd5ad Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 17:34:20 +0200 Subject: [PATCH 35/55] don't node flush streams in a browser (cherry picked from commit 4113f8e52586234464f2d00d6846d62c13eb3453) --- src/mono/browser/runtime/loader/exit.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mono/browser/runtime/loader/exit.ts b/src/mono/browser/runtime/loader/exit.ts index b57d06b993cc48..bfddfbf3f29097 100644 --- a/src/mono/browser/runtime/loader/exit.ts +++ b/src/mono/browser/runtime/loader/exit.ts @@ -204,6 +204,7 @@ function set_exit_code_and_quit_now (exit_code: number, reason?: any): void { } async function flush_node_streams () { + if (!ENVIRONMENT_IS_NODE) return; try { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore: From 0aea51d6c7d7c687fcb8ed3be2f5deeb910012ff Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 19:53:10 +0200 Subject: [PATCH 36/55] WASM_BIGINT=0 for node testing (cherry picked from commit 5ad201d14a0a9d809056e05e71063ffdc127b509) --- src/coreclr/hosts/corerun/CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 8a7b70e7a915ac..d4a764d47317a5 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -98,11 +98,6 @@ else() -Wl,--error-limit=0) if (CORERUN_IN_BROWSER) - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. - target_link_options(corerun PRIVATE - -sWASM_BIGINT=1) - # Include the virtual file system data for the # browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") @@ -111,6 +106,10 @@ else() --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() + # Node.js doesn't have good support for WASM_BIGINT + # so it only is added when running in the browser. + target_link_options(corerun PRIVATE + -sWASM_BIGINT=0) # If not running in the browser, add # Node.js file system support. target_link_options(corerun PRIVATE From 3a24a58247476ebf17c8e7d5da9a94461c222a22 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 22:22:52 +0200 Subject: [PATCH 37/55] balance runtimeKeepalivePop (cherry picked from commit 0dab167d17a670eac27902b56db8af048ad4df6c) --- src/mono/browser/runtime/startup.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index c086c6b7c4bb6e..8f0887c90ef81a 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -291,7 +291,6 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc await mono_wasm_after_user_runtime_initialized(); endMeasure(mark, MeasuredBlock.onRuntimeInitialized); } catch (err) { - Module.runtimeKeepalivePop(); mono_log_error("onRuntimeInitializedAsync() failed", err); loaderHelpers.mono_exit(1, err); throw err; From c9fa6124f7599708e4687fec3eecb541a6578662 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Fri, 12 Jun 2026 21:50:02 +0200 Subject: [PATCH 38/55] balance clearTimeout (cherry picked from commit 3bcf4d0407494dab5c17593ce9d8b2449e26f296) --- src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts | 1 + src/mono/browser/runtime/scheduling.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts index d0d503db4d5ceb..d11c2834828368 100644 --- a/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts +++ b/src/mono/browser/runtime/diagnostics/dotnet-gcdump.ts @@ -23,6 +23,7 @@ export function collectGcDump (options?:DiagnosticCommandOptions):Promise { stopSent = true; diff --git a/src/mono/browser/runtime/scheduling.ts b/src/mono/browser/runtime/scheduling.ts index 93dde2a5525281..1a374630d3d18e 100644 --- a/src/mono/browser/runtime/scheduling.ts +++ b/src/mono/browser/runtime/scheduling.ts @@ -70,18 +70,19 @@ export function SystemJS_ScheduleTimerImpl (shortestDueTimeMs: number): void { if (lastScheduledTimeoutId) { globalThis.clearTimeout(lastScheduledTimeoutId); lastScheduledTimeoutId = undefined; + Module.runtimeKeepalivePop(); } lastScheduledTimeoutId = Module.safeSetTimeout(mono_wasm_schedule_timer_tick, shortestDueTimeMs); } function mono_wasm_schedule_timer_tick () { if (WasmEnableThreads) return; + lastScheduledTimeoutId = undefined; Module.maybeExit(); forceThreadMemoryViewRefresh(); if (!loaderHelpers.is_runtime_running()) { return; } - lastScheduledTimeoutId = undefined; try { cwraps.mono_wasm_execute_timer(); } catch (ex) { From 2f3d9c274dba1027ff70561082ae94eeb9702bb5 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sat, 13 Jun 2026 20:50:49 +0200 Subject: [PATCH 39/55] disable WASM_BIGINT for corerun - NodeJS (cherry picked from commit 53a6d163992d4d016677b73e4f6561b274d6ce5a) --- docs/workflow/building/coreclr/wasm.md | 3 ++- eng/native.wasm.targets | 5 +++-- src/coreclr/runtime.proj | 12 +++++++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/workflow/building/coreclr/wasm.md b/docs/workflow/building/coreclr/wasm.md index b2de062d88b066..99dd2911483441 100644 --- a/docs/workflow/building/coreclr/wasm.md +++ b/docs/workflow/building/coreclr/wasm.md @@ -146,7 +146,8 @@ In config below please replace `/path/to/runtime/` by a **absolute unix path** t "/**" ], "runtimeArgs": [ - "--stack-trace-limit=1000" + "--stack-trace-limit=10000", + "--experimental-wasm-exnref" ], "args": [ "HelloWorld.dll" diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a61e4863d08d6b..a162ba21910ef6 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,8 +63,9 @@ - - + + + diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 2c968913b26f4c..a0a11f404243b1 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,7 +15,17 @@ - + + + + + <_WasmDisableBigInt>true + + + From 549e9fdbd7c574c0fe8bb6475757fa619125bce6 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 12:25:06 +0200 Subject: [PATCH 40/55] Bump FireFox to 140.11.0esr (cherry picked from commit 7f3a8399ae9ea7bf42c4a6c50492cee3fcd84dbe) --- eng/testing/BrowserVersions.props | 8 ++++---- eng/testing/wasm-provisioning.targets | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/testing/BrowserVersions.props b/eng/testing/BrowserVersions.props index 31f40bbf8ba605..45640424f61f2e 100644 --- a/eng/testing/BrowserVersions.props +++ b/eng/testing/BrowserVersions.props @@ -12,9 +12,9 @@ 1625079 https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/1625123 14.9.207 - 125.0.1 - 0.34.0 - 125.0.1 - 0.34.0 + 140.11.0esr + 0.37.0 + 140.11.0esr + 0.37.0 \ No newline at end of file diff --git a/eng/testing/wasm-provisioning.targets b/eng/testing/wasm-provisioning.targets index 20e1e00ddef184..b2cb4f1b1a92d9 100644 --- a/eng/testing/wasm-provisioning.targets +++ b/eng/testing/wasm-provisioning.targets @@ -28,7 +28,7 @@ $(ArtifactsBinDir)geckodriver\ - https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.bz2 + https://ftp.mozilla.org/pub/firefox/releases/$(linux_FirefoxRevision)/linux-x86_64/en-US/firefox-$(linux_FirefoxRevision).tar.xz https://github.com/mozilla/geckodriver/releases/download/v$(linux_GeckoDriverRevision)/geckodriver-v$(linux_GeckoDriverRevision)-linux64.tar.gz firefox geckodriver From b37867bf7f0ba7b1667bdf11409005d3afc6d566 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 15:28:35 +0200 Subject: [PATCH 41/55] feedback --- src/mono/browser/runtime/jiterpreter-support.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 8083478493c81e..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"); @@ -2038,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", From 26fc32bbe91445f056b5e5c7dbb8c8c7295ed140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 15:26:30 +0200 Subject: [PATCH 42/55] Revert eng/common changes, these are unrelated --- eng/common/SetupNugetSources.ps1 | 5 ---- eng/common/SetupNugetSources.sh | 5 ---- .../core-templates/job/helix-job-monitor.yml | 2 +- eng/common/core-templates/job/job.yml | 6 ----- .../steps/enable-internal-sources.yml | 24 ----------------- eng/common/cross/build-rootfs.sh | 10 +++---- .../native/LocateNativeCompiler.targets | 27 ------------------- eng/common/templates/job/job.yml | 5 ++++ eng/common/templates/vmr-build-pr.yml | 2 +- 9 files changed, 10 insertions(+), 76 deletions(-) delete mode 100644 eng/common/native/LocateNativeCompiler.targets diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 58002808bc841a..fc8d618014e0da 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -32,11 +32,6 @@ $ErrorActionPreference = "Stop" Set-StrictMode -Version 2.0 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -# This script only consumes helper functions from tools.ps1 to configure NuGet feeds. -# Skip importing configure-toolset.ps1 so that repo-specific toolset setup (e.g. acquiring -# a bootstrap SDK) is not triggered as a side effect of feed configuration. -$disableConfigureToolsetImport = $true - . $PSScriptRoot\tools.ps1 # Adds or enables the package source with the given name diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index 67e7e0942ca14e..b97cc536379dfe 100755 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -40,11 +40,6 @@ while [[ -h "$source" ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -# This script only consumes helper functions from tools.sh to configure NuGet feeds. -# Skip importing configure-toolset.sh so that repo-specific toolset setup (e.g. acquiring -# a bootstrap SDK) is not triggered as a side effect of feed configuration. -disable_configure_toolset_import=1 - . "$scriptroot/tools.sh" if [ ! -f "$ConfigFile" ]; then diff --git a/eng/common/core-templates/job/helix-job-monitor.yml b/eng/common/core-templates/job/helix-job-monitor.yml index a8162c51166735..767450da2fcb03 100644 --- a/eng/common/core-templates/job/helix-job-monitor.yml +++ b/eng/common/core-templates/job/helix-job-monitor.yml @@ -170,7 +170,7 @@ jobs: toolArgs=( --helix-base-uri '${{ parameters.helixBaseUri }}' --polling-interval-seconds '${{ parameters.pollingIntervalSeconds }}' - --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 5))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. + --max-wait-minutes "$((${{ parameters.timeoutInMinutes }} - 2))" # Set the tool's timeout slightly lower than the Azure DevOps job timeout to allow it to exit gracefully. --stage-name '$(System.StageName)' ) diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index cb60f5297844a4..66c7988f222a65 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -75,12 +75,6 @@ jobs: variables: - name: AllowPtrToDetectTestRunRetryFiles value: true - # Component Governance detection and CodeQL are not run in the public project - - ${{ if eq(variables['System.TeamProject'], 'public') }}: - - name: skipComponentGovernanceDetection - value: true - - name: Codeql.SkipTaskAutoInjection - value: true - ${{ if ne(parameters.enableTelemetry, 'false') }}: - name: DOTNET_CLI_TELEMETRY_PROFILE value: '$(Build.Repository.Uri)' diff --git a/eng/common/core-templates/steps/enable-internal-sources.yml b/eng/common/core-templates/steps/enable-internal-sources.yml index 51af9a017091ff..4085512b690910 100644 --- a/eng/common/core-templates/steps/enable-internal-sources.yml +++ b/eng/common/core-templates/steps/enable-internal-sources.yml @@ -15,56 +15,32 @@ steps: - ${{ if ne(variables['System.TeamProject'], 'public') }}: - ${{ if ne(parameters.legacyCredential, '') }}: - task: PowerShell@2 - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $Env:Token env: Token: ${{ parameters.legacyCredential }} - - task: Bash@3 - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - displayName: Setup Internal Feeds - inputs: - targetType: inline - script: | - "$(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh" "$(System.DefaultWorkingDirectory)/NuGet.config" "$Token" - env: - Token: ${{ parameters.legacyCredential }} # If running on dnceng (internal project), just use the default behavior for NuGetAuthenticate. # If running on DevDiv, NuGetAuthenticate is not really an option. It's scoped to a single feed, and we have many feeds that # may be added. Instead, we'll use the traditional approach (add cred to nuget.config), but use an account token. - ${{ else }}: - ${{ if eq(variables['System.TeamProject'], 'internal') }}: - task: PowerShell@2 - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config - - task: Bash@3 - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - displayName: Setup Internal Feeds - inputs: - filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh - arguments: $(System.DefaultWorkingDirectory)/NuGet.config - ${{ else }}: - template: /eng/common/templates/steps/get-federated-access-token.yml parameters: federatedServiceConnection: ${{ parameters.nugetFederatedServiceConnection }} outputVariableName: 'dnceng-artifacts-feeds-read-access-token' - task: PowerShell@2 - condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) displayName: Setup Internal Feeds inputs: filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.ps1 arguments: -ConfigFile $(System.DefaultWorkingDirectory)/NuGet.config -Password $(dnceng-artifacts-feeds-read-access-token) - - task: Bash@3 - condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - displayName: Setup Internal Feeds - inputs: - filePath: $(System.DefaultWorkingDirectory)/eng/common/SetupNugetSources.sh - arguments: $(System.DefaultWorkingDirectory)/NuGet.config $(dnceng-artifacts-feeds-read-access-token) # This is required in certain scenarios to install the ADO credential provider. # It installed by default in some msbuild invocations (e.g. VS msbuild), but needs to be installed for others # (e.g. dotnet msbuild). diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 273cae651a2b1e..f06854ccc1865e 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -618,15 +618,15 @@ elif [[ "$__CodeName" == "openbsd" ]]; then [[ -z "$PKG_FILE" ]] && { echo "ERROR: Package $pkg not found"; exit 1; } if [[ "$__hasWget" == 1 ]]; then - wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - + wget -O- "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - else - curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir/usr/local" -xzpf - + curl -SL "$PKG_MIRROR/$PKG_FILE" | tar -C "$__RootfsDir" -xzpf - fi done echo "Creating versionless symlinks for shared libraries..." # Find all versioned .so files and create the base .so symlink - for lib in "$__RootfsDir"/usr/lib/lib*.so.*; do + for lib in "$__RootfsDir/usr/lib/libc++.so."* "$__RootfsDir/usr/lib/libc++abi.so."* "$__RootfsDir/usr/lib/libpthread.so."*; do if [ -f "$lib" ]; then # Extract the filename (e.g., libc++.so.12.0) VERSIONED_NAME=$(basename "$lib") @@ -636,10 +636,6 @@ elif [[ "$__CodeName" == "openbsd" ]]; then ln -sf "$VERSIONED_NAME" "$__RootfsDir/usr/lib/$BASE_NAME" fi done - - echo "Cleaning up unnecessary paths" - # we don't use executables and kernel in rootfs (as we use host's compiler with -sysroot) - rm -rf "$__RootfsDir/usr/share" "$__RootfsDir/usr/bin" elif [[ "$__CodeName" == "illumos" ]]; then mkdir "$__RootfsDir/tmp" pushd "$__RootfsDir/tmp" diff --git a/eng/common/native/LocateNativeCompiler.targets b/eng/common/native/LocateNativeCompiler.targets deleted file mode 100644 index 028b33d944416f..00000000000000 --- a/eng/common/native/LocateNativeCompiler.targets +++ /dev/null @@ -1,27 +0,0 @@ - - - - - clang - $(ROOTFS_DIR) - - - - - - - - $(_CC_LDFLAGS.SubString(0, $(_CC_LDFLAGS.IndexOf(';')))) - <_LDFLAGS>$(_CC_LDFLAGS.SubString($([MSBuild]::Add($(_CC_LDFLAGS.IndexOf(';')), 1)))) - lld - - - diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 85501406a541b6..5e261f34db421b 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -21,6 +21,11 @@ jobs: - ${{ each step in parameters.steps }}: - ${{ step }} + # we don't run CG in public + - ${{ if eq(variables['System.TeamProject'], 'public') }}: + - script: echo "##vso[task.setvariable variable=skipComponentGovernanceDetection]true" + displayName: Set skipComponentGovernanceDetection variable + artifactPublishSteps: - ${{ if ne(parameters.artifacts.publish, '') }}: - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: diff --git a/eng/common/templates/vmr-build-pr.yml b/eng/common/templates/vmr-build-pr.yml index d24de935248a68..2f3694fa13239e 100644 --- a/eng/common/templates/vmr-build-pr.yml +++ b/eng/common/templates/vmr-build-pr.yml @@ -33,7 +33,7 @@ resources: - repository: vmr type: github name: dotnet/dotnet - endpoint: public + endpoint: dotnet ref: refs/heads/main # Set to whatever VMR branch the PR build should insert into stages: From f3240dbfae05789cb54d5b362d390d3f98425c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 15:30:47 +0200 Subject: [PATCH 43/55] Copilot feedback Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/coreclr/hosts/corerun/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index d4a764d47317a5..d2c3373bd258d3 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -106,8 +106,7 @@ else() --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. + # Node.js doesn't have good support for WASM_BIGINT, so disable it for the Node/shell scenario. target_link_options(corerun PRIVATE -sWASM_BIGINT=0) # If not running in the browser, add From 151ecdda752c4a6af606c9de0cf7a248f8645c27 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 15:46:46 +0200 Subject: [PATCH 44/55] improve runtimeKeepalivePop() --- src/mono/browser/runtime/startup.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 8f0887c90ef81a..92bd64d28e5d9a 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -197,6 +197,7 @@ async function preRunAsync (userPreRun: ((module:EmscriptenModule) => void)[]) { } async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:EmscriptenModule) => void) { + let keepAlivePushed = false; try { // wait for previous stage await runtimeHelpers.afterPreRun.promise; @@ -227,7 +228,10 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc setTimeout(maybeSaveInterpPgoTable, (runtimeHelpers.config.interpreterPgoSaveDelay || 15) * 1000); + // this push is un-balanced for short while until runtimeReady = true. Accepted trade-off. Module.runtimeKeepalivePush(); + keepAlivePushed = true; + if (WasmEnableThreads && BuildConfiguration === "Debug" && globalThis.setInterval) globalThis.setInterval(() => { mono_log_info("UI thread is alive!"); }, 3000); @@ -291,6 +295,7 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc await mono_wasm_after_user_runtime_initialized(); endMeasure(mark, MeasuredBlock.onRuntimeInitialized); } catch (err) { + if (keepAlivePushed && !runtimeHelpers.runtimeReady) Module.runtimeKeepalivePop(); mono_log_error("onRuntimeInitializedAsync() failed", err); loaderHelpers.mono_exit(1, err); throw err; From 10a3963b058bbe04129a69c6f23edfe22c26327a Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 15:53:45 +0200 Subject: [PATCH 45/55] WASM_BIGINT feedback --- eng/native.wasm.targets | 5 ++- src/coreclr/hosts/corerun/CMakeLists.txt | 40 +++++++++++++----------- src/coreclr/runtime.proj | 10 ------ 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a162ba21910ef6..a61e4863d08d6b 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,9 +63,8 @@ - - - + + diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index d4a764d47317a5..98add3094ad678 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -79,24 +79,6 @@ else() LINK_DEPENDS "${JS_CORE_RUN};${JS_CORE_RUN_EXTPOST};${JS_SYSTEM_NATIVE_BROWSER};${JS_SYSTEM_BROWSER_UTILS};" LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_CORE_RUN} --extern-post-js ${JS_CORE_RUN_EXTPOST}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") - target_link_options(corerun PRIVATE - -sINITIAL_MEMORY=134217728 - -sMAXIMUM_MEMORY=4294967296 - -sALLOW_MEMORY_GROWTH=1 - -sALLOW_TABLE_GROWTH=1 - -sSTACK_SIZE=5MB - -sMODULARIZE=1 - -sEXPORT_ES6=1 - -sEXIT_RUNTIME=1 - -sEXPORTED_RUNTIME_METHODS=CORERUN,ENV,${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS} - -sEXPORTED_FUNCTIONS=_main,${CMAKE_EMCC_EXPORTED_FUNCTIONS} - -sEXPORT_NAME=createDotnetRuntime - -sENVIRONMENT=node,shell,web - -lexports.js - -Wl,--export=__stack_pointer - -Wl,--export=__coreclr_wasm_rtlrestorecontext_tag - -Wl,--error-limit=0) - if (CORERUN_IN_BROWSER) # Include the virtual file system data for the # browser scenario. @@ -110,12 +92,34 @@ else() # so it only is added when running in the browser. target_link_options(corerun PRIVATE -sWASM_BIGINT=0) + + # remove HEAP64 and HEAPU64 from CMAKE_EMCC_EXPORTED_RUNTIME_METHODS + string(REPLACE "HEAP64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") + string(REPLACE "HEAPU64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") + # If not running in the browser, add # Node.js file system support. target_link_options(corerun PRIVATE -sNODERAWFS=1 -lnodefs.js) endif() + target_link_options(corerun PRIVATE + -sINITIAL_MEMORY=134217728 + -sMAXIMUM_MEMORY=4294967296 + -sALLOW_MEMORY_GROWTH=1 + -sALLOW_TABLE_GROWTH=1 + -sSTACK_SIZE=5MB + -sMODULARIZE=1 + -sEXPORT_ES6=1 + -sEXIT_RUNTIME=1 + -sEXPORTED_RUNTIME_METHODS=CORERUN,ENV,${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS} + -sEXPORTED_FUNCTIONS=_main,${CMAKE_EMCC_EXPORTED_FUNCTIONS} + -sEXPORT_NAME=createDotnetRuntime + -sENVIRONMENT=node,shell,web + -lexports.js + -Wl,--export=__stack_pointer + -Wl,--export=__coreclr_wasm_rtlrestorecontext_tag + -Wl,--error-limit=0) endif() if (CORERUN_IN_BROWSER) diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index a0a11f404243b1..a9021cfde100b8 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -16,16 +16,6 @@ - - - - <_WasmDisableBigInt>true - - - From 0bc6b2292458e16bf627cc3ebd182cb363fc5f7d Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 16:32:43 +0200 Subject: [PATCH 46/55] cleanup --- eng/native.wasm.targets | 1 + src/coreclr/hosts/corerun/CMakeLists.txt | 19 ++++++------------- src/coreclr/runtime.proj | 2 +- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/eng/native.wasm.targets b/eng/native.wasm.targets index a61e4863d08d6b..42f9c581114313 100644 --- a/eng/native.wasm.targets +++ b/eng/native.wasm.targets @@ -63,6 +63,7 @@ + diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 98add3094ad678..582da971ed4bcc 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -80,28 +80,21 @@ else() LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_CORE_RUN} --extern-post-js ${JS_CORE_RUN_EXTPOST}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") if (CORERUN_IN_BROWSER) - # Include the virtual file system data for the - # browser scenario. + # Include the virtual file system data for the browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") if (EXISTS "${WASM_PRELOAD_DIR}") - target_link_options(corerun PRIVATE - --preload-file ${WASM_PRELOAD_DIR}@/) + target_link_options(corerun PRIVATE --preload-file ${WASM_PRELOAD_DIR}@/) endif() else() - # Node.js doesn't have good support for WASM_BIGINT - # so it only is added when running in the browser. - target_link_options(corerun PRIVATE - -sWASM_BIGINT=0) + # Node.js doesn't have good support for WASM_BIGINT, so disable it for the Node/shell. + target_link_options(corerun PRIVATE -sWASM_BIGINT=0) # remove HEAP64 and HEAPU64 from CMAKE_EMCC_EXPORTED_RUNTIME_METHODS string(REPLACE "HEAP64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") string(REPLACE "HEAPU64," "" CMAKE_EMCC_EXPORTED_RUNTIME_METHODS "${CMAKE_EMCC_EXPORTED_RUNTIME_METHODS}") - # If not running in the browser, add - # Node.js file system support. - target_link_options(corerun PRIVATE - -sNODERAWFS=1 - -lnodefs.js) + # Add Node.js host file system support. + target_link_options(corerun PRIVATE -sNODERAWFS=1 -lnodefs.js) endif() target_link_options(corerun PRIVATE -sINITIAL_MEMORY=134217728 diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index a9021cfde100b8..2c968913b26f4c 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,7 +15,7 @@ - + From b65c0a6f2801ee2f43958d9107e4737a4536415c Mon Sep 17 00:00:00 2001 From: Pavel Savara Date: Sun, 14 Jun 2026 16:47:53 +0200 Subject: [PATCH 47/55] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/mono/browser/runtime/startup.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index 92bd64d28e5d9a..25093725766169 100644 --- a/src/mono/browser/runtime/startup.ts +++ b/src/mono/browser/runtime/startup.ts @@ -228,7 +228,7 @@ async function onRuntimeInitializedAsync (userOnRuntimeInitialized: (module:Emsc setTimeout(maybeSaveInterpPgoTable, (runtimeHelpers.config.interpreterPgoSaveDelay || 15) * 1000); - // this push is un-balanced for short while until runtimeReady = true. Accepted trade-off. + // this push is unbalanced for short while until runtimeReady = true. Accepted trade-off. Module.runtimeKeepalivePush(); keepAlivePushed = true; From 2dde4e9cba2e6dd669116aa288007e970767fcc7 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 16:50:03 +0200 Subject: [PATCH 48/55] feedback --- src/coreclr/hosts/corerun/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 582da971ed4bcc..3052680a13e7dc 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -80,6 +80,7 @@ else() LINK_FLAGS "--js-library ${JS_SYSTEM_NATIVE_BROWSER} --js-library ${JS_SYSTEM_BROWSER_UTILS} --js-library ${JS_CORE_RUN} --extern-post-js ${JS_CORE_RUN_EXTPOST}" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}") if (CORERUN_IN_BROWSER) + target_link_options(corerun PRIVATE -sWASM_BIGINT=1) # Include the virtual file system data for the browser scenario. set(WASM_PRELOAD_DIR "${CMAKE_INSTALL_PREFIX}/IL") if (EXISTS "${WASM_PRELOAD_DIR}") From 68e3aef40efb9f4e6d82de9b9441ee39db858f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 17:50:29 +0200 Subject: [PATCH 49/55] Fix item syntax in WriteLinesToFile Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../Sdk/WorkloadTesting.Core.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 8f160c76328786..3a0ee3406f3b7f 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -89,7 +89,7 @@ - + Date: Sun, 14 Jun 2026 18:22:58 +0200 Subject: [PATCH 50/55] Remove obsolete Browser/WASI workaround in SetAccessOrWriteTimeCore Emscripten before 3.1.74 didn't support distinct atime/mtime, so the Browser path set both to the same value. The repo now uses Emscripten 5.0.6, so the workaround is no longer needed and was causing SetLastAccessTime to clobber LastWriteTime (and vice versa). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../src/System/IO/FileStatus.Unix.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs index 4ffd7cd8cd811c..9a54a0cd620022 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileStatus.Unix.cs @@ -394,12 +394,6 @@ private unsafe void SetAccessOrWriteTimeCore(SafeFileHandle? handle, string? pat long seconds = time.ToUnixTimeSeconds(); long nanoseconds = UnixTimeSecondsToNanoseconds(time, seconds); -#if TARGET_BROWSER || TARGET_WASI - buf[0].TvSec = seconds; - buf[0].TvNsec = nanoseconds; - buf[1].TvSec = seconds; - buf[1].TvNsec = nanoseconds; -#else if (isAccessTime) { buf[0].TvSec = seconds; @@ -414,7 +408,6 @@ private unsafe void SetAccessOrWriteTimeCore(SafeFileHandle? handle, string? pat buf[1].TvSec = seconds; buf[1].TvNsec = nanoseconds; } -#endif int rv = handle is not null ? Interop.Sys.FUTimens(handle, buf) : Interop.Sys.UTimensat(path!, buf); From d285468d6d5bd3cf3c6105cfee4052b119eee90f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 18:53:20 +0200 Subject: [PATCH 51/55] Improve handling of various filesystem precisions in tests --- .../Base/BaseGetSetTimes.cs | 43 ++++++++----------- .../File/GetSetTimes.cs | 2 +- .../FileInfo/GetSetTimes.cs | 26 +++++------ 3 files changed, 29 insertions(+), 42 deletions(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs index 7af200ac203af9..762e22ad646e99 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Base/BaseGetSetTimes.cs @@ -11,28 +11,18 @@ namespace System.IO.Tests { public abstract class BaseGetSetTimes : FileSystemTest { - protected const string HFS = "hfs"; public delegate void SetTime(T item, DateTime time); public delegate DateTime GetTime(T item); // AppContainer restricts access to DriveFormat (::GetVolumeInformation) private static string driveFormat = PlatformDetection.IsInAppContainer ? string.Empty : new DriveInfo(Path.GetTempPath()).DriveFormat; - protected static bool isHFS => driveFormat != null && driveFormat.Equals(HFS, StringComparison.InvariantCultureIgnoreCase); + private static bool isHFS => driveFormat != null && driveFormat.Equals("hfs", StringComparison.InvariantCultureIgnoreCase); - protected static bool LowTemporalResolution => isHFS; - protected static bool HighTemporalResolution => !LowTemporalResolution; - - private static void CheckHighTemporalResolution() - { - if (!HighTemporalResolution) - throw new SkipTestException(nameof(HighTemporalResolution)); - } - - private static void CheckLowTemporalResolution() - { - if (!LowTemporalResolution) - throw new SkipTestException(nameof(LowTemporalResolution)); - } + protected static bool SecondTemporalResolution => true; + protected static bool MilliSecondTemporalResolution => SecondTemporalResolution && !isHFS; // HFS only supports temporal resolution of 1 second + protected static bool NanoSecondTemporalResolution => MilliSecondTemporalResolution && !PlatformDetection.IsBrowser; // Browser does not support nanosecond resolution + protected static bool NotMilliSecondTemporalResolution => !MilliSecondTemporalResolution; + protected static bool NotNanoSecondTemporalResolution => !NanoSecondTemporalResolution; protected abstract bool CanBeReadOnly { get; } @@ -83,7 +73,7 @@ private void SettingUpdatesPropertiesCore(T item, T? linkTarget = default) bool isLink = linkTarget is not null; // Checking that milliseconds are not dropped after setter. - DateTime dt = new DateTime(2014, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, function.Kind); + DateTime dt = new DateTime(2014, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, function.Kind); function.Setter(item, dt); T getTarget = !isLink || ApiTargetsLink ? item : linkTarget; @@ -217,9 +207,9 @@ public void SettingUpdatesPropertiesAfterAnother() bool reverse = functions.reverse; // Checking that milliseconds are not dropped after setter. - DateTime dt1 = new DateTime(2002, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, DateTimeKind.Utc); - DateTime dt2 = new DateTime(2001, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, DateTimeKind.Utc); - DateTime dt3 = new DateTime(2000, 12, 1, 12, 3, 3, LowTemporalResolution ? 0 : 321, DateTimeKind.Utc); + DateTime dt1 = new DateTime(2002, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, DateTimeKind.Utc); + DateTime dt2 = new DateTime(2001, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, DateTimeKind.Utc); + DateTime dt3 = new DateTime(2000, 12, 1, 12, 3, 3, NotMilliSecondTemporalResolution ? 0 : 321, DateTimeKind.Utc); if (reverse) //reverse the order of setting dates { (dt1, dt3) = (dt3, dt1); @@ -243,10 +233,12 @@ public void CanGetAllTimesAfterCreation() ValidateSetTimes(item, beforeTime, afterTime); } - [ConditionalFact] // OSX HFS driver format does not support millisec granularity + [ConditionalFact] public void TimesIncludeMillisecondPart() { - CheckHighTemporalResolution(); + if (!MilliSecondTemporalResolution) + throw new SkipTestException(nameof(MilliSecondTemporalResolution)); + T item = GetExistingItem(); Assert.All(TimeFunctions(), (function) => { @@ -277,11 +269,12 @@ public void TimesIncludeMillisecondPart() } [ConditionalFact] - public void TimesIncludeMillisecondPart_LowTempRes() + public void TimesNotIncludeMillisecondPart() { - CheckLowTemporalResolution(); + if (MilliSecondTemporalResolution) + throw new SkipTestException(nameof(MilliSecondTemporalResolution)); + T item = GetExistingItem(); - // OSX HFS driver format does not support millisec granularity Assert.All(TimeFunctions(), (function) => { DateTime time = function.Getter(item); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs index f238f5e37a2e8b..1273a17d538626 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/GetSetTimes.cs @@ -152,7 +152,7 @@ public void SetLastWriteTimeTicks() Assert.True(firstFileTicks <= secondFileTicks, $"First File Ticks\t{firstFileTicks}\nSecond File Ticks\t{secondFileTicks}"); } - [ConditionalFact(typeof(File_GetSetTimes), nameof(HighTemporalResolution))] // OSX HFS driver format does not support nanosecond granularity. + [ConditionalFact(typeof(File_GetSetTimes), nameof(NanoSecondTemporalResolution))] public void SetUptoNanoseconds() { string file = GetTestFilePath(); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs index 03b6dcbb94996a..59d65c7c56f77d 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs @@ -52,9 +52,6 @@ public FileInfo GetNonZeroNanoseconds() if (!HasNonZeroNanoseconds(fileinfo.LastWriteTime)) { - if (PlatformDetection.IsApplePlatform) - return null; - DateTime dt = fileinfo.LastWriteTime; dt = dt.AddTicks(1); fileinfo.LastWriteTime = dt; @@ -113,7 +110,7 @@ public override IEnumerable TimeFunctions(bool requiresRoundtrippi DateTimeKind.Utc); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(HighTemporalResolution))] + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(MilliSecondTemporalResolution))] public void CopyToMillisecondPresent() { FileInfo input = GetNonZeroMilliseconds(); @@ -127,13 +124,10 @@ public void CopyToMillisecondPresent() Assert.NotEqual(0, output.LastWriteTime.Millisecond); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(HighTemporalResolution))] + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NanoSecondTemporalResolution))] public void CopyToNanosecondsPresent() { FileInfo input = GetNonZeroNanoseconds(); - if (input == null) - return; - FileInfo output = new FileInfo(Path.Combine(GetTestFilePath(), input.Name)); output.Directory.Create(); @@ -143,8 +137,8 @@ public void CopyToNanosecondsPresent() Assert.True(HasNonZeroNanoseconds(output.LastWriteTime), "Expected non-zero nanoseconds, got: " + output.LastWriteTime.Ticks); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] - public void CopyToNanosecondsPresent_LowTempRes() + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NotNanoSecondTemporalResolution))] + public void CopyToNanosecondsNotPresent() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); @@ -152,13 +146,13 @@ public void CopyToNanosecondsPresent_LowTempRes() output.Directory.Create(); output = input.CopyTo(output.FullName, true); - + Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); Assert.False(HasNonZeroNanoseconds(output.LastWriteTime), "Expected zero nanoseconds, got: " + output.LastWriteTime.Ticks); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] - public void MoveToMillisecondPresent_LowTempRes() + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NotMilliSecondTemporalResolution))] + public void MoveToMillisecondNotPresent() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); @@ -169,7 +163,7 @@ public void MoveToMillisecondPresent_LowTempRes() Assert.Equal(0, output.LastWriteTime.Millisecond); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(HighTemporalResolution))] + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(MilliSecondTemporalResolution))] public void MoveToMillisecondPresent() { FileInfo input = GetNonZeroMilliseconds(); @@ -180,8 +174,8 @@ public void MoveToMillisecondPresent() Assert.NotEqual(0, output.LastWriteTime.Millisecond); } - [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(LowTemporalResolution))] - public void CopyToMillisecondPresent_LowTempRes() + [ConditionalFact(typeof(FileInfo_GetSetTimes), nameof(NotMilliSecondTemporalResolution))] + public void CopyToMillisecondNotPresent() { FileInfo input = new FileInfo(GetTestFilePath()); input.Create().Dispose(); From 2c60688559dd92f2b91a32de5ac19329c33c65da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 19:07:22 +0200 Subject: [PATCH 52/55] Fix whitespace --- .../tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs index 59d65c7c56f77d..2307287976e805 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileInfo/GetSetTimes.cs @@ -146,7 +146,7 @@ public void CopyToNanosecondsNotPresent() output.Directory.Create(); output = input.CopyTo(output.FullName, true); - + Assert.Equal(input.LastWriteTime.Ticks, output.LastWriteTime.Ticks); Assert.False(HasNonZeroNanoseconds(output.LastWriteTime), "Expected zero nanoseconds, got: " + output.LastWriteTime.Ticks); } From cd4af45488944f810c0d7b60b91acaac113d0ca9 Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 19:21:39 +0200 Subject: [PATCH 53/55] postpone new exception instructions --- eng/native/configureplatform.cmake | 4 +-- eng/testing/WasmRunnerTemplate.cmd | 2 +- eng/testing/WasmRunnerTemplate.sh | 2 +- src/coreclr/runtime.proj | 12 +------ src/mono/browser/browser.proj | 7 ++-- src/mono/browser/build/BrowserWasmApp.targets | 12 ++----- src/mono/browser/runtime/CMakeLists.txt | 2 +- .../browser/runtime/jiterpreter-jit-call.ts | 31 +++++++----------- .../browser/runtime/jiterpreter-opcodes.ts | 7 ++-- .../browser/runtime/jiterpreter-support.ts | 32 +++---------------- src/mono/browser/runtime/loader/globals.ts | 4 +-- src/mono/browser/runtime/startup.ts | 6 ++-- src/mono/browser/runtime/types/internal.ts | 4 +-- src/mono/mono/mini/CMakeLists.txt | 6 ++-- .../Wasm.Console.Node.Sample.csproj | 2 +- .../console-v8/Wasm.Console.V8.Sample.csproj | 2 +- src/mono/sample/wasm/wasm.mk | 6 ++-- src/mono/wasm/build/WasmApp.Common.targets | 4 +-- 18 files changed, 49 insertions(+), 96 deletions(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 163b68190894ae..046d630bc4793f 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=0) + add_link_options(-sWASM_LEGACY_EXCEPTIONS=1) add_link_options(-Wno-unused-command-line-argument) add_link_options(-Wl,--error-limit=0) @@ -517,7 +517,7 @@ else() add_link_options(-lunwind) add_compile_options(-fwasm-exceptions) - add_compile_options(-sWASM_LEGACY_EXCEPTIONS=0) + add_compile_options(-sWASM_LEGACY_EXCEPTIONS=1) add_compile_options(-mbulk-memory) add_compile_options(-msimd128) endif() diff --git a/eng/testing/WasmRunnerTemplate.cmd b/eng/testing/WasmRunnerTemplate.cmd index 0e8b6c9406ee29..463883384bde3d 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 --engine-arg^=--experimental-wasm-exnref" + set "JS_ENGINE_ARGS=--engine-arg^=--stack-trace-limit^=1000" ) ) else ( if /I [%SCENARIO%] == [WasmTestOnChrome] ( diff --git a/eng/testing/WasmRunnerTemplate.sh b/eng/testing/WasmRunnerTemplate.sh index 91fcc162f4fbf4..dc9339e1acdd62 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 --engine-arg=--experimental-wasm-exnref" + JS_ENGINE_ARGS="--engine-arg=--stack-trace-limit=1000" fi else if [[ "$SCENARIO" == "WasmTestOnChrome" || "$SCENARIO" == "wasmtestonchrome" ]]; then diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index a0a11f404243b1..2c968913b26f4c 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -15,17 +15,7 @@ - - - - - <_WasmDisableBigInt>true - - - + diff --git a/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index 50ccb7a426aa63..e466da1f94d169 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -321,9 +321,7 @@ -g -Os -DDEBUG=1 -Oz - - $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationEmccFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1 $(CMakeConfigurationEmccFlags) -fexceptions $(CMakeConfigurationEmccFlags) -s ASSERTIONS=1 @@ -334,8 +332,7 @@ $(CMakeConfigurationLinkFlags) -msimd128 $(CMakeConfigurationLinkFlags) -Wno-pthreads-mem-growth $(CMakeConfigurationLinkFlags) --emit-symbol-map - - $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0 + $(CMakeConfigurationLinkFlags) -fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=1 $(CMakeConfigurationLinkFlags) -fexceptions -DEMSDK_PATH="$(EMSDK_PATH.TrimEnd('\/').Replace('\','/'))" diff --git a/src/mono/browser/build/BrowserWasmApp.targets b/src/mono/browser/build/BrowserWasmApp.targets index 61ea562c3bb8f4..ae5ad942d4d7be 100644 --- a/src/mono/browser/build/BrowserWasmApp.targets +++ b/src/mono/browser/build/BrowserWasmApp.targets @@ -37,9 +37,7 @@ emcc <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' == 'false'">-fexceptions - - <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=0 - + <_WasmDefaultFlags Condition="'$(WasmEnableExceptionHandling)' != 'false'">-fwasm-exceptions -s WASM_LEGACY_EXCEPTIONS=1 <_WasmDefaultFlags Condition="'$(WasmEnableSIMD)' == 'true'">$(_WasmDefaultFlags) -msimd128 <_WasmOutputFileName Condition="'$(WasmSingleFileBundle)' != 'true'">dotnet.native.wasm @@ -180,14 +178,10 @@ <_EmccCommonFlags Include="$(EmccFlags)" /> <_EmccCommonFlags Include="-v" Condition="'$(EmccVerbose)' != 'false'" /> <_EmccCommonFlags Include="-g" Condition="'$(WasmNativeDebugSymbols)' == 'true'" /> - <_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=0" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> + <_EmccCommonFlags Include="-s WASM_LEGACY_EXCEPTIONS=1" Condition="'$(WasmEnableExceptionHandling)' == 'true'" /> <_EmccCommonFlags Include="-s MAXIMUM_MEMORY=$(EmccMaximumHeapSize)" Condition="'$(EmccMaximumHeapSize)' != ''" /> <_EmccIncludePaths Include="$(_WasmIntermediateOutputPath.TrimEnd('\/'))" /> @@ -474,7 +468,7 @@ diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt index a133f625d40f89..25338f761a6006 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-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 + 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 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 cbb50e23118633..3175cc5a758e5a 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.enableWasmFinalEh) { - if (!runtimeHelpers.featureWasmFinalEh) { + if (builder.options.enableWasmEh) { + if (!runtimeHelpers.featureWasmEh) { // The user requested to enable wasm EH but it's not supported, so turn the option back off - applyOptions({ enableWasmFinalEh: false }); - builder.options.enableWasmFinalEh = false; + applyOptions({ enableWasmEh: false }); + builder.options.enableWasmEh = false; } } @@ -639,14 +639,10 @@ function generate_wasm_body ( ): boolean { let stack_index = 0; - // 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 - builder.tryTable(WasmValtype.void, "__cpp_exception", 1); // catch __cpp_exception -> $catch - } + // 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_); // Wrapper signature: [thisptr], [&retval], &arg0, ..., &funcdef // Desired stack layout for direct calls: [&retval], [thisptr], arg0, ..., &rgctx @@ -783,12 +779,9 @@ function generate_wasm_body ( } // If the call threw a JS or wasm exception, set the thrown flag - 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] + if (builder.options.enableWasmEh) { + builder.appendU8(WasmOpcode.catch_); + builder.appendULeb(builder.getTypeIndex("__cpp_exception")); builder.callImport("begin_catch"); builder.callImport("end_catch"); builder.local("thrown"); @@ -796,7 +789,7 @@ function generate_wasm_body ( builder.appendU8(WasmOpcode.i32_store); builder.appendMemarg(0, 2); - builder.endBlock(); // end $outer + builder.endBlock(); } builder.appendU8(WasmOpcode.return_); diff --git a/src/mono/browser/runtime/jiterpreter-opcodes.ts b/src/mono/browser/runtime/jiterpreter-opcodes.ts index 27303091de9d07..4d3ab5c3930f1c 100644 --- a/src/mono/browser/runtime/jiterpreter-opcodes.ts +++ b/src/mono/browser/runtime/jiterpreter-opcodes.ts @@ -81,8 +81,11 @@ export const enum WasmOpcode { if_, else_, - throw_ref = 0x0a, - try_table = 0x1f, + try_ = 0x06, + catch_, + catch_all = 0x19, + throw_ = 0x08, + rethrow_ = 0x09, end = 0x0b, br, diff --git a/src/mono/browser/runtime/jiterpreter-support.ts b/src/mono/browser/runtime/jiterpreter-support.ts index 740a05bb14b4a9..3235406cae7894 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 enableWasmFinalEh = this.getExceptionTag() !== undefined; + const enableWasmEh = this.getExceptionTag() !== undefined; // Import section this.beginSection(2); this.appendULeb( 1 + // memory - (enableWasmFinalEh ? 1 : 0) + // c++ exception tag + (enableWasmEh ? 1 : 0) + // c++ exception tag importsToEmit.length + ((includeFunctionTable !== false) ? 1 : 0) ); @@ -520,7 +520,7 @@ export class WasmBuilder { this.appendULeb(0x01); } - if (enableWasmFinalEh) { + if (enableWasmEh) { // import the c++ exception tag this.appendName("x"); this.appendName("e"); @@ -856,28 +856,6 @@ 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) @@ -1991,7 +1969,7 @@ export type JiterpreterOptions = { enableJitCall: boolean; enableBackwardBranches: boolean; enableCallResume: boolean; - enableWasmFinalEh: boolean; + enableWasmEh: boolean; enableSimd: boolean; enableAtomics: boolean; zeroPageOptimization: boolean; @@ -2038,7 +2016,7 @@ const optionNames: { [jsName: string]: string } = { "enableJitCall": "jiterpreter-jit-call-enabled", "enableBackwardBranches": "jiterpreter-backward-branch-entries-enabled", "enableCallResume": "jiterpreter-call-resume-enabled", - "enableWasmFinalEh": "jiterpreter-wasm-eh-enabled", + "enableWasmEh": "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 379f9e99f40de6..98f6dfd30bf24c 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 { simd, relaxedSimd, exceptionsFinal } from "wasm-feature-detect"; +import { exceptions, simd, relaxedSimd } from "wasm-feature-detect"; import gitHash from "consts:gitHash"; @@ -131,7 +131,7 @@ export function setLoaderGlobals ( isDebuggingSupported, // from wasm-feature-detect npm package - exceptionsFinal, + exceptions, simd, relaxedSimd }; diff --git a/src/mono/browser/runtime/startup.ts b/src/mono/browser/runtime/startup.ts index f978d29202f69c..25093725766169 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.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"); + 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"); } module.mainScriptUrlOrBlob = loaderHelpers.scriptUrl;// this is needed by worker threads @@ -424,10 +424,10 @@ async function instantiate_wasm_module ( async function ensureUsedWasmFeatures () { const simd = loaderHelpers.simd(); const relaxedSimd = loaderHelpers.relaxedSimd(); - const exceptions = loaderHelpers.exceptionsFinal(); + const exceptions = loaderHelpers.exceptions(); runtimeHelpers.featureWasmSimd = await simd; runtimeHelpers.featureWasmRelaxedSimd = await relaxedSimd; - runtimeHelpers.featureWasmFinalEh = await exceptions; + runtimeHelpers.featureWasmEh = 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 e8af600df33e8f..5412d6292ec6ad 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 - exceptionsFinal: () => Promise, + exceptions: () => Promise, simd: () => Promise, relaxedSimd: () => Promise, } @@ -226,7 +226,7 @@ export type RuntimeHelpers = { afterOnRuntimeInitialized: PromiseAndController, afterPostRun: PromiseAndController, - featureWasmFinalEh: boolean, + featureWasmEh: boolean, featureWasmSimd: boolean, featureWasmRelaxedSimd: boolean, diff --git a/src/mono/mono/mini/CMakeLists.txt b/src/mono/mono/mini/CMakeLists.txt index 57e3786f9f1cf8..3b95c60c1f45da 100644 --- a/src/mono/mono/mini/CMakeLists.txt +++ b/src/mono/mono/mini/CMakeLists.txt @@ -474,12 +474,10 @@ if(HOST_BROWSER) set_target_properties(mono-wasm-eh-js PROPERTIES LINK_FLAGS "-fexceptions") install(TARGETS mono-wasm-eh-js LIBRARY) - # Use the standardized Wasm EH proposal (exnref / try_table / throw_ref), not the legacy one. - # WASM_LEGACY_EXCEPTIONS is a [compile+link] setting, so it must be set on both. 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=0") - set_target_properties(mono-wasm-eh-wasm PROPERTIES LINK_FLAGS "-fwasm-exceptions -sWASM_LEGACY_EXCEPTIONS=0") + 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") 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 65301b3087520a..5e9ae0d965fe6f 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 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) --expected-exit-code $(ExpectedExitCode) + $(ExecXHarnessVar) wasm test --app=. --engine=NodeJS --engine-arg=--stack-trace-limit=1000 --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 dfc937e8569bea..cbd591be53286b 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 --engine-arg=--experimental-wasm-exnref --js-file=main.mjs --output-directory=$(XHarnessOutputVar) + $(ExecXHarnessVar) wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=main.mjs --output-directory=$(XHarnessOutputVar) diff --git a/src/mono/sample/wasm/wasm.mk b/src/mono/sample/wasm/wasm.mk index 658d77ead989b4..22db9a0d89fa9e 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 --experimental-wasm-exnref --single-threaded $(MAIN_JS) -- $(ARGS) + cd bin/$(CONFIG)/wwwroot && $(V8_PATH) --stack-trace-limit=1000 --single-threaded $(MAIN_JS) -- $(ARGS) run-console-node: - cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --experimental-wasm-exnref --single-threaded $(MAIN_JS) $(ARGS) + cd bin/$(CONFIG)/wwwroot && node --stack-trace-limit=1000 --single-threaded $(MAIN_JS) $(ARGS) debug-console-node: - 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 + cd bin/$(CONFIG)/wwwroot && node --inspect=9222 --stack-trace-limit=1000 --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 a8e6211aab2741..d154d54a5b5104 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))) - - + From 4a68a477a1b8295894436384a87bc3550a85d90e Mon Sep 17 00:00:00 2001 From: pavelsavara Date: Sun, 14 Jun 2026 19:35:44 +0200 Subject: [PATCH 54/55] apply new exception instructions --- eng/native/configureplatform.cmake | 4 +-- eng/testing/WasmRunnerTemplate.cmd | 2 +- eng/testing/WasmRunnerTemplate.sh | 2 +- src/mono/browser/browser.proj | 4 +-- src/mono/browser/build/BrowserWasmApp.targets | 6 ++-- src/mono/browser/runtime/CMakeLists.txt | 2 +- .../browser/runtime/jiterpreter-jit-call.ts | 31 +++++++++++------- .../browser/runtime/jiterpreter-opcodes.ts | 7 ++-- .../browser/runtime/jiterpreter-support.ts | 32 ++++++++++++++++--- src/mono/browser/runtime/loader/globals.ts | 4 +-- src/mono/browser/runtime/startup.ts | 6 ++-- src/mono/browser/runtime/types/internal.ts | 4 +-- src/mono/mono/mini/CMakeLists.txt | 4 +-- .../Wasm.Console.Node.Sample.csproj | 2 +- .../console-v8/Wasm.Console.V8.Sample.csproj | 2 +- src/mono/sample/wasm/wasm.mk | 6 ++-- src/mono/wasm/build/WasmApp.Common.targets | 4 +-- 17 files changed, 74 insertions(+), 48 deletions(-) diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 046d630bc4793f..163b68190894ae 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) @@ -517,7 +517,7 @@ else() add_link_options(-lunwind) 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/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/src/mono/browser/browser.proj b/src/mono/browser/browser.proj index e466da1f94d169..4fa274c6601cab 100644 --- a/src/mono/browser/browser.proj +++ b/src/mono/browser/browser.proj @@ -321,7 +321,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 @@ -332,7 +332,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.targets b/src/mono/browser/build/BrowserWasmApp.targets index ae5ad942d4d7be..1bdbce99bbeb21 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('\/'))" /> @@ -468,7 +468,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..cbb50e23118633 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,14 @@ 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 + builder.tryTable(WasmValtype.void, "__cpp_exception", 1); // catch __cpp_exception -> $catch + } // Wrapper signature: [thisptr], [&retval], &arg0, ..., &funcdef // Desired stack layout for direct calls: [&retval], [thisptr], arg0, ..., &rgctx @@ -779,9 +783,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 +796,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 98f6dfd30bf24c..379f9e99f40de6 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 25093725766169..f978d29202f69c 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 @@ -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 5412d6292ec6ad..e8af600df33e8f 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))) - - + From c947bf2e61e4546682c3cf1ec1198901351036f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 14 Jun 2026 20:43:46 +0200 Subject: [PATCH 55/55] Fix dotnet-install script replacement --- .../Sdk/WorkloadTesting.Core.targets | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets index 3a0ee3406f3b7f..7fece2463ec34f 100755 --- a/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets +++ b/src/mono/nuget/Microsoft.NET.Runtime.WorkloadTesting.Internal/Sdk/WorkloadTesting.Core.targets @@ -85,11 +85,11 @@ Condition="!Exists($(_DotNetInstallScriptPath))"/> - - - - - + + <_DotNetInstallScriptContent>$([System.IO.File]::ReadAllText('$(_DotNetInstallScriptPath)')) + <_DotNetInstallScriptContent>$(_DotNetInstallScriptContent.Replace('ci.dot.net/public', 'ci.dot.net/dev')) + +