-
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
Objective-C msgSend* support for pending exceptions in Release #52849
Objective-C msgSend* support for pending exceptions in Release #52849
Conversation
Clear any pending exception when calling a method that may return a pending exception. Rewrite PendingException test to be more direct.
Only perform check for OSX target.
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. Thanks!
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.
This means we are changing the logic so that no calls to overridable functions (i.e., msgSend*) in /usr/lib/libobjc.dylib will be inlinable.
This is not just disabling inlining for objc_msgSend*
, but also changing the emitted IL to always check for a pending exception object. Is that intentional? I'm not seeing why that would be necessary for this.
Yes. This aligns with the current Mono contract.
Is your interpretation that only overriding a |
Chatted offline. If the intention is that all msgSend invokes (not just overridden ones) will actually check for a pending exceptions, we should update the API docs. Could we also add a test for this behaviour? |
SetMessageSendPendingException API.
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 for the clarifications.
...ime.InteropServices/tests/System/Runtime/InteropServices/ObjectiveC/PendingExceptionTests.cs
Outdated
Show resolved
Hide resolved
...reclr/System.Private.CoreLib/src/System/Runtime/InteropServices/ObjectiveCMarshal.CoreCLR.cs
Show resolved
Hide resolved
I've one more commit to add but will wait to see if the current CI is green. This final commit only contains comment code so if the CI is green, I will push the commits and then merge. |
Issue is #52799. |
The failure in crossgen2 is #49365. |
Failures in x64 Debug are infrastructure failures. |
Any plans to backport this to preview5? |
@filipnavara No. You can workaround this issue easily by making the P/Invoke signature non-blittable. An easy way to do this would be to set |
I was actually more concerned about consuming the API on the Xamarin side but I supposed it can wait one more preview or I can use custom builds. |
Fixes #52737
Fixes #52962
The current logic was assuming the
NDirectMethodDesc
was always fully populated when the call toMarshalingRequired
was performed – This is not the case, comment was added. The fix here is to attempt to populate theNDirectMethodDesc
when we get to a point where it is needed.It was also determined that a fundamental bug existed in the experience since the JIT does call
MarshalingRequired
prior to the method being run which means detecting if a method is overloaded could be detected in the scenario below. This means we are changing the logic so that no calls to overridable functions (i.e.,msgSend*
) in/usr/lib/libobjc.dylib
will be inlinable and will always check for a pending exception./cc @jkotas @jkoritzinsky @elinor-fung