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

Proposal: Low level struct improvements #3936

Merged
merged 9 commits into from
Sep 29, 2020
Merged

Commits on Sep 23, 2020

  1. Proposal: Low level struct improvements

    This design covers adding the following features to C# for low level
    struct performance improvements:
    
    - Allowing `ref struct` to contain `ref` fields.
    - Allowing `struct` and `ref struct` to return `ref` to their fields.
    - Allowing safe fixed buffers for unmanaged and managed types.
    
    Note: the section on providing parameter escape notations is incomplete
    at this time. I will send a PR in the future once I finalize this
    portion. Feel free to still leave comments though.
    jaredpar committed Sep 23, 2020
    Configuration menu
    Copy the full SHA
    9dd6863 View commit details
    Browse the repository at this point in the history

Commits on Sep 24, 2020

  1. Update proposals/low-level-struct-improvements.md

    Co-authored-by: Ruikuan <liruikuan@outlook.com>
    jaredpar and Ruikuan authored Sep 24, 2020
    Configuration menu
    Copy the full SHA
    b83c02c View commit details
    Browse the repository at this point in the history
  2. Apply suggestions from code review

    Co-authored-by: Ruikuan <liruikuan@outlook.com>
    jaredpar and Ruikuan authored Sep 24, 2020
    Configuration menu
    Copy the full SHA
    8fff276 View commit details
    Browse the repository at this point in the history
  3. Apply suggestions from code review

    Co-authored-by: Joseph Musser <me@jnm2.com>
    jaredpar and jnm2 authored Sep 24, 2020
    Configuration menu
    Copy the full SHA
    610ce4b View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2020

  1. Rename to ThisRefEscapes

    The name `[RefEscapes]` was causing a lot of confusion in the
    discussions. People were mis-interpretting it as a general feature that
    could apply to other constructs when in reality it's a very specific and
    targetted feature. Renaming to `[ThisRefEscapes]` to make it clear this
    is a very targetted feature.
    jaredpar committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    7af7ca3 View commit details
    Browse the repository at this point in the history
  2. Make ref field assignment more flexible

    Based on feedback from several people I've decided that we need to make
    the rules for `ref` fields more flexible when the values being passed
    around are known to refer to the heap. In those cases there is simply no
    reason to restrict the created `ref struct` as it is always
    *ref-safe-to-escape* to the enclosing method as well as not requiring
    any adjustment to the method invocation rules.
    
    This does mean that we need to add the notion of "refers to the heap" to
    the span safety document. That doesn't change any assumptions there.
    It's just that before this change the notion of "refers to the heap"
    wasn't necessary to describe our safety rules.
    jaredpar committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    fbdda3c View commit details
    Browse the repository at this point in the history
  3. Fixed buffer updates

    jaredpar committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    a34b6d7 View commit details
    Browse the repository at this point in the history
  4. modreq clarification

    jaredpar committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    da1b2a4 View commit details
    Browse the repository at this point in the history
  5. Small update

    jaredpar committed Sep 28, 2020
    Configuration menu
    Copy the full SHA
    67e7e40 View commit details
    Browse the repository at this point in the history