GithubHelp home page GithubHelp logo

ffi-unwind about lang-team HOT 22 CLOSED

rust-lang avatar rust-lang commented on May 25, 2024
ffi-unwind

from lang-team.

Comments (22)

nikomatsakis avatar nikomatsakis commented on May 25, 2024 1

Update: PR is ready for review, and we'll have a longjmp blog post going out soon

from lang-team.

BatmanAoD avatar BatmanAoD commented on May 25, 2024 1

2021-04-06:

  • "C-unwind" PR was merged!
    • This accidentally introduced a change to "C" unwind behavior even without the feature flag; we will need to fix this before the next stable release. We have alerted the release team and are working on a fix.
    • There are a few more follow-up issues to address, listed here.
  • a longjmp blog post was published, but we are prioritizing the "C-unwind" issues for now

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-04-02: Working towards RFC

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-04-09: BatmanAod opened a PR with draft of RFC

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-04-30:
- The only question is whether to make it “defined behavior” if a foreign except propagates across a “C unwind” boundary (and there is no catch_unwind)
- Advantage: we probably want to support this
- Disadvantage: it will require a shim to catch C++ exceptions — this is probably necessary later, unless we reverse the “two ABIs” proposal
- Interesting downside of the “two ABI” design
- If you have a C function but it takes callbacks, then there could potentially be pressure to make callbacks into “C unwind” and the function too (for flexibility)
- but note that this is not a trivial change, necessarily, and indeed many C libraries are not ready for this to happen “just because”
- True, but just a downside of this approach.

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-06-01:
- Plain Old Frames — for frames that don’t have a pending destructor or catch_unwind

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-06-11:

We uncovered a few interesting things in discussing the latest draft. The most important is that we are not comfortable saying that longjmp functions can unwind Plain Old Frames (POF) without any further annotation, because that will hinder our efforts to optimize. For the time being, we plan to edit the RFC to leave the details of when longjmp is legal as TBD, but we discussed some possible alternative proposals here rust-lang/project-ffi-unwind#30.

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-06-22:

  • RFC 2945 opened
  • Not just about "C" vs "C unwind" ABIs, but we currently use #[unwind(allowed)] for "system":
    extern "system" {
        #[unwind(allowed)]
        pub fn _CxxThrowException(pExceptionObject: *mut c_void, pThrowInfo: *mut u8) -> !;
    }
  • Options:
    • add "system unwind", "stdcall unwind", etc
    • maybe "system" itself is redundant

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-07-06:

  • RFC is believed to be ready for FCP, needs someone from lang-team to review and fcp merge.
  • We clarified that other ABIs (e.g., system) may have unwind variants (e.g., extern "system unwind").
  • Josh: If there were an ABI that is used in some context where unwinding is always used, it's not useful to have a non-unwind variant of it, in practice there is often a "defacto no-unwind" guarantee. (Niko: but we may want to call it "foo unwind", even if there is no "foo").

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-07-20:

  • RFC has just entered FCP.
  • Bikeshedding now about "C unwind" vs "C-unwind"

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-07-27:

  • Bikeshed resolved ABI name to "C-unwind".

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-07-31:

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-09-14:

  • Implementation work is ongoing, we may start looking at the longjmp question.

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-09-21:

No update.

from lang-team.

joshtriplett avatar joshtriplett commented on May 25, 2024

Discussion in today's meeting:

  • New discussion and proposals for handling "target ABI"
    • e.g. target for native iOS vs target for iOS simulator, which have different ABIs
    • Rust doesn't have a way to express this today

This isn't directly in the current ffi-unwind charter. Rather than expanding it (which we'd do to cover c++/longjmp/etc), we may need to consider chartering an additional project for new FFI issues.

from lang-team.

joshtriplett avatar joshtriplett commented on May 25, 2024

(Not sure why this unassigned @BatmanAoD; I didn't change anything there.)

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

Update:

  • @BatmanAoD plans to write a blog post setting the direction for work on functions that can be deallocated ("canceled") with longjmp &c.
  • @katie-martin-fastly hasn't had time to work on rust-lang/rust#76570 recently but hopes to get some more time soon =)

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

2020-11-17:

  • Previous comment still basically accurate.

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

Lang team planning meeting update:

  • We should promote this project to "evaluation"
  • On the topic of longjmp:
    • Josh: Fairly unusual to see people using longjmp these days, should not sacrifice optimizablity
    • Josh: But it should be possible -- with enough care -- to longjmp without UB
    • Amanieu: this also affects functions that call pthread_exit
  • Would be nice to open a PR and update the charter to include new scope (can link to the blog post)

from lang-team.

BatmanAoD avatar BatmanAoD commented on May 25, 2024
  • updated charter
  • Follow-up issues for "C-unwind" remain our top priority.
    • In particular, we need to implement the specified "abort-on-unwind" behavior for "C-unwind" FFI calls in panic=abort mode.
  • Regarding longjmp, we believe there's an LLVM bug causing incorrect code-gen when strict-aliasing is enabled in a frame that gets discarded by longjmp. We haven't yet discussed how to move forward, though we plan to open a bug report for it.

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

Update:

  • @alexcrichton has a PR fixing various bugs and implementing the intended semantics, under review
  • Plan of record is to
    • remove the UB from panics in "C" while adding "C-unwind" as a target
    • once "C-unwind" is stabilized -- hopefully soon! -- add back in the UB for panics in "C"

from lang-team.

nikomatsakis avatar nikomatsakis commented on May 25, 2024

Closing in favor of rust-lang/project-ffi-unwind#36

from lang-team.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.