-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Change SslStream's internal adapter interface to use static abstract interface methods #65239
Change SslStream's internal adapter interface to use static abstract interface methods #65239
Conversation
Tagging subscribers to this area: @dotnet/ncl, @vcsjones Issue DetailsPassing around the adapter instance was working around the lack of static abstract interface methods. Now that we have the latter, we can get rid of the former, and pass around just the data that's needed. This will make some of the state machines smaller, as we're now just accessing InnerStream rather than passing the stream around as part of the adapter. I also removed the isApm argument that was adding complication and expense purely to add a method name into an exception message thrown when the type is misused, but a) that information is already available in the resulting exception's stack trace, and b) it adds expense by increasing the size of the async method state machines. cc: @wfurt, @tannergooding
|
b0e79c6
to
e3de7fa
Compare
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.
LGTM.
I assume that smaller state will not really be measurable with microbenchmarks?
Not really. |
@lambdageek, there are a bunch of mono failures here of the form "BadImageFormatException : Method has no body"... is this a sign of a problem with static abstract interface methods? |
Pardon my ignorance, but how are static abstract methods actually implemented? Is there a design note somewhere or something like that? |
@davidwrighton, can you point @geoffkizer to any design docs you may have on this? |
Yes that's suspicious. |
Standalone repro for the mono issue #65384 |
It's only used to add duplicative information to an exception message, and in doing so it makes the async methods it's used in more expensive.
e3de7fa
to
eebc607
Compare
@geoffkizer The delta to the ECMA spec is located at https://github.com/dotnet/runtime/blob/main/docs/design/specs/Ecma-335-Augments.md#static-interface-methods |
@davidwrighton Interesting, thanks for the link. I had naively assumed that they were implemented through some sort of compiler transform. |
Passing around the adapter instance was working around the lack of static abstract interface methods. Now that we have the latter, we can get rid of the former, and pass around just the data that's needed. This will make some of the state machines smaller, as we're now just accessing InnerStream rather than passing the stream around as part of the adapter. I also removed the isApm argument that was adding complication and expense purely to add a method name into an exception message thrown when the type is misused, but a) that information is already available in the resulting exception's stack trace, and b) it adds expense by increasing the size of the async method state machines.
cc: @wfurt, @tannergooding