- Notifications
You must be signed in to change notification settings - Fork 5.2k
[release/9.0-staging] [wasm][AOT] fix codegen for small structs on stack #118416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
pavelsavara merged 6 commits into release/9.0-staging from backport/pr-118355-to-release/9.0-staging Aug 24, 2025
Merged
[release/9.0-staging] [wasm][AOT] fix codegen for small structs on stack #118416
pavelsavara merged 6 commits into release/9.0-staging from backport/pr-118355-to-release/9.0-staging Aug 24, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Co-authored-by: Larry Ewing <lewing@microsoft.com>
This was referenced Aug 6, 2025
Open
Contributor
| Tagging subscribers to 'arch-wasm': @lewing |
Member
| /azp run runtime-wasm |
| Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
Member
|
I don't know about packed SIMD, @lewing does it ring any bell ? |
pavelsavara approved these changes Aug 24, 2025
Member
| /ba-g known CI issues for Net9 |
Member
| Validation using System; using System.Collections.Generic; using System.Runtime.InteropServices.JavaScript; using System.Threading.Tasks; using System.Text; using System.Buffers.Text; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; class Program { public static void Main() { Test(new string('\u0009', 1)); Test(new string('\u0009', 3)); Test(new string('\u000A', 1)); Test(new string('\u000A', 3)); Test(new string('\u000D', 1)); Test(new string('\u000D', 3)); Test(new string(' ', 1)); Test(new string(' ', 3)); } [MethodImpl(MethodImplOptions.NoInlining)] public static void Test(string utf8WithByteToBeIgnored){ ReadOnlySpan<char> utf8BytesWithByteToBeIgnored = utf8WithByteToBeIgnored.AsSpan(); bool isValid2 = Base64.IsValid(utf8BytesWithByteToBeIgnored, out int decodedLength); Console.WriteLine($"IsValid2: {isValid2}, DecodedLength: {decodedLength}"); } }<Project Sdk="Microsoft.NET.Sdk.WebAssembly"> <PropertyGroup> <TargetFramework>net9.0</TargetFramework> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <RunAOTCompilation>true</RunAOTCompilation> <WasmNativeDebugSymbols>true</WasmNativeDebugSymbols> <WasmNativeStrip>false</WasmNativeStrip> </PropertyGroup> </Project> |
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Codegen-AOT-mono os-browser Browser variant of arch-wasm Servicing-approved Approved for servicing release
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.

Backport of #118355 to release/9.0-staging
/cc @lewing @pavelsavara
Customer Impact
Fixes incorrect AOT codegen on Wasm that could lead to memory corruption and hard to isolate failures.
[Select one or both of the boxes. Describe how this issue impacts customers, citing the expected and actual behaviors and scope of the issue. If customer-reported, provide the issue number.]
Regression
[If yes, specify when the regression was introduced. Provide the PR or commit if known.]
This case regressed in 9.0 development.
Testing
System.Buffers.Text.Tests.Base64ValidationUnitTests.ValidateWithOnlyCharsToBeIgnoredCharsRisk
Medium - AOT codegen is complex but the change impacts WASM AOT only, and only in the case of an empty struct, the previous codegen is known to be incorrect.