Skip to content
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

Disallow inlining Main #94449

Merged
merged 5 commits into from
Nov 10, 2023
Merged

Conversation

MichalStrehovsky
Copy link
Member

When we compile managed code, Main is not the actual spot where execution of managed code starts. Instead it's the StartupCodeMain method that the compiler generates. This method is responsible for initializing the managed environment, calling Main and tearing down the environment. If Main is short enough, sometimes it gets inlined into StartupCodeMain this has bad impact on diagnostics (don't see Main in stack traces, can't set breakpoints). Pretend it was marked NoInlining.

Cc @dotnet/ilc-contrib

When we compile managed code, `Main` is not the actual spot where execution of managed code starts. Instead it's the `StartupCodeMain` method that the compiler generates. This method is responsible for initializing the managed environment, calling `Main` and tearing down the environment. If `Main` is short enough, sometimes it gets inlined into `StartupCodeMain` this has bad impact on diagnostics (don't see `Main` in stack traces, can't set breakpoints). Pretend it was marked `NoInlining`.
@ghost
Copy link

ghost commented Nov 7, 2023

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Issue Details

When we compile managed code, Main is not the actual spot where execution of managed code starts. Instead it's the StartupCodeMain method that the compiler generates. This method is responsible for initializing the managed environment, calling Main and tearing down the environment. If Main is short enough, sometimes it gets inlined into StartupCodeMain this has bad impact on diagnostics (don't see Main in stack traces, can't set breakpoints). Pretend it was marked NoInlining.

Cc @dotnet/ilc-contrib

Author: MichalStrehovsky
Assignees: -
Labels:

area-NativeAOT-coreclr

Milestone: -

@EgorBo
Copy link
Member

EgorBo commented Nov 7, 2023

Yeah it was annoying that JitDisasm=Main didn't work for NAOT sometimes🙂

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@MichalStrehovsky MichalStrehovsky merged commit 9137cb4 into dotnet:main Nov 10, 2023
105 of 111 checks passed
@MichalStrehovsky MichalStrehovsky deleted the noinline branch November 10, 2023 09:34
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants