-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Issue #3678: Remove wrappers and call foreign functions directly #6661
Issue #3678: Remove wrappers and call foreign functions directly #6661
Conversation
Delightful 💃 |
yay! |
Needs rebase. |
Come on bors. |
whispers words of encouragement |
You can do it @bors! |
@nikomatsakis I'm not sure what happened here. Silent failure while building It would be nice to get this in. |
Any news on this? |
I rebased the patch and it now crashes in fail_with for some reason I have yet to determine. Now that #7262 is finished, I will turn my focus to that. I still don't know what causes the Windows failures either. |
@nikomatsakis It looks like this completely removes all wrappers from foreign calls? I believe this is incorrect and will result in similar bugs to the one that was causing OOM's in various benchmarks recently. What happens is that the callee claims to require a very large stack, then if it yields it will be holding on to the big stack. If many tasks are doing similarly then the process will use a very large amount of memory. Effectively:
It has been my understanding that fast_ffi requires foreign calls to have non-inlinable wrappers for this reason. |
@brson This is certainly a possible side-effect, I just don't know So I guess the question is what we want the defaults to be. We could If we chose to continue generating wrappers by default, then the type One of the advantages of the old plan which made the stack switch |
Shouldn't the |
The way it's setup in this PR is that any Rust function which directly calls a C function requests a very large stack size (so that the C function has enough stack to run). This is the same as how the current setup works, except that in the current setup we auto-generate a Rust wrapper for every C function that is declared, whereas in this PR we expose the C functions directly, and expect people to write their own Rust wrappers. It's not clear to me what is the best policy, ultimately. |
Any word on this? We really need it for OpenGL awesomeness. It would be great if Rust could have decent graphics support for 0.8, I'm itching to start promoting it. Along with GLFW/SDL, lmath (or another maths lib) and a GL function loader, it would make the language very compelling for graphics devs to start tinkering with. We need this! |
@nikomatsakis Can't we just let the client decide? |
ok, I found the windows problem, which was embarassingly simple: I wasn't calling CallWithConv but rather just Call. |
Any news on this? I just had a deja-vu |
exhaustive_structs: don't trigger for structs with private fields changelog: Restrict `exhaustive_structs` to structs with all-public fields
r? @sanxiyn --- I'd appreciate it if you can take a look at the logic for C abis in particular. I added some comments with my best effort to understand what was going on. I hope to come back at some point and clean things up in that regard, since the code as is is written with different assumptions (i.e., that there will be a wrapper and so forth).