-
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
[release/9.0-staging] [wasm][AOT] fix codegen for small structs on stack #118416
Conversation
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Tagging subscribers to 'arch-wasm': @lewing |
/azp run runtime-wasm |
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
I don't know about packed SIMD, @lewing does it ring any bell ? |
/ba-g known CI issues for Net9 |
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> |
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.ValidateWithOnlyCharsToBeIgnoredChars
Risk
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.