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

New database design #538

Merged
merged 29 commits into from
Aug 4, 2024
Merged

New database design #538

merged 29 commits into from
Aug 4, 2024

Commits on Jul 28, 2024

  1. remove upcast_mut

    We only ever need to upcast to shared references.
    
    This change isn't necessary, just dead code
    cleanup.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    9e8635c View commit details
    Browse the repository at this point in the history
  2. as_salsa_database => as_dyn_database

    Also, move to a blanket impl'd trait.
    Overall cleaner approach.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    bc72bdf View commit details
    Browse the repository at this point in the history
  3. hide internal methods behind a Zalsa trait

    The traits are now quite simple:
    
    * Database is the external trait
    * ZalsaDatabase is the internal one, implemented
      by `#[salsa::db]`. It adds two methods,
      `zalsa` and `zalsa_mut`. Those give access
      to our internal methods.
    
    For now I've hidden the methods behind
    `&dyn Zalsa`. This is nice and clean but it may
    be worth later refactoring to a `struct Zalsa`.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    596461c View commit details
    Browse the repository at this point in the history
  4. (almost) encansulate Runtime into Zalsa

    The distinction is dumb and should go away.
    But we still need it for a bit.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    1842b1d View commit details
    Browse the repository at this point in the history
  5. make event generation lazy

    Creating events if nobody is listening has
    always bugged me.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    64556e9 View commit details
    Browse the repository at this point in the history
  6. switch to new database design

    Under this design, *all* databases are a
    `DatabaseImpl<U>`, where the `U` implements
    `UserData` (you can use `()` if there is none).
    
    Code would default to `&dyn salsa::Database` but
    if you want to give access to the userdata, you
    can define a custom database trait
    `MyDatabase: salsa::Databse` so long as you
    
    * annotate `MyDatabase` trait definition of
      impls of `MyDatabase` with `#[salsa::db]`
    * implement `MyDatabase` for `DatabaseImpl<U>`
      where `U` is your userdata (this could be a
      blanket impl, if you don't know the precise
      userdata type).
    
    The `tests/common/mod.rs` shows the pattern.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    daaa780 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    62f1587 View commit details
    Browse the repository at this point in the history
  8. merge handle into the database

    Separate handles are no longer needed.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    138ca4b View commit details
    Browse the repository at this point in the history
  9. improve comments

    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    8e9ebba View commit details
    Browse the repository at this point in the history
  10. move local-state into DatabaseImpl

    Each clone gets an independent local state.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    a675810 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f8b1620 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    8562824 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    34e109d View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    703e12d View commit details
    Browse the repository at this point in the history
  15. encapsulate Runtime within Zalsa

    The aim is to eventually eliminate Runtime.
    nikomatsakis committed Jul 28, 2024
    Configuration menu
    Copy the full SHA
    d141cd8 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    9054377 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    3254f46 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    ab112b7 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    502716d View commit details
    Browse the repository at this point in the history

Commits on Jul 29, 2024

  1. Configuration menu
    Copy the full SHA
    4995ce0 View commit details
    Browse the repository at this point in the history
  2. Implement DerefMut

    MichaReiser committed Jul 29, 2024
    Configuration menu
    Copy the full SHA
    12e0741 View commit details
    Browse the repository at this point in the history

Commits on Aug 4, 2024

  1. Configuration menu
    Copy the full SHA
    4d2ccff View commit details
    Browse the repository at this point in the history
  2. update debug output

    nikomatsakis committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    cafbe92 View commit details
    Browse the repository at this point in the history
  3. add a justfile for convenience

    This should really be synchronized with the
    codespaces and github configuration but...
    I'm not clever enough to do all that.
    nikomatsakis committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    9f95b37 View commit details
    Browse the repository at this point in the history
  4. just cache the index

    nikomatsakis committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    bca9180 View commit details
    Browse the repository at this point in the history
  5. make the Views type miri-safe

    and add more comments
    nikomatsakis committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    83be1e4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    118e89c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6ff1975 View commit details
    Browse the repository at this point in the history
  8. stop ignoring miri

    nikomatsakis committed Aug 4, 2024
    Configuration menu
    Copy the full SHA
    1bce41f View commit details
    Browse the repository at this point in the history