Commit graph

197 commits

Author SHA1 Message Date
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
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
Kevin Leimkuhler
461ab22822 Change uses of fork to snapshot 2018-11-01 11:26:16 -07:00
Kevin Leimkuhler
83482293c6 Use Event API and add docs 2018-11-01 11:26:16 -07:00
Kevin Leimkuhler
5bface5bb9 Ensure parallel panic safety and add test 2018-11-01 11:26:16 -07:00
Aleksey Kladov
229c0b944d make Snapshot Debug 2018-11-01 15:16:57 +03:00
Niko Matsakis
d689d02117 remove outdated note on atomicity; not a concern anymore 2018-11-01 05:03:09 -04:00
Niko Matsakis
341619d20e reorganize to put "how to implement this" at the end 2018-11-01 05:02:33 -04:00
Niko Matsakis
5a88871b9a improve snapshot docs
Using two snapshots from the same thread isn't really very easy to do,
so we don't have to warn about that really (it's really nested use of
snapshots that's a problem, and to do that you have to use thread-locals
or something just to get the snapshot *into* the database -- at that
point, something is really going wrong)).
2018-11-01 05:01:13 -04:00
Niko Matsakis
a8ca57c06d document (and start warning on missing docs) 2018-11-01 04:57:52 -04:00
Niko Matsakis
49cc8abe43 introduce query_mut which you must use to get set methods 2018-11-01 04:53:56 -04:00
Niko Matsakis
e070bf9809 s/Frozen/Snapshot/ 2018-10-31 20:06:06 -04:00
Niko Matsakis
fc2a720ae2 s/fork/snapshot/ 2018-10-31 20:05:31 -04:00
Niko Matsakis
5066726147 panic if you fork from inside a query for now 2018-10-31 16:03:03 -04:00
Niko Matsakis
2a6b8e07f9 remove the query_in_progress field 2018-10-31 15:59:00 -04:00
Niko Matsakis
252132f9b4 remove the start_query function, which is no longer needed 2018-10-31 13:31:29 -04:00
Niko Matsakis
b0171dbc11 remove fork_mut and adopt new strategy
Required simplifying the various tests.
2018-10-31 12:01:36 -04:00
Niko Matsakis
38dc4c31dd introduce fork, which yields a frozen handle 2018-10-31 06:05:03 -04:00
Niko Matsakis
9cac418ac8 rename fork to fork_mut 2018-10-31 06:03:33 -04:00
Niko Matsakis
2e3f8b1a3d name the field runtime_id 2018-10-30 21:00:33 -04:00
Niko Matsakis
59ab0bd7a2 introduce simple callbacks that can be used to build better logging 2018-10-30 20:19:25 -04:00
Niko Matsakis
39dd71ff66 remove use of upgradable_read from input queries 2018-10-30 15:08:09 -04:00
Niko Matsakis
7cfcbd73b8 remove unnecessary upgradable_read 2018-10-30 14:41:24 -04:00
Niko Matsakis
79e24cfa55 fix typo 2018-10-30 14:40:58 -04:00
Niko Matsakis
abeebfedc8 improve the error message here 2018-10-30 14:40:58 -04:00
Niko Matsakis
1c2b4d8d43 be more careful when updating after a dependency check 2018-10-30 14:40:58 -04:00
Niko Matsakis
aea746cb91
Merge pull request #69 from nikomatsakis/input-policies
add input policies to permit a wider range of inputs
2018-10-30 13:37:10 -04:00
Niko Matsakis
6c75c57cd9 fix docs 2018-10-30 13:19:59 -04:00
Niko Matsakis
13ae45d441 remove input policies 2018-10-30 12:59:33 -04:00
Niko Matsakis
b2c282ff6c
Merge pull request #71 from matklad/more-panics
Panic in PanicGuard if it's not explicitly forgotten
2018-10-29 13:15:56 -04:00
Aleksey Kladov
f66f1913b7 reexport revision guard 2018-10-29 17:09:50 +03:00
Aleksey Kladov
0f4d1e8320 Panic in PanicGuard if it's not explicitly forgotten 2018-10-29 15:53:11 +03:00
Niko Matsakis
8a0f57d5c3 storage input has its own section now 2018-10-27 06:44:28 -04:00
Niko Matsakis
e6d7cee501 no need for format! in panic! 2018-10-27 06:44:19 -04:00
Niko Matsakis
042f89e7f8 add input policies to permit a wider range of inputs 2018-10-26 19:34:11 -04:00
Niko Matsakis
c21ea47cfc introduce SweepStrategy 2018-10-25 05:48:37 -04:00
Niko Matsakis
74cecb6ea5 make sweep_all public and document a *bit* better =) 2018-10-25 05:48:37 -04:00