Skip to content

Fix totalILArgs for explicithis - #85347

Merged
AndyAyersMS merged 2 commits into
dotnet:mainfrom
MichalPetryka:totalargs-fix
Apr 26, 2023
Merged

Fix totalILArgs for explicithis#85347
AndyAyersMS merged 2 commits into
dotnet:mainfrom
MichalPetryka:totalargs-fix

Conversation

@MichalPetryka

Copy link
Copy Markdown
Contributor

Fixes totalILArgs counting this twice with explicithis.

Split off from #85197.

@MichalPetryka
MichalPetryka marked this pull request as ready for review April 25, 2023 19:21
@ghostghost added community-contribution Indicates that the PR has been added by a community member area-VM-coreclr labels Apr 25, 2023

@AndyAyersMSAndyAyersMS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about:

privateboolhasThis(){return((callConv&CorInfoCallConv.CORINFO_CALLCONV_HASTHIS)!=0);}
privateboolhasExplicitThis(){return((callConv&CorInfoCallConv.CORINFO_CALLCONV_EXPLICITTHIS)!=0);}
privateuinttotalILArgs(){return(uint)(numArgs+(hasThis()?1:0));}

I suspect there are a few more places that will need changes, would suggest you review the places where totalILArgs is used and make sure they're ok. It may be hard to surface these during testing as explicit this signatures are restricted to cases we don't optimize (yet).

@AndyAyersMS

Copy link
Copy Markdown
Member

@markples perhaps you can review this one?

@markples

Copy link
Copy Markdown
Contributor

It looks like hasthis is also a thing to audit, though that would uncover separate bugs and doesn't need to be part of this PR. Unfortunately, there are a lot of them. In general, it seems to be documented that explicit-call is only for signatures, not methods themselves (assuming that this isn't one of those things were the spec isn't followed), so places that check hascall and ignore explicitcall might be fine anyway.

Comment threadsrc/coreclr/jit/inlinepolicy.cpp

@markplesmarkples left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My hasthis comment doesn't seem like it should block anything here. Thanks!

@AndyAyersMS
AndyAyersMS merged commit ff0f603 into dotnet:mainApr 26, 2023
@AndyAyersMS

Copy link
Copy Markdown
Member

@MichalPetryka thanks -- and thanks for splitting this off from your other PR.

@ghostghost locked as resolved and limited conversation to collaborators May 27, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-VM-coreclrcommunity-contributionIndicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@MichalPetryka@AndyAyersMS@markples