-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
support foreign threads #46609
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
support foreign threads #46609
Conversation
86c1fd4 to
01a7ad9
Compare
|
It would be good to fix (remove) the compat note in the docstring for |
|
This assertion seems odd: |
|
There is an rr trace for that in the rr testset. |
Yeah I don't see why we would need that. Adding threads after startup makes that assertion straightforwardly untrue. |
|
I don't get the assertion error running the ccall test, but instead I get and have also seen memory corruption during bootstrap, so something must be going wrong here. |
|
OK the Int32 thing is just due to the IR verifier not handling |
|
Ok, never mind, that has been happening for a long time at least since 1.7... |
01a7ad9 to
6f1226f
Compare
6f1226f to
b1776c6
Compare
|
Ready to merge? |
With dynamic thread counts, we cannot ensure this count is constant after initialization, and we might like to even profile adding and removing threads.
f48fd6c to
532ffd6
Compare
|
@vtjnash Please re-review |
532ffd6 to
4a0ebf2
Compare
Hook a couple functions (notably cfunction) to handle adopting foreign threads automatically when used. n.b. If returning an object pointer, we do not gc_unsafe_leave afterwards as that would render the pointer invalid. However, this means that it can be a long time before the next safepoint (if ever). We should look into ways of improving this bad situation, such as pinning only that specific object temporarily. n.b. There are some remaining issues to clean up. For example, we may trap pages in the ptls after GC to keep them "warm", and trap other pages in the unwind buffer, etc.
4a0ebf2 to
b7201d6
Compare
|
Is there any chance that this PR broke i686-linux-gnu on master? |
|
From NEWS
Presumably this means there's now extra overhead to entering a |
|
The overhead to support this was added pre-1.0, the feature is just finally enabled now |
|
Interesting, didn't know there was already a dead check and branch in every Separate topic I guess, but that and other reasons would make it compelling to add native typed functions, and a way to bind type erased closures to such function objects with no other overhead than an indirect call and with full support of all types (i.e., not limited to what passes through the Julia C ABI). |
Rebased #45447 and moved to this repo.
Fixes #17573