Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

JIT: Avoid boxing ArgumentNullException.ThrowIfNull arguments in Tier-0#104815

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
EgorBo merged 8 commits intodotnet:mainfromEgorBo:fix-alloc-throwifnull
Jul 15, 2024

Conversation

@EgorBo
Copy link
Member

Closes#104512

Example:

staticvoidTest<T>(Ta){ArgumentNullException.ThrowIfNull(a);}

Current codegen forTest<int> in Tier0:

; Assembly listing for method Program:Test[int](int) (Tier0); Tier0 codepushrbpsubrsp,48learbp,[rsp+0x30]xoreax,eaxmov      qword ptr[rbp-0x08],raxmov      dword ptr[rbp+0x10],ecxmovrcx,0x7FFD546561B0      ; System.Int32call     CORINFO_HELP_NEWSFASTmov      gword ptr[rbp-0x08],raxmovrax, gword ptr[rbp-0x08]movecx, dword ptr[rbp+0x10]mov      dword ptr[rax+0x08],ecxmovrcx, gword ptr[rbp-0x08]movrdx,0x203802095B0      ; 'a'call[System.ArgumentNullException:ThrowIfNull(System.Object,System.String)]nopaddrsp,48poprbpret

New codegen forTest<int> in Tier0:

; Assembly listing for method Program:Test[int](int) (Tier0); Tier0 codepushrbpsubrsp,16learbp,[rsp+0x10]xoreax,eaxmov      qword ptr[rbp-0x08],raxmov      dword ptr[rbp+0x10],ecxaddrsp,16poprbpret

@AndyAyersMS I hope I didn't step on your foot since it's was assigned to you, it's just that it looked trivial and I decided to file a quick fix 🙂

In theory, we could solve this by a limitted version of inlining in tier0, but that is tricky and may regress startup time/lead to unnecessary type load events, etc.

@ghostghost added the area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labelJul 12, 2024
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area:@JulieLeeMSFT,@jakobbotsch
See info inarea-owners.md if you want to be subscribed.

Copy link
Member

@AndyAyersMSAndyAyersMS left a comment

Choose a reason for hiding this comment

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

I was thinking we'd catch this inimpBoxPatternMatch to avoid creating and then removing all the BOX IR, but that would require recognizing and intrinsic from its IL, which I guess could be clunky. This works too.

@AndyAyersMS
Copy link
Member

@AndyAyersMS I hope I didn't step on your foot since it's was assigned to you, it's just that it looked trivial and I decided to file a quick fix 🙂

No worries, I hadn't gotten around to this yet.

@EgorBo
Copy link
MemberAuthor

I was thinking we'd catch this inimpBoxPatternMatch to avoid creating and then removing all the BOX IR, but that would require recognizing and intrinsic from its IL, which I guess could be clunky. This works too.

The problem with that, - we'd need to do a redundant "resolveToken" call oncall, yeah

@EgorBo
Copy link
MemberAuthor

@jakobbotsch@AndyAyersMS could you please review the Nullable<> part?

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
@EgorBoEgorBo merged commit5130683 intodotnet:mainJul 15, 2024
@EgorBoEgorBo deleted the fix-alloc-throwifnull branchJuly 15, 2024 14:38
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 15, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@stephentoubstephentoubstephentoub left review comments

@jakobbotschjakobbotschjakobbotsch approved these changes

@AndyAyersMSAndyAyersMSAndyAyersMS approved these changes

Assignees

@EgorBoEgorBo

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Avoid boxing ArgumentNullException.ThrowIfNull arguments in Tier-0

4 participants

@EgorBo@AndyAyersMS@stephentoub@jakobbotsch

[8]ページ先頭

©2009-2025 Movatter.jp