-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add Expr(:funcinfo, ...
and unsafe verifier
#43747
Conversation
Yes, this is a good idea! I think we'll need some more specific names for various kinds of restrictions that people want in different cases. For example, no-runtime (doesn't call into the julia runtime), maybe no-allocation, foreign-thread (this case). The foreign-thread restriction might be the same as no-runtime, unless we carefully catalog runtime system functions that don't access TLS? I assume this needs to be recursive as well; storing a flag on each function if it is "unsafe" and checking that unsafe functions only call other unsafe functions? The really hard part I think is when to throw the error. Some options:
|
Yeah, right now it is when it is compiled (which may or may not be during
Yeah this seemed challenging and very invasive. It might be useful to have a "strict" mode and a lenient mode. We could have multiple flags? And then allow them to be set from the macro.
|
Since we always support runtime function replacement (aka #265), I am not sure how this could ever be made to work. |
Can you expand on this? There are two different properties here that I want.
Now I can see how #265 can come and rain on my parade, by invalidating the function (actually a good question what happens with a @cfunction in that case). Precisely because of this I would like to have a verification step that will error, instead of having mysterious failures down the road. |
|
That makes me think this should really be part of |
(:+1: My intuition before reading all the discussion was also that it should be done at If the compiler checks that the given function does not need ptls etc. at the time So, how about |
#43852 provides |
No longer needed. Though we could add a metadata/compiler option that turns off #41616 |
As discussed in #41616 we need some way of marking function as being used in an
unsafe
situation.Unsafe meaning executed on a non-Julia thread, where we can not access any TLS variables. This PR mocks
up the necessary changes so that we can discuss this approach right now:
Changes: