-
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
Implement Stream.HasOverridenBeginEndXXX
#72252
Conversation
Fixes dotnet/corert#3251. `Stream.HasOverriddenBeginEndRead`/`Stream.HasOverriddenBeginEndWrite` are magic methods that call into the runtime on both CoreCLR and Mono to find out whether `Stream.BeginRead`/`EndRead`/`BeginWrite`/`EndWrite` are overriden on the current class. Since we don't have a runtime in NativeAOT, implement this in the compiler. The answer to this question is expressible in IL: load function pointer to the method virtually and non-virtually and compare. I'm not calling into `FunctionPointerOps` because I can't imagine a scenario where this wouldn't work, but I can be persuaded to call to `FunctionPointerOps` to do the comparison. Should make us pass all System.IO libraries tests.
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
Nice!
/azp run runtime-extra-platforms |
Azure Pipelines successfully started running 1 pipeline(s). |
This seems like a good use case for the proposed methodof() c# operator. |
Methodof is reflection and I don't think we can answer this efficiently with reflection. We would need LoadFunctionPointer and LoadVirtualFunctionPointer from dotnet/roslyn#11475 |
Fixes dotnet/corert#3251.
Stream.HasOverriddenBeginEndRead
/Stream.HasOverriddenBeginEndWrite
are magic methods that call into the runtime on both CoreCLR and Mono to find out whetherStream.BeginRead
/EndRead
/BeginWrite
/EndWrite
are overriden on the current class.Since we don't have a runtime in NativeAOT, implement this in the compiler. The answer to this question is expressible in IL: load function pointer to the method virtually and non-virtually and compare. I'm not calling into
FunctionPointerOps
because I can't imagine a scenario where this wouldn't work, but I can be persuaded to call toFunctionPointerOps
to do the comparison.Should make us pass all System.IO libraries tests.
Cc @dotnet/ilc-contrib