-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use static abstract members on two occasions. #69278
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
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is good to enforce specialized binding to the interface, but I removed it because there was no apparent reason (and didn't see it in the SslStream code I linked).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Constraining generic arguments by structs can give hint to some of the AOT compilers that they do not need to bother to create code shared by reference instantiations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both T and THandler can be constrained as structs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't see it in the SslStream code I linked
Maybe this can be done in the SslStream code too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 21 places where TAdapter : IReadWriteAdapter is being used; it would go beyond this PR's scope, better for another time.
BTW can't the AOT compilers be smarter and detect that the shared instantiation will not be used? Or is it done intentionally (my guess would be for something like a fallback for reflection)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is it done intentionally (my guess would be for something like a fallback for reflection)?
Correct. I believe that some of the AOT compilers that we have do this already ... but it is hard to do in general case due to reflection.
src/libraries/System.Private.CoreLib/src/System/IO/RandomAccess.Windows.cs
Outdated
Show resolved
Hide resolved
stephentoub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
019bf31 to
812005f
Compare
|
Feedback addressed @jkotas. |
jkotas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
|
From Build Analysis: Known repository errors |
I noticed that static abstract members have started being used used in regular BCL code, and used them on two occasions.