Commit graph

88 commits

Author SHA1 Message Date
Niko Matsakis
9df075b63c reset accumulators on new revisions, etc
Accumulators don't currently work across revisions
due to a few bugs. This commit adds 2 tests to show
the problems and reworks the implementation strategy.

We keep track of when the values in an accumulator were pushed
and reset the vector to empty when the push occurs in a new
revision.

We also ignore stale values from old revisions
(but update the revision when it is marked as validated).

Finally, we treat an accumulator as an untracked read,
which is quite conservative but correct. To get better
reuse, we would need to (a) somehow determine when different
values were pushed, e.g. by hashing or tracked the old values;
and (b) have some `DatabaseKeyIndex` we can use to identify
"the values pushed by this query".

Both of these would add overhead to accumulators and I didn'τ
feel like doing it, particularly since the main use case for
them is communicating errors and things which are not typically
used from within queries.
2022-08-17 06:47:11 -04:00
Niko Matsakis
2a9f0f7140 add accumulation test
I can't seem to get it to perform incorrectly lol,
what am I missing.
2022-08-17 04:43:25 -04:00
XFFXFF
2778750fdf add a broken test for lru 2022-08-17 07:22:45 +08:00
Niko Matsakis
f2a67ae527 update expected logs
input fields no longer generate WillCheckCancellation events
2022-08-16 17:58:51 -04:00
Niko Matsakis
689751b243 wire up salsa struct seletion, test it
We now delete entities and data associated with them!
Neat!
2022-08-16 17:55:32 -04:00
Mihail Mihov
07dd72470e Rename compare_and_swap to mutate_in_place 2022-08-14 20:24:57 +03:00
Mihail Mihov
5e79fb42e3 Add "compare and swap" test 2022-08-13 18:22:44 +03:00
Niko Matsakis
e2763aba88 change approach: eagerly verify, don't remove
This approach is more compatible with our overall "pull" result,
and it also means we can get more re-use.
2022-08-13 01:21:45 -04:00
Niko Matsakis
37e7eeb3fd delete stale output values
This fixes the behavior of `specify_tracked_fn_in_rev_1_but_not_2`,
mostly, though I realize now that it is suboptimal.
2022-08-13 01:21:45 -04:00
Niko Matsakis
8accccdbce diff outputs when replacing a memoized value
We don't do anything with this info right now besides log it,
but the logs show we are reporting it at the right times
in the `specify_tracked_fn_in_rev_1_but_not_2` test
(also fix an oversight in the test where it was creating a new input
each time).
2022-08-13 01:21:45 -04:00
Niko Matsakis
b65207ccbc add broken test for specify
We specify the value for the field in 1 rev but
fail to specify in the next revision. The old value
is (currently) never cleared.
2022-08-13 01:21:45 -04:00
Niko Matsakis
5722b333ed Revert "add broken test for specify"
This reverts commit 87ff990774.
2022-08-12 14:28:31 -04:00
Niko Matsakis
afefcdf335 Revert "diff outputs when replacing a memoized value"
This reverts commit 1e3272bc61.
2022-08-12 14:28:25 -04:00
Niko Matsakis
1e3272bc61 diff outputs when replacing a memoized value
We don't do anything with this info right now besides log it,
but you can see that we are reporting it at the right times
in the `specify_tracked_fn_in_rev_1_but_not_2` test
(also fix an oversight in the test where it was creating a new input
each time).
2022-08-11 00:56:15 -04:00
Niko Matsakis
87ff990774 add broken test for specify
We specify the value for the field in 1 rev but
fail to specify in the next revision. The old value
is (currently) never cleared.
2022-08-10 01:45:15 -04:00
Niko Matsakis
d72803c027 don't mark specified values as volatile
This is what we want, but it's not a complete fix.
It does make these tests work, though!
Good enough to commit.
2022-08-10 00:42:32 -04:00
Niko Matsakis
27a240aa86 comment out red_herring tests
They do not pass (yet)
2022-08-10 00:42:32 -04:00
Niko Matsakis
7e747f357c enable logging for tracked-fn-read-own-entity test 2022-08-10 00:42:32 -04:00
Niko Matsakis
f513f46380 add comments, remove dead-code lints 2022-08-10 00:42:32 -04:00
Niko Matsakis
323e677182 enable logging of salsa events by default
and add logging to tests
2022-08-10 00:42:27 -04:00
Niko Matsakis
00172efb19 add red-herring tests which modify distinct inputs 2022-08-10 00:42:05 -04:00
bors[bot]
9ff6fb3376
Merge #336
336: Add options to tracked functions for cycle recovery r=nikomatsakis a=XFFXFF

closes #331 

This pr ports the old salsa tests for cycle in a single thread, except for [cycle_disappears_durability](03a27a7054/tests/cycles.rs (L326)), since we don't have the api that permits setting durability.  

~I haven't ported parallel related tests, which would be some work, wondering if we can merge this in first~

Co-authored-by: XFFXFF <1247714429@qq.com>
2022-08-10 04:14:16 +00:00
XFFXFF
d32cff1bfb define Jar struct separately 2022-08-10 07:28:13 +08:00
XFFXFF
9feb0050e4 ports parallel related tests for cycle 2022-08-09 18:06:39 +08:00
XFFXFF
9fb5f7a366 add some comments 2022-08-09 08:43:44 +08:00
XFFXFF
80bfff8d7a port old tests for cycle in a single thread 2022-08-09 07:54:15 +08:00
XFFXFF
045f5186b3 modify tracked_fn macro to use it 2022-08-08 08:57:29 +08:00
XFFXFF
0f907dd3cd add recovery_fn option 2022-08-08 07:32:39 +08:00
XFFXFF
815bf6003b add a test 2022-08-08 07:20:39 +08:00
XFFXFF
1ec4e45a7f test: expect reuse field X changes but fn depends on field Y 2022-08-07 12:43:45 +08:00
Niko Matsakis
3b3e0be981 make salsa-2022 tests into independent files
also add a few new tests
2022-08-06 10:43:43 -04:00
Niko Matsakis
e0c3109d6a add a test where we change the input 2022-08-06 02:27:20 -04:00
Niko Matsakis
fa2d24a0be squash (some) warnings 2022-08-05 14:32:12 -04:00
Niko Matsakis
66f1f1c50c rename salsa-entity to salsa-2022 2022-08-05 13:20:14 -04:00
Niko Matsakis
11fb9823cc remove blank line 2022-08-05 02:57:22 -04:00
Niko Matsakis
4f234cfbb9 remove component and replace with specify option
You can now do `#[salsa::tracked(specify)]` and you will
get a method `some_fn::specify(...)` that can be used to
specify the value.
2022-08-05 02:51:13 -04:00
Niko Matsakis
89f801276c another simple test 2022-08-05 00:41:00 -04:00
Niko Matsakis
627eddd428 add a test for tracked functions 2022-08-05 00:39:00 -04:00