Commit graph

232 commits

Author SHA1 Message Date
Niko Matsakis
e3f5eb6ee8 implement #[salsa::interned] query storage 2019-02-03 20:45:52 +01:00
Aleksey Kladov
e3c07b010a fast-path no-op gc as well 2019-01-29 19:41:15 +03:00
Aleksey Kladov
f9cae4f2eb just clear the table if we are goining to collect everything 2019-01-29 17:30:43 +03:00
Niko Matsakis
58ba8ac425 rename Query::group_storage method to Query::query_storage 2019-01-28 05:01:53 -05:00
Niko Matsakis
1002d7e70a
Merge pull request #138 from matklad/flexible-gc
Make GC API more orthogonal and flexible
2019-01-28 04:51:02 -05:00
memoryruins
ebd4990bde remove UncheckedMutQueryStorageOps 2019-01-27 17:52:53 -05:00
memoryruins
7d12f4f93a remove set_unchecked methods 2019-01-27 17:01:00 -05:00
Aleksey Kladov
9387fd2f4d more orthogonal naming 2019-01-27 17:14:57 +03:00
Aleksey Kladov
d01d6ed511 Make GC API more orthogonal and flexible
Now, the effect of GC is a "product" of three parameters:

* what values are affected (everything/everything except used)
* are we removing values
* are we removing deps

SweepStrategy::default is now a no-op GC.
2019-01-26 21:38:15 +03:00
Niko Matsakis
9b5c7eeb5e change #[salsa::query_group] attribute to take a struct name 2019-01-25 10:26:39 -05:00
Niko Matsakis
690a118472 consolidate into one HasQueryGroup trait 2019-01-25 09:21:11 -05:00
Niko Matsakis
3d1f9dac2d
Merge pull request #122 from matklad/debug
allow to peek at values via debug query interface
2019-01-25 05:13:27 -05:00
Niko Matsakis
1528746267 adopt key, group key, and database key terminology 2019-01-24 06:33:02 -05:00
Niko Matsakis
6451c820b7 rename fns to group_foo 2019-01-24 05:50:13 -05:00
Niko Matsakis
8ad5051a74 make the QueryTable impl totally generic 2019-01-24 05:29:04 -05:00
Niko Matsakis
2924e98f40 add GroupStorage, GroupDescriptor to Query trait 2019-01-24 05:22:31 -05:00
Niko Matsakis
1c415b0c9d rename FromQueryGroupDescriptor and add comments 2019-01-24 05:18:43 -05:00
Niko Matsakis
19d64fd281 add FromQueryGroupDescriptor trait and implement/use it 2019-01-23 11:57:03 -05:00
Niko Matsakis
f3483d1a22 defer for-each-query to the query-group 2019-01-23 10:56:01 -05:00
Niko Matsakis
6cfaf021b0 introduce the GetQueryGroupStorage trait and use it 2019-01-23 08:52:31 -05:00
Aleksey Kladov
a5349b8330 remove debug keys in favor of entries 2019-01-23 14:23:26 +03:00
Aleksey Kladov
a3bbba6187 allow to peek at values via debug query interface 2019-01-22 23:33:45 +03:00
Niko Matsakis
3e81f12dd2
Merge pull request #115 from nikomatsakis/move-unwind-safe-impls
move the RefUnwindSafe impls to shared/local state structs
2019-01-21 11:16:17 -05:00
Niko Matsakis
5f9309f108 remove database_storage macro-rules macro 2019-01-21 10:59:47 -05:00
Cormac Relf
3b15a09b8e replace $crate with salsa in proc macro and make hello_world run 2019-01-21 10:59:12 -05:00
Cormac Relf
38dff4784d add #[doc(hidden)] to __SalsaQueryDescriptor 2019-01-21 20:08:38 +11:00
Niko Matsakis
4ed95c4aae include condition that the storage be unwind safe 2019-01-18 08:53:12 -05:00
Niko Matsakis
4158a4dba5 move the RefUnwindSafe impls to shared/local state structs 2019-01-18 07:12:17 -05:00
Niko Matsakis
f0c5cffd89 add Drop to recover from panic gracefully 2019-01-18 05:52:47 -05:00
Niko Matsakis
21519e6ff7 introduce a ActiveQueryGuard type 2019-01-18 05:49:25 -05:00
Niko Matsakis
15e1366d81 move local-state into its own module 2019-01-18 05:43:39 -05:00
Niko Matsakis
500a60d40d make LocalState encapsulate its state 2019-01-18 05:38:44 -05:00
Niko Matsakis
a2e1d82dee
Merge pull request #110 from matklad/cancelation-docs
document *why* one may want to call is_current_revision_canceled
2019-01-17 05:31:27 -05:00
Niko Matsakis
0f577a2b10 generate an impl of the trait from procedural macro
Instead of generating

```rust
trait Query: GetQueryTable<Foo> {
    fn foo() { .. }
}
```

generate

```rust
trait Query {
}

impl<T> Query for T
where
    T: GetQueryTable<Foo>,
{
    fn foo() { .. }
}
```
2019-01-17 05:04:27 -05:00
Fabian Schuiki
93c30a953d make query_group macro procedural
Switch to a procedural implementation of the `query_group!` macro,
residing in the `components/salsa_macros` subcrate.

Allow the user to override the invoked function via `salsa::invoke(...)`
and the name of the generated query type via `salsa::query_type(...)`.

In all tests, replace the `salsa::query_group! { ... }` invocations with
the new attribute-style `#[salsa::query_group]` macro, and change them
to the new naming scheme for query types (`...Query`).

Update README, examples, and documentation.
2019-01-17 07:24:18 +01:00
Aleksey Kladov
785b73c597 document *why* one may want to call is_current_revision_canceled 2019-01-15 13:45:09 +03:00
Aleksey Kladov
61e1d69fb5 preserve both cancellation strategies 2019-01-11 10:13:38 +03:00
Aleksey Kladov
f07643d232 runtime is unwind-safe iff storage is unwind-safe 2019-01-11 10:04:09 +03:00
Aleksey Kladov
b637e1a9bb mark runtime as UnwindSafe
An alternative would be to mark bit of state as runtime safe, but as
Runtime directly contains a RefCell we need to mark it as a whole
anyway!
2019-01-10 13:34:20 +03:00
Aleksey Kladov
add15d83ea add panic hooks
To implement cancellation via unwinding, one needs to throw `Canceled`
value in `if_current_revision_is_canceled` and `on_propagated_panic`.
2019-01-10 12:15:37 +03:00
Niko Matsakis
b3c7ec9f0d change cancelation mechanism and track "anon" reads when uncanceled 2019-01-04 13:50:50 -05:00
Niko Matsakis
d6990133b4 add debug logs 2019-01-04 08:39:59 -05:00
Niko Matsakis
f5871e4c2f revert transitive report_untracked_read change 2019-01-04 08:39:42 -05:00
Aleksey Kladov
a2198f1f8a prevent untracked queries from moving brackwards in time
If a query observes an untracked read, it gets changed_at equal to the
current revision. When we re-validate the query later, if it doesn't
do an untracked read this time, it gets changed_at equal to the
maximum of the dependencies. Crucially, this new changed_at may
be **older** then the previous value of changed_at. That is, we break
the rule that `changed_at` monotonically increases.

This can lead to missed re-executions down the line (see the added
test).

closes #66
2018-12-30 10:54:34 +03:00
Niko Matsakis
7074e258ba
Merge pull request #98 from matklad/debug
show SharedState in Debug for Runtime
2018-12-28 10:25:16 -05:00
Niko Matsakis
2e4ff9a26e remove use of upgradable reads from derived queries 2018-12-24 10:10:22 -05:00
Aleksey Kladov
52206d5421 show SharedState in Debug for Runtime
This should be useful to debug deadlocks due to bad forking.
2018-12-21 12:12:06 +03:00
Niko Matsakis
3cde493e4e remove the virtual fn call for creating query descriptors
Previously, to "make the connection" between the database type `DB` and
the query type `Q`, we were passing down a fn pointer that would crate
the query descriptor. But now we have this `GetQueryTable` trait -- use
that instead.
2018-12-13 05:51:45 -05:00
Niko Matsakis
1af16d5d7c
Merge pull request #81 from kleimkuhler/issue-24-ensure-parallel-panic-safety
Ensure parallel panic safety
2018-11-04 06:22:28 -05:00
Kevin Leimkuhler
bc60b09fc7 Refactor overwrite_placeholder into PanicGuard 2018-11-01 16:53:08 -07:00