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

[Dynamic Casting] Overhauled Runtime #33561

Merged
merged 15 commits into from
Aug 27, 2020

Commits on Aug 19, 2020

  1. Dynamic Cast Rework: Runtime

    This is a completely refactored version of the core swift_dynamicCast
    runtime method.
    
    This fixes a number of bugs, especially in the handling of multiply-wrapped
    types such as Optional within Any.  The result should be much closer to the
    behavior specified by `docs/DynamicCasting.md`.
    
    Most of the type-specific logic is simply copied over from the
    earlier implementation, but the overall structure has been changed
    to be uniformly recursive.  In particular, this provides uniform
    handling of Optional, existentials, Any and other common "box"
    types along all paths.  The consistent structure should also be
    easier to update in the future with new general types.
    
    Benchmarking does not show any noticable performance implications.
    
    **Temporarily**, the old implementation is still available.  Setting the
    environment variable `SWIFT_OLD_DYNAMIC_CAST_RUNTIME` before launching a program
    will use the old runtime implementation.  This is only to facilitate testing;
    once the new implementation is stable, I expect to completely remove the old
    implementation.
    tbkka committed Aug 19, 2020
    Configuration menu
    Copy the full SHA
    df9a0f4 View commit details
    Browse the repository at this point in the history

Commits on Aug 24, 2020

  1. Streamline casting of nil just a bit

    The old `tryCastFromNil` could never fail (hence doesn't need to "try") and
    doesn't need all the arguments we were giving it.
    tbkka committed Aug 24, 2020
    Configuration menu
    Copy the full SHA
    fea5309 View commit details
    Browse the repository at this point in the history
  2. Clarify some comments

    tbkka committed Aug 24, 2020
    Configuration menu
    Copy the full SHA
    3b23ced View commit details
    Browse the repository at this point in the history
  3. Don't memoize the bridging witness for Dictionary

    We know this memoization makes a big difference for String,
    but the wins for Dictionary are less clear.  It's easy to
    add it back later if it proves helpful.
    tbkka committed Aug 24, 2020
    Configuration menu
    Copy the full SHA
    2fbb67a View commit details
    Browse the repository at this point in the history

Commits on Aug 25, 2020

  1. Clarify comment

    tbkka committed Aug 25, 2020
    Configuration menu
    Copy the full SHA
    4a3b48d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f312f6d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7e66535 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    6a3c43b View commit details
    Browse the repository at this point in the history
  5. Fix comment typo

    tbkka committed Aug 25, 2020
    Configuration menu
    Copy the full SHA
    b5b5ace View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    b09b9b9 View commit details
    Browse the repository at this point in the history

Commits on Aug 26, 2020

  1. Mark types that we should never see as "unreachable"

    Clarify the unreachable messaging a bit:
    * "Unexpected" means I knew about it but thought it could
      never appear here
    * "Unknown" means I didn't know about it when I wrote this code
    tbkka committed Aug 26, 2020
    Configuration menu
    Copy the full SHA
    df82a0f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a2cd863 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2acaa1a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    a7364ee View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0a413f0 View commit details
    Browse the repository at this point in the history