[browser][coreCLR] adopt new API for async main#124909
Draft
pavelsavara wants to merge 3 commits intodotnet:mainfrom
Draft
[browser][coreCLR] adopt new API for async main#124909pavelsavara wants to merge 3 commits intodotnet:mainfrom
pavelsavara wants to merge 3 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @agocke, @jeffschwMSFT, @elinor-fung |
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request removes temporary async Main handling code in favor of adopting a new compiler-generated API pattern for async entry points. The changes enable asyncV2 support for browser/CoreCLR configurations by implementing a flag-based mechanism to distinguish between synchronous and asynchronous Main methods, rather than using metadata-based lookup of compiler-generated wrapper methods.
Changes:
- Introduces
SystemJS_MarkAsyncMain()API to mark when an async Main is executing, setting a flag that causes the firstSystemJS_ResolveMainPromisecall to be ignored until the actual async result is available - Removes temporary validation and lookup code in CoreCLR that attempted to find the original async Main method by name pattern matching
- Enables browser platform for runtime-async feature in test configuration
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/native/libs/System.Native.Browser/native/main.ts | Adds SystemJS_MarkAsyncMain() function and logic to ignore first promise resolution for async mains |
| src/native/libs/System.Native.Browser/native/index.ts | Exports the new SystemJS_MarkAsyncMain function |
| src/native/libs/Common/JavaScript/types/ems-ambient.ts | Adds isAsyncMain boolean flag to DOTNET ambient type |
| src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.Browser.cs | Calls SystemJS_MarkAsyncMain() at the start of both HandleAsyncEntryPoint overloads via new P/Invoke declaration |
| src/coreclr/vm/wasm/entrypoints.h | Declares external SystemJS_MarkAsyncMain() function for browser target |
| src/coreclr/vm/qcallentrypoints.cpp | Registers SystemJS_MarkAsyncMain as a QCall entry point |
| src/coreclr/vm/corelib.h | Removes temporary HANDLE_ASYNC_ENTRYPOINT method definitions that were used for lookup-based approach |
| src/coreclr/vm/assembly.cpp | Removes temporary async Main validation, lookup, and invocation code; simplifies to single SystemJS_ResolveMainPromise call for all mains |
| eng/testing/tests.targets | Removes browser exclusion from runtime-async feature enablement condition |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #121064
removes temporary code handling the async managed
Main()