Skip to content
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

RFC: Perform borrow checking through a capsule-based API #361

Merged
merged 5 commits into from
Dec 31, 2022

Commits on Nov 13, 2022

  1. Configuration menu
    Copy the full SHA
    f1bf51e View commit details
    Browse the repository at this point in the history
  2. Perform borrow checking through a capsule-based API

    This places the global state required for dynamic borrow checking of NumPy
    arrays into a capsule exposed as the numpy.core.multiarray._BORROW_CHECKING_API
    attribute.
    
    This has two benefits: First, all extensions built using rust-numpy will share
    this global state and hence cooperate in borrow checking. Second, in the future,
    other libraries that want to borrow check their access to NumPy array can
    cooperate using this C-compatible API.
    
    This does not checking the borrow checking implementation at all, but instead of
    accessing Rust static data, all accesses are funneled through the
    above-mentioned capsule API with access to it being cached for performance reasons
    as we already do for the _ARRAY_API and _UFUNC_API capsules.
    
    This means that eventually, the implementation of the borrow checking API could
    be different from the one the current extension would provide with the adaptors
    to the C API taking of any differences in e.g. the definition of `BorrowKey`.
    For now, they will of course usually be the same and this change just adds a
    huge amount of boiler plate to go from Rust to C-compatible back to Rust.
    adamreichold committed Nov 13, 2022
    Configuration menu
    Copy the full SHA
    9b67bef View commit details
    Browse the repository at this point in the history
  3. Use a less grandiose name of the borrow checking API capsule to avoid…

    … misunderstands on its scope.
    adamreichold committed Nov 13, 2022
    Configuration menu
    Copy the full SHA
    b877d96 View commit details
    Browse the repository at this point in the history

Commits on Nov 14, 2022

  1. Make the shared borrow checking API much narrower

    This improves the changes of actually keeping it backwards compatible while
    precluding the reuse of base address and borrow key for cloning and dropping.
    adamreichold committed Nov 14, 2022
    Configuration menu
    Copy the full SHA
    86551fd View commit details
    Browse the repository at this point in the history

Commits on Dec 31, 2022

  1. Configuration menu
    Copy the full SHA
    f52f4a6 View commit details
    Browse the repository at this point in the history