Skip to content

Conversation

@VSadov
Copy link
Member

@VSadov VSadov commented May 30, 2023

A subset of #86690

As discussed in: #86690 (comment)

@VSadov VSadov requested a review from MichalStrehovsky as a code owner May 30, 2023 20:50
@ghost ghost assigned VSadov May 30, 2023
@VSadov VSadov requested a review from jkotas May 30, 2023 20:50
@ghost
Copy link

ghost commented May 30, 2023

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

Issue Details

A subset of #86690

As discussed in: #86690 (comment)

Author: VSadov
Assignees: VSadov
Labels:

area-NativeAOT-coreclr

Milestone: -

public struct RuntimeTypeHandle
{
private EETypePtr _pEEType;
private IntPtr _pEEType;
Copy link
Member

Choose a reason for hiding this comment

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

What motivated this change? We have another copy at src\coreclr\nativeaot\Runtime.Base\src\System\RuntimeTypeHandle.cs that can be updated as well.

Also, while you are on it - could you please delete this comment

//
// Caution: There can be and are multiple MethodTable for the "same" type (e.g. int[]). That means
// you can't use the raw IntPtr value for comparisons.
//
and move private IntPtr _value; to the top in that file?

Copy link
Member Author

@VSadov VSadov May 31, 2023

Choose a reason for hiding this comment

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

What motivated this change?

I was looking at what stack traces do allocations and at some point I had doubts that stacks are correct. So I tried to look at optimized=false traces. It was mostly the same, in terms of allocating paths, except a few cases of boxing, that are otherwise optimized.

What surprised me is the wrapping/unwrapping of EETypePtr in the RuntimeTypeHandle - it was near the top. It looks like a common operation, so I "fixed" it to not clutter the profile.
This change is not required, since JIT can optimize this away, but I figured it is better if I keep "fixed" variant.

public struct RuntimeTypeHandle
{
private EETypePtr _pEEType;
private IntPtr _pEEType;
Copy link
Member

Choose a reason for hiding this comment

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

Also, it may be nice to rename _pEEType to _value so that it is in sync with the full implementation.

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!

@jkotas jkotas merged commit 2bf8f1a into dotnet:main Jun 4, 2023
@VSadov
Copy link
Member Author

VSadov commented Jun 5, 2023

Thanks!

@VSadov VSadov deleted the aotPrfWin branch June 5, 2023 21:51
@ghost ghost locked as resolved and limited conversation to collaborators Jul 6, 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.

2 participants