Uh oh!
There was an error while loading. Please reload this page.
Make NativeCallableAttribute public. - #33005
Conversation
AaronRobinsonMSFT
commented
Feb 29, 2020
/cc @Scottj1s |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
AaronRobinsonMSFT
commented
Feb 29, 2020
/cc @MichalStrehovsky for CrossGen2 |
Uh oh!
There was an error while loading. Please reload this page.
AaronRobinsonMSFT
commented
Feb 29, 2020
@janvorli Can you take a look at the work here and offer your thoughts on exceptions handling at the margins. @jkotas and I are in agreement that on Unix exceptions here aren't supported at this transition point, but on Windows we would want the typical behavior reverse P/Invoke behavior. Can you point me at an example of what I would need to do? Also, do you have any thoughts on the cost to support x86? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
janvorli
commented
Mar 3, 2020
@AaronRobinsonMSFT as for the EH on Linux, to ensure that we fail fast if there is an exception leaking from a method marked with NativeCallable, I can see two options here:
|
AaronRobinsonMSFT
commented
Mar 3, 2020
Thanks @janvorli. (1) seems like a generally less ideal approach - doesn't really handle the pay-for-play mentality we try to have in the interop space. I had been thinking about (2) as an option but wanted to hear from you first. Since you suggested it, I will reach out to the @dotnet/jit-contrib team and ask for some advice if flags already exist or how I should think about the work. Would (2) apply for both Windows and non-Windows? |
I think that (1) is the right way to do it. (2) adds performance overhead to the non-exception path for no good reason.
This fact is encoded in GCInfo. So all you need to do is to crack GCInfo of the method that is not a big deal on exception handing path. .NET Native / CoreRT - that has very pay-for-play and performance minded design - does exactly that. |
janvorli
commented
Mar 3, 2020
Ah, I have forgotten that. It is the reverse pinvoke frame stack slot info presence, right? |
jkotas
commented
Mar 3, 2020
Yep |
@jkotas Doesn't (1) imply that whenever a managed exception is thrown this check can occur? As opposed to (2) that will only occur if a reverse P/Invoke happens. I would assume that managed exceptions occur far more often than a reverse P/Invoke or am I missing something here? |
AaronRobinsonMSFT
commented
Mar 3, 2020
Update for PR. Spoke offline with @jkotas. The gist of the argument is that the exception path is already expensive and this check in the suggested area isn't going to move the needle in a measurable way; ergo (1) is appropriate. |
janvorli
commented
Mar 3, 2020
@AaronRobinsonMSFT I've made the change in the UnwindManagedExceptionPass1 and I was really simple. I can either share the diff or I can make it a separate PR after your changes get in. |
AaronRobinsonMSFT
commented
Mar 3, 2020
@janvorli W00t! Thank you much. If you can share the diff I will apply it. |
AaronRobinsonMSFT
commented
Mar 3, 2020
@jkotas@janvorli@MichalStrehovsky@jkoritzinsky Please take another look. I believe I have addressed all outstanding issues and added sufficient scenario testing. |
jkotas
commented
Mar 3, 2020
This is a performance optimization. Do you have any performance numbers? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Oh ok, yea the link is not working well. With this link c78f4a4#diff-b06261f7127af3268df1f78173d20b34R1659 it's in I think your change would cover this case as well, it would go in with Unknown and use the slow path. |
kouvel
commented
Mar 12, 2020
Edited above to add file name |
Create macro for fail fast create thread.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
left a comment
There was a problem hiding this comment.
Just last few nits, but looks great otherwise
Uh oh!
There was an error while loading. Please reload this page.
AaronRobinsonMSFT
commented
Mar 13, 2020
The Linux x64 Debug and Checked versions passed prior to the exception change in CrossGen2 so assuming they are not related to any changes here. |
Related to dotnet#33005
Related to dotnet#33653, dotnet#33005
Fixes#32462
TODO:
NativeCallableAttributetests pass./cc @jkotas@fadimounir@jeffschwMSFT@jkoritzinsky