Skip to content

Two intrinsics call C functions on the Rust stack #1182

Closed
@brson

Description

@brson
Contributor

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.

Activity

ghost assigned on Nov 16, 2011
nikomatsakis

nikomatsakis commented on Nov 16, 2011

@nikomatsakis
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

brson commented on Nov 16, 2011

@brson
ContributorAuthor

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

brson commented on Nov 17, 2011

@brson
ContributorAuthor

rust_intrinsic_cast does it too

brson

brson commented on Nov 19, 2011

@brson
ContributorAuthor

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

added a commit that references this issue on Aug 6, 2021
424a8c3
added a commit that references this issue on Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @brson@nikomatsakis

      Issue actions

        Two intrinsics call C functions on the Rust stack · Issue #1182 · rust-lang/rust