Skip to content

WIP: force monomorphisation in definig crate #236

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

Closed
wants to merge 41 commits into from
Closed

Conversation

matklad
Copy link
Member

@matklad matklad commented Jul 6, 2020

No description provided.

Update book/src/rfcs/RFC0006-Dynamic-Databases.md

Co-authored-by: Aleksey Kladov <[email protected]>

Update book/src/rfcs/RFC0001-Query-Group-Traits.md

Co-authored-by: bjorn3 <[email protected]>

Update book/src/rfcs/RFC0006-Dynamic-Databases.md

Co-authored-by: Aleksey Kladov <[email protected]>

fix lint warnings on RFC
The goal is to eliminate the "shared state guard" argument, which
currently requires access to the database.
Now the `with_incremented_revision` method signature does not
reference the database DB in any way.
nikomatsakis and others added 11 commits July 4, 2020 14:17
This will be more compatible once we move to having queries have an
associated `DynDb` type. It also reads nicely.
This had two unexpected consequences, one unfortunate, one "medium":

* All `salsa::Database` must be `'static`. This falls out from
`Q::DynDb` not having access to any lifetimes, but also the defaulting
rules for `dyn QueryGroup` that make it `dyn QueryGroup + 'static`. We
don't really support generic databases anyway yet so this isn't a big
deal, and we can add workarounds later (ideally via GATs).

* It is now statically impossible to invoke `snapshot` from a query,
and so we don't need to test that it panics. This is because the
signature of `snapshot` returns a `Snapshot<Self>` and that is not
accessible to a `dyn QueryGroup` type. Similarly, invoking
`Runtime::snapshot` directly is not possible becaues it is
crate-private. So I removed the test. This seems ok, but eventually I
would like to expose ways for queries to do parallel
execution (matklad and I had talked about a "speculation" primitive
for enabling that).

* This commit is 99% boilerplate I did with search-and-replace. I also
rolled in a few other changes I might have preferred to factor out,
most notably removing the `GetQueryTable` plumbing trait in favor of
free-methods, but it was awkward to factor them out and get all the
generics right (so much simpler in this version).
It's simpler to just store a DatabaseKeyIndex. It may be somewhat
slower, we'll have to measure.  But we can add back in this other
design later if we want.
This should enable more sharing and less monomorphization. There is
probably room for more radical restructing in this vein.
@matklad
Copy link
Member Author

matklad commented Jul 7, 2020

folded in #231

@matklad matklad closed this Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants