Skip to content

Two intrinsics call C functions on the Rust stack #1182

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

Closed
brson opened this issue Nov 16, 2011 · 4 comments
Closed

Two intrinsics call C functions on the Rust stack #1182

brson opened this issue Nov 16, 2011 · 4 comments
Assignees
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@brson
Copy link
Contributor

brson commented Nov 16, 2011

rust_intrinsic_recv and rust_intrinsic_task_sleep both call functions in rustrt, which means they are calling functions on the Rust stack without doing the stack check. rust_intrinsic_recv can be rewritten as a regular builtin, and rust_intrinsic_task_sleep needs to do everything inline.

@ghost ghost assigned brson Nov 16, 2011
@nikomatsakis
Copy link
Contributor

It occurs to me that the need for a stack check may be a reason to have wrappers even around the intrinsics...otherwise, the generated C++ code does not do the stack check. Good that I just put some effort into tearing the wrappers out. :)

@brson
Copy link
Contributor Author

brson commented Nov 16, 2011

I think it will do the check without wrappers. We're translating the ll asm as part of our rust crate, so as long as everything gets inlined when we generate intrinsics.ll, when rustc finally compiles it, we'll be inserting our rust prologues into the C functions.

@brson
Copy link
Contributor Author

brson commented Nov 17, 2011

rust_intrinsic_cast does it too

@brson
Copy link
Contributor Author

brson commented Nov 19, 2011

cast and recv no long call C functions. yield still does, but I suspect it is small enough to run in the red zone

@brson brson closed this as completed Nov 19, 2011
bjorn3 added a commit to bjorn3/rust that referenced this issue Aug 6, 2021
coastalwhite pushed a commit to coastalwhite/rust that referenced this issue Aug 5, 2023
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Due to the reliance on `cbmc-viewer==2.11` this needs to be python >=3.8 and pip is also required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

2 participants