-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[wasm][coreclr] ReadyToRun for CoreCLR browser-wasm #133378
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
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ed1b70b
[wasm] Dispose the metadata provider in WebcilReader
pavelsavara a30d8e1
[wasm] Match prebuilt R2R images by MVID instead of assembly version
pavelsavara d8c1d10
[wasm][coreclr] Move the ReadyToRun crossgen2 wiring into the WebAsse…
pavelsavara b4110b1
[wasm][coreclr] Wire ReadyToRun into the WebAssembly publish and buil…
pavelsavara 9330b80
[wasm][coreclr] Trigger the native relink on WasmBuildNative as well
pavelsavara d836bcd
[wasm] Do not reference ILLink.Tasks from the wasm nested publish
pavelsavara 9c51a87
[wasm][coreclr] Add Wasm.Build.Tests coverage for ReadyToRun
pavelsavara e00a2dd
[wasm][coreclr] Run the JavaScript interop tests with ReadyToRun
pavelsavara 9cbc88f
[wasm][coreclr] Resolve crossgen2 for ReadyToRun via the SDK-restored…
pavelsavara aee15bf
[wasm][coreclr] Address PR review feedback on the ReadyToRun wiring
pavelsavara 89fdaf4
[wasm][coreclr] Move test-only asset-copy targets to the test infra
pavelsavara 528ec51
Update ReferenceCopyLocalPaths for trimmed closure
pavelsavara 4b894b6
Merge branch 'main' into browsehost_load_r2r_9
pavelsavara 1407d12
fix
pavelsavara b126e04
publish incrementality fix
pavelsavara 245cb70
Merge branch 'main' into browsehost_load_r2r_9
pavelsavara 7b56eec
Merge branch 'main' into browsehost_load_r2r_9
pavelsavara 75fa704
Merge branch 'main' into browsehost_load_r2r_9
pavelsavara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
68 changes: 68 additions & 0 deletions
68
...k.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.ReadyToRun.targets
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| <!-- | ||
| *********************************************************************************************** | ||
| Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.ReadyToRun.targets | ||
|
|
||
| ReadyToRun compiler override for CoreCLR browser-wasm, appended to AfterMicrosoftNETSdkTargets by | ||
| Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.props so it imports after Microsoft.NET.Publish.targets and | ||
| its ResolveReadyToRunCompilers wins. Mirrors AppleBuild.ReadyToRun.targets. | ||
|
|
||
| When an in-build crossgen2 is available (in-tree / dev builds) the Crossgen2Tool item is set from it. Otherwise | ||
| the SDK-resolved crossgen2 pack (@(ResolvedCrossgen2Pack), which the SDK restores when PublishReadyToRun is set) | ||
| is used - so this override never shadows that resolution into an empty tool. Inert for normal consumers. | ||
|
|
||
| Copyright (c) .NET Foundation. All rights reserved. | ||
| *********************************************************************************************** | ||
| --> | ||
| <Project> | ||
| <Target Name="ResolveReadyToRunCompilers" | ||
| Condition="'$(PublishReadyToRun)' == 'true'" | ||
| DependsOnTargets="$(ResolveReadyToRunCompilersDependsOn)"> | ||
| <PropertyGroup> | ||
| <_WasmCrossgen2InBuildUsable Condition="'$(Crossgen2InBuildDir)' != '' and Exists('$(Crossgen2InBuildDir)')">true</_WasmCrossgen2InBuildUsable> | ||
| <_WasmCrossgen2ExeSuffix Condition="'$(ExeSuffix)' != ''">$(ExeSuffix)</_WasmCrossgen2ExeSuffix> | ||
| <_WasmCrossgen2ExeSuffix Condition="'$(_WasmCrossgen2ExeSuffix)' == '' and $([MSBuild]::IsOSPlatform('windows'))">.exe</_WasmCrossgen2ExeSuffix> | ||
| <!-- Accept both layouts: the raw in-build dir has crossgen2 at its root, the shipped | ||
| Microsoft.NETCore.App.Crossgen2.<hostRid> pack has it under tools/. --> | ||
| <_WasmCrossgen2RootExe>$([MSBuild]::NormalizePath('$(Crossgen2InBuildDir)', 'crossgen2$(_WasmCrossgen2ExeSuffix)'))</_WasmCrossgen2RootExe> | ||
| <_WasmCrossgen2ToolsExe>$([MSBuild]::NormalizePath('$([MSBuild]::NormalizeDirectory('$(Crossgen2InBuildDir)', 'tools'))', 'crossgen2$(_WasmCrossgen2ExeSuffix)'))</_WasmCrossgen2ToolsExe> | ||
| <Crossgen2Path Condition="'$(_WasmCrossgen2InBuildUsable)' == 'true' and Exists('$(_WasmCrossgen2RootExe)')">$(_WasmCrossgen2RootExe)</Crossgen2Path> | ||
| <Crossgen2Path Condition="'$(_WasmCrossgen2InBuildUsable)' == 'true' and '$(Crossgen2Path)' == '' and Exists('$(_WasmCrossgen2ToolsExe)')">$(_WasmCrossgen2ToolsExe)</Crossgen2Path> | ||
| <!-- Directory of the resolved crossgen2, so _WasmCoreClrConservativeR2RInputs can add the wasm JIT | ||
| crossgen2 auto-loads to the R2R inputs. --> | ||
| <_WasmResolvedCrossgen2Dir Condition="'$(Crossgen2Path)' != ''">$([MSBuild]::EnsureTrailingSlash($([System.IO.Path]::GetDirectoryName('$(Crossgen2Path)'))))</_WasmResolvedCrossgen2Dir> | ||
| <!-- RunReadyToRunCompiler (NETSDK1158) requires non-empty TargetOS/TargetArch on the Crossgen2Tool item | ||
| when JitPath is unset (crossgen2 then auto-loads its own clrjit_universal_wasm). In-tree builds set | ||
| $(TargetOS)/$(TargetArchitecture); a standalone SDK app does not. --> | ||
| <_WasmR2RTargetOS Condition="'$(TargetOS)' != ''">$(TargetOS)</_WasmR2RTargetOS> | ||
| <_WasmR2RTargetOS Condition="'$(_WasmR2RTargetOS)' == ''">browser</_WasmR2RTargetOS> | ||
| <_WasmR2RTargetArch Condition="'$(TargetArchitecture)' != ''">$(TargetArchitecture)</_WasmR2RTargetArch> | ||
| <_WasmR2RTargetArch Condition="'$(_WasmR2RTargetArch)' == ''">wasm</_WasmR2RTargetArch> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- Preferred: the in-build crossgen2 (in-tree and dev out-of-tree builds that pass Crossgen2InBuildDir). | ||
| When the dir is present but contains no crossgen2, Crossgen2Path stays empty and we fall through to the | ||
| pack fallback (and ultimately _WasmCoreClrValidateReadyToRun's actionable error) instead of naming a | ||
| non-existent executable. --> | ||
| <ItemGroup Condition="'$(Crossgen2Path)' != ''"> | ||
| <Crossgen2Tool Include="$(Crossgen2Path)" | ||
| TargetArch="$(_WasmR2RTargetArch)" | ||
| TargetOS="$(_WasmR2RTargetOS)" | ||
| PerfmapFormatVersion="$(PublishReadyToRunPerfmapFormatVersion)" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Fallback: the SDK-resolved crossgen2 pack (restored when PublishReadyToRun is set, e.g. the no-workload | ||
| Helix leg). Mirrors the resolver in Microsoft.NET.CrossGen.targets so the tool is never left empty. --> | ||
| <ResolveReadyToRunCompilers Condition="'$(Crossgen2Path)' == '' and '@(ResolvedCrossgen2Pack)' != ''" | ||
| RuntimePacks="@(ResolvedRuntimePack)" | ||
| Crossgen2Packs="@(ResolvedCrossgen2Pack)" | ||
| TargetingPacks="@(ResolvedTargetingPack)" | ||
| RuntimeGraphPath="$(RuntimeIdentifierGraphPath)" | ||
| NETCoreSdkRuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" | ||
| EmitSymbols="$(PublishReadyToRunEmitSymbols)" | ||
| ReadyToRunUseCrossgen2="$(PublishReadyToRunUseCrossgen2)" | ||
| PerfmapFormatVersion="$(PublishReadyToRunPerfmapFormatVersion)"> | ||
| <Output TaskParameter="CrossgenTool" ItemName="CrossgenTool" /> | ||
| <Output TaskParameter="Crossgen2Tool" ItemName="Crossgen2Tool" /> | ||
| </ResolveReadyToRunCompilers> | ||
| </Target> | ||
| </Project> |
26 changes: 26 additions & 0 deletions
26
...rosoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.props
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <!-- | ||
| *********************************************************************************************** | ||
| Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.props | ||
|
|
||
| CoreCLR browser-wasm ReadyToRun wiring, isolated from Mono. Imported (props-time) from | ||
| Microsoft.NET.Sdk.WebAssembly.Browser.props only when an in-build crossgen2 is provided. | ||
|
|
||
| The base SDK's ReadyToRun pipeline predates wasm support (dotnet/sdk#55785) and emits composite images | ||
| for wasm, which strip the assembly manifest so the runtime fails coreclr_initialize with 0x80131018. | ||
| Activate the runtime's wasm-aware Crossgen2Tasks shim and the ResolveReadyToRunCompilers override, both | ||
| appended to AfterMicrosoftNETSdkTargets, shim first so the override wins. Mirrors AppleBuild.props. | ||
|
|
||
| Inert for Mono and for normal consumers, which resolve crossgen2 through the base SDK. | ||
|
|
||
| Copyright (c) .NET Foundation. All rights reserved. | ||
| *********************************************************************************************** | ||
| --> | ||
| <Project> | ||
| <Import Project="$(Crossgen2SdkOverridePropsPath)" | ||
| Condition="'$(Crossgen2SdkOverridePropsPath)' != '' and Exists('$(Crossgen2SdkOverridePropsPath)')" /> | ||
|
|
||
| <PropertyGroup> | ||
|
pavelsavara marked this conversation as resolved.
|
||
| <AfterMicrosoftNETSdkTargets Condition="'$(Crossgen2SdkOverrideTargetsPath)' != '' and Exists('$(Crossgen2SdkOverrideTargetsPath)')">$(AfterMicrosoftNETSdkTargets);$(Crossgen2SdkOverrideTargetsPath)</AfterMicrosoftNETSdkTargets> | ||
|
pavelsavara marked this conversation as resolved.
|
||
| <AfterMicrosoftNETSdkTargets>$(AfterMicrosoftNETSdkTargets);$(MSBuildThisFileDirectory)Microsoft.NET.Sdk.WebAssembly.Browser.CoreCLR.ReadyToRun.targets</AfterMicrosoftNETSdkTargets> | ||
| </PropertyGroup> | ||
| </Project> | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.