Commit graph

183 commits

Author SHA1 Message Date
Niko Matsakis
612cec6703 wip 2024-07-15 20:29:36 -04:00
Niko Matsakis
231dc4f713 wip: inputs 2024-07-14 13:36:30 -04:00
Niko Matsakis
4c998c78e4 wip 2024-07-13 11:41:19 -04:00
Niko Matsakis
c84bd1b5c2 WIP new approach with upcasts 2024-07-10 08:13:00 -04:00
Niko Matsakis
fe1b06a48a WIP-- checkpoint, dynamic jars 2024-07-08 06:25:32 -04:00
Matthijs Brobbel
c7851112a5
Rename salsa-2022 to salsa 2024-06-18 09:40:21 +02:00
Matthijs Brobbel
db75ae00a2
Remove old salsa 2024-06-18 09:25:26 +02:00
Niko Matsakis
0ad0be8095 pacify the merciless clippy 2024-05-30 08:40:18 -04:00
Niko Matsakis
e81b22315b driveby: fix use of indexmap remove
We do care about the order of things in this
set, in general, so use `shift_remove`.
2024-04-02 06:30:53 -04:00
Niko Matsakis
37a188c9b7 remove dead struct 2022-01-21 14:16:14 -05:00
Niko Matsakis
82d695b9a7 extract hashing definitions into a utility module 2022-01-21 13:49:50 -05:00
bors[bot]
2709ee4d10
Merge #288 #289
288: Make with_incremented_revision take FnOnce r=nikomatsakis a=mheiber

Removes a bug vector, since this function would
panic if the closure is used more than once.

iuc, the code opted out of the compiler's checks
before via a clever `.take()`.

Another change is to take the closure by value
rather than by reference. The monomorphization
seems harmless, since `with_incremented_revision`
is only called from two places.

289: Remove ': salsa::Database' bound from two examples r=nikomatsakis a=mheiber

Two examples had a superfluous bound
': salsa::Database' that wasn't present
in the `compiler` example and doesn't seem to be needed.

The `query_group` macro adds this bound
automatically.

This change can lead to a trailing `+` in
the bounds list. I verified this is OK by
running the examples and verifying that the production
is allowed
[per the Rust Reference](https://doc.rust-lang.org/reference/trait-bounds.html)

Co-authored-by: Maxwell Elliot Heiber <mheiber@fb.com>
2022-01-21 18:35:51 +00:00
Maxwell Elliot Heiber
befa3ddef5 Make with_incremented_revision take FnOnce
The function is morally an FnOnce, since if
called multiple times the function will panic.

iuc, the code opted out of the compiler's checks
before via a clever `.take()`.

Another change is to take the closure by value
rather than by reference. The monomorphization
seems harmless, since `with_incremented_revision`
is only called from two places.
2021-12-30 10:44:35 +00:00
Niko Matsakis
563334da17 fix comments 2021-11-13 12:02:25 -05:00
Niko Matsakis
5ebd2211a5 don't recover when not a participant
When a query Q invokes a cycle Q1...Q1 but Q is not a
participant in that cycle, Q should not recover! Test that.
2021-11-12 05:50:06 -05:00
Niko Matsakis
cb658b9b89 enable partial recovery across threads
Including the corner case where the active thread does not have
recovery.
2021-11-11 09:07:45 -05:00
Niko Matsakis
93ee78e73f factor out a helper to unblock a given runtime 2021-11-11 06:54:52 -05:00
Niko Matsakis
45434cfa93 rework cycle to permit partial recovery (wip)
This is "wip" because it does not yet handle cross-thread recovery
correctly. That is coming in a later commit.
2021-11-11 06:54:32 -05:00
Niko Matsakis
961599aa39 unwind from "block on" for panic/cancellation
We still record the same dependencies (or else the tests fail,
so +1 for test coverage).

This has the immediate advantage that we don't invoke the fallback
function twice for the repeated node in the cycle.

Also, fix a bug where revalidating cycles could lead to a
CycleParticipant error that is not caught (added a test for it).
2021-11-08 08:07:45 -05:00
Niko Matsakis
62e2fabab9 on fallback, get deps from all cycle participants
We used to store a changed-at/durability that reflected only
the current frame in a cycle -- but really we are dependent
across the entire cycle, so we now store the max changed-at and
min durability from the entire thing.
2021-11-02 06:18:58 -04:00
Niko Matsakis
7dbacbcf2b rotate the participants in the cycle once
Rotate the participants in the cycle when the cycle is created
rather than doing it "on the fly" each time they are iterated.
2021-11-02 06:13:18 -04:00
Niko Matsakis
3f95c0b4a0 panic when recovering from a cycle
It turns out this is necessary, as this test reveals!
If we don't panic, you might encounter further cycles
that aren't supposed to have executed. (Prior to these changes,
this test was panicking from the second cycle.)
2021-11-01 10:10:50 -04:00
Niko Matsakis
1027342468 introduce QueryRevisions and use everywhere
`QueryRevisions` is a shared struct that contains
"everything a query read thus far" -- it is roughly
the old `MemoRevisions` but without `verified_at`.

This change is useful because when a cycle occurs it
allows us to isolate out "inputs thus far" more easily.
2021-11-01 06:10:07 -04:00
Niko Matsakis
75ee3edd2e introduce Cycle type and use in recovery, errors
The Cycle type gives more structured information and ensures
deterministic ordering of participants within any particular
execution.
2021-10-31 07:21:07 -04:00
Niko Matsakis
61599cc81a report unexpected cycles using Cancelled
The `Cancelled` struct now reflects multiple potential reasons
for a query execution to be cancelled, including unexpected cycles.
It also gives information about the participants that lacked
recovery information.
2021-10-31 06:18:50 -04:00
Niko Matsakis
4a1dffe7bc cleanup: move cycle recovery into try_block_on
This is just a refactoring.
2021-10-31 05:39:15 -04:00
Niko Matsakis
cb00077ebc silence clippy warnings
cargo clippy --fix ftw
2021-10-30 17:20:32 -04:00
Niko Matsakis
0af2a9fba7 add helper for pushing queries
This permits us to separate pushing on the query stack
from executing the query.
2021-10-30 11:46:30 -04:00
Niko Matsakis
54277d4ad1 remove silly duration parameter 2021-10-30 11:45:18 -04:00
Niko Matsakis
293e103c09 make "maybe changed since" share code with read
It is still *slightly* different from `read`.
This seems to have fixed various bugs.
2021-10-30 11:45:12 -04:00
Niko Matsakis
dc5ea932ef WaitResult can just be panicked|completed now 2021-10-30 11:38:27 -04:00
Niko Matsakis
de7ac896bc put cycle participants into an arc
Because it bugs me to clone the vector.

Maybe silly, I admit, since cycle recovery
is not the hot path.

But by that same token, we now spend only 1 word
for a null pointer instead of 4 words for a (usually empty) vector.
2021-10-30 11:37:23 -04:00
Niko Matsakis
5bd2cbcb20 remove unnecessary type argument K 2021-10-30 11:37:21 -04:00
Niko Matsakis
35ddd36b49 move the stack instead of cloning
Currently, when one thread blocks on another, we clone the
stack from that task. This results in a lot of clones, but it also
means that we can't mark all the frames involved in a cycle atomically.
Instead, when we propagate information between threads, we also
propagate the participants of the cycle and so forth.

This branch *moves* the stack into the runtime while a thread
is blocked, and then moves it back out when the thread resumes.
This permits the runtime to mark all the cycle participants at once.
It also avoids cloning.
2021-10-30 11:35:04 -04:00
Niko Matsakis
e83bae717d have runtime coordinate blocking
Instead of creating a future for each edge
in the graph, we now have all dependent queries
block in the runtime and wake up whenever results
are published to see if their results are ready.

We could certainly allocate a CondVar for each dependent
query if we found that spurious wakeups were a problem.
I consider this highly unlikely in practice.
2021-10-30 11:32:56 -04:00
Niko Matsakis
3c094d2932 midpoint: make runtime take wait-result
Thi sis an intermediate step towards having the runtime
coordinate wakeups.
2021-10-30 11:31:18 -04:00
Niko Matsakis
21cb4ef9d6 move WaitResult to runtime
We are going to make it so that the runtime
coordinates delivery of the WaitResults.
2021-10-30 11:31:16 -04:00
Niko Matsakis
f5a15e55c6 rework the dep-graph API to take the lock
This will allow me to add condvar logic to it
2021-10-30 11:30:21 -04:00
Niko Matsakis
ec38398991 extract the depends_on helper function
Make `add_edge` infallible
2021-10-30 11:30:21 -04:00
Niko Matsakis
e870d02da1 make the dep-graph not generic
Being generic over the keys made code harder to read.
2021-10-30 11:30:21 -04:00
Niko Matsakis
da188fe609 extract DependencyGraph into its own module 2021-10-30 11:30:12 -04:00
Niko Matsakis
0298163211 move CycleError to the plumbing module 2021-10-30 11:27:04 -04:00
Niko Matsakis
187bd54fa9 move CycleError to plumbing 2021-10-30 11:27:01 -04:00
Niko Matsakis
42a653ca6f use computed recovery strategy
Rather than checking return value of from `Q::cycle_fallback`, we
now consult the computed recovery strategy to decide whether to
panic or to recover. We can thus assume that we will successfully
recover and don't need to check for `None` results anymore.
2021-10-30 11:19:09 -04:00
Niko Matsakis
bcffa4a836 find cycle recovery strategy for a given cycle 2021-10-30 11:10:07 -04:00
Niko Matsakis
853006fccf isolate find_cycle_participants into its own fn 2021-10-30 11:09:24 -04:00
Niko Matsakis
7b4ee6fc34 improve panic error message 2021-10-30 11:09:08 -04:00
Jonas Schievink
8f0b9b7f82 Fix invalidate and report_synthetic_read 2021-09-03 23:35:15 +02:00
Tim Robinson
fc6806a07c CI runs Clippy 2021-06-17 15:21:51 +01:00
Niko Matsakis
d178d1b765 update a few comments that mention gc 2021-06-06 06:20:23 -04:00