Jonas Schievink
08c7a6bd63
Include user-readable query keys in cycle errors
2021-05-06 19:56:05 +02:00
Jonas Schievink
dae31a9bb7
Log MemoInputs
in human-readable form
2021-05-05 15:34:58 +02:00
Andrew Hickman
b275d36adf
Allow using a borrowed key in DerivedQueryStorageOps::invalidate
2020-09-24 14:35:52 +03:00
Niko Matsakis
2e2239a307
Merge pull request #242 from Marwes/lift_static_restriction
...
feat: Allow the dynamic db to be non-static
2020-09-09 10:52:50 -04:00
Niko Matsakis
2084b99ba4
Merge pull request #240 from matklad/purge
...
Add purge method
2020-07-31 14:17:00 -04:00
Markus Westerlind
3a84a77ebc
Remove some unnecessary changes
2020-07-24 11:23:41 +02:00
Markus Westerlind
e2ab6c8bfa
feat: Allow the dynamic db to be non-static
2020-07-23 17:08:06 +02:00
Aleksey Kladov
35a420d0c0
Remove LRU distribution tests
...
They are ignored and in the git history anyway.
2020-07-23 11:36:38 +02:00
Markus Westerlind
ce6428fbbd
Lift the static restriction on the traits
2020-07-23 11:34:20 +02:00
Aleksey Kladov
b460db700a
Switch from rand to oorandom
...
The primary motivation here is reducing dependencies. rand has quite a
few of them, and many come from `getrandom` crate (bindings to system
APIs to get true randomness). Some of `getrandom` crates don't have
Apache 2.0 OR MIT license, and it probably doesn't make sense to make
salsa's licensing situation more complicated for feature we don't even
use.
There's a number of small&fast random crates there:
* randomize
* oorandom
* fastrand
I've picked oorandom because it was the simplest & smallest (doesn't
have a thread_local RNG, for example).
2020-07-23 11:30:23 +02:00
Aleksey Kladov
5f53837458
Add purge method
...
This is mostly useful for debugging, rust-analyzer uses it to measure
memory usage of tables
2020-07-22 18:41:53 +02:00
Niko Matsakis
b00981935a
fix doc tests
2020-07-07 09:59:57 +00:00
Niko Matsakis
b66eb81311
experiment: extract some Memo code to be independent from Q
...
This should enable more sharing and less monomorphization. There is
probably room for more radical restructing in this vein.
2020-07-06 00:55:01 +00:00
Niko Matsakis
fad97eeb6a
remove the DB
parameter
...
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).
2020-07-04 14:17:11 +00:00
Niko Matsakis
d64dfa1727
make for_each_query
dyn-safe
2020-07-04 14:17:11 +00:00
Niko Matsakis
0e5366df5d
move to QueryType.in_db(&db)
instead of db.query(QueryType)
...
This will be more compatible once we move to having queries have an
associated `DynDb` type. It also reads nicely.
2020-07-04 14:17:11 +00:00
Niko Matsakis
7a5b515279
make DatabaseStorageTypes have supertrait of Database
2020-07-04 14:17:11 +00:00
Niko Matsakis
12f54d66f4
move query/query-mut to DatabaseQueryExt
2020-07-04 14:17:11 +00:00
Niko Matsakis
28b642e8c0
make DB
?Sized
on execute_query_implementation
helper
2020-07-04 14:17:11 +00:00
Niko Matsakis
d1fe9950c5
simplify salsa_event
and make it dyn-safe
2020-07-04 14:17:11 +00:00
Niko Matsakis
67687376ed
implement the Storage<DB> change
2020-07-04 14:17:10 +00:00
Niko Matsakis
c6663f3dcb
return durability of modified data and remove SharedStateWriteGuard
...
Now the `with_incremented_revision` method signature does not
reference the database DB in any way.
2020-07-04 14:16:50 +00:00
Niko Matsakis
705a35d4b7
pass 'new revision' as an explicit argument
...
The goal is to eliminate the "shared state guard" argument, which
currently requires access to the database.
2020-07-04 14:16:50 +00:00
Niko Matsakis
d71a7a2751
make with_incremented_revision
dyn-safe
2020-07-04 14:16:50 +00:00
Niko Matsakis
64f3eb96a1
remove GroupKey associated type
2020-07-04 14:16:50 +00:00
Niko Matsakis
1a07944efe
remove DatabaseKey associated type
2020-07-04 14:16:50 +00:00
Niko Matsakis
799ddce157
remove unused GroupData
associated type
2020-07-04 14:16:50 +00:00
Niko Matsakis
1b778760ae
track and report cycles using DatabaseKeyIndex
2020-07-04 14:16:50 +00:00
Niko Matsakis
7b5ac6e717
implement ability to get readable debug output for DatabaseKeyIndex
2020-07-04 14:16:50 +00:00
Niko Matsakis
5a1bf10ba6
add a query_name
associated constant
2020-07-04 14:16:50 +00:00
Niko Matsakis
b4c6e69faf
rewrite get_cycle_path
to push to a vector
2020-07-04 14:16:50 +00:00
Niko Matsakis
07623fb962
remove the DatabaseData
and associated unsafe code
2020-07-04 14:16:50 +00:00
Niko Matsakis
f7a14f2309
use DatabaseKeyIndex
instead of Dependency
2020-07-04 14:16:49 +00:00
Niko Matsakis
29b6b833d1
compute database-key-index for interned fields
2020-07-04 14:16:14 +00:00
Niko Matsakis
a45087a322
compute database-key-index for input slots
2020-07-04 14:16:14 +00:00
Niko Matsakis
ed1632d151
compute database-key-index for derived slots
2020-07-04 14:16:14 +00:00
Niko Matsakis
8664e7e43c
add database-key-index type
2020-07-04 14:16:14 +00:00
Niko Matsakis
206c086bac
thread group index to storage initializers
2020-07-04 14:16:14 +00:00
Jonas Schievink
786168fc99
Simplify collect call
2020-07-03 19:30:23 +02:00
Jonas Schievink
e2569e7afc
Use a boxed slice to store dependencies
2020-07-03 19:26:38 +02:00
Aleksey Kladov
9c7ac995d8
Make salsa buildable on power
...
rust-analyzer fails in rust-lang/rust repo on the power target,
because it doesn't have `AtomicU64`. So, lets just use `AtomicUsize`
as a revision number.
Semantically this is wrong, as we are not using revision to address
arrays, but, practically, it's a nice compromise to build on targets
without AtomicU64 and to have large revision numbers on most relevant
targets.
2020-07-03 16:27:19 +02:00
Aleksey Kladov
a6b162aba1
Replace mpsc channels with hand-written future implementation
...
cargo llvm-lines shows that some amount of llvm lines is spend on
`std::mpsc`. Given that this is not the most loved standard library
module, and that our usage of mpsc is extremely limited, it seems
worth-while to implement oneshot channel using parking_lot.
2020-07-02 01:17:52 +02:00
Markus Westerlind
380306930b
feat: Prune unnecessary dependencies
...
Only AtomicCell is used from crossbeam and SmallRng from rand so we can
easily disable the default features
2020-07-01 22:42:07 +02:00
Laurențiu Nicola
cfb4e18eba
Remove workaround for parking_lot#101
2020-06-27 13:59:29 +03:00
Laurențiu Nicola
2bf383861b
Fix doctest
2020-06-27 12:46:24 +02:00
Laurențiu Nicola
bb1c308380
Revert "Bump parking_lot and remove workaround"
...
This reverts commit 025c882cbb
.
2020-06-27 12:46:24 +02:00
Laurențiu Nicola
c627cda525
Bump parking_lot and remove workaround
2020-06-27 12:46:24 +02:00
Niko Matsakis
dd60d91e75
disable fragile LRU tests for now
2020-06-24 14:16:32 +00:00
Michal Terepeta
97ed750a9d
Update some comments in slot.rs
...
Signed-off-by: Michal Terepeta <michal.terepeta@gmail.com>
2020-01-13 12:10:26 +01:00
Declan Kelly
564fa155d4
Correct mutability in on demand example, fix doc links
...
Fix query_mut documentation link
Fix more documentation links
More doc links
2019-10-05 18:30:42 -07:00
Laurențiu Nicola
c99580ba14
implement QueryTable constructor manually
2019-10-03 19:26:20 +03:00
Niko Matsakis
b0710416d0
require &mut self
for with_incremented_revision
2019-09-27 05:54:42 -04:00
Niko Matsakis
236c2eae84
require &mut self
for QueryTableMut
methods (breaking)
2019-09-27 05:54:10 -04:00
Niko Matsakis
1715d44555
store &mut DB
in QueryTableMut
2019-09-27 05:53:16 -04:00
Niko Matsakis
0a94efeac3
emit WillChangeInputValue
before new revision (breaking change!)
...
Otherwise we need to borrow the `db` in `with_incremented_revision`
and it's a pain.
2019-09-27 05:51:27 -04:00
Niko Matsakis
8c133e7a4d
make synthetic_write
require &mut self
(breaking change!)
...
This was an oversight before -- the current type implies that
one introduce a synthetic write (and hence a new revision) from
a `Frozen<DB>`! Not cool.
2019-09-27 05:50:16 -04:00
Niko Matsakis
b9f00726da
introduce Database::salsa_runtime_mut
method (breaking change!)
2019-09-27 05:49:15 -04:00
Niko Matsakis
c789219bc5
move query-storage into an Arc
...
This way, we can hold a reference to it without borrowing the database.
2019-09-27 05:34:33 -04:00
Niko Matsakis
2e9b418bbb
rework book a little bit
...
- extend some of the empty sections, add a new common pattern
- also, show how to use anchors and include so we can test the sources
for common patterns
2019-09-24 06:13:51 -04:00
Aleksey Kladov
3616014391
Apply suggestions from code review
...
Co-Authored-By: Niko Matsakis <niko@alum.mit.edu>
2019-09-24 12:08:13 +03:00
Aleksey Kladov
a798f1d918
Update src/runtime.rs
...
Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
2019-09-22 18:31:38 +03:00
Aleksey Kladov
60a475202a
add add_synthetic_read method to allow tweaking of the durability
2019-09-20 12:24:46 +03:00
Aleksey Kladov
95d0392f9c
add invalidate method to queries
2019-09-20 10:40:26 +03:00
Niko Matsakis
a9860bf37f
Merge pull request #147 from Marwes/cycles
...
feat: Allow queries to avoid panics on cycles
2019-09-19 05:56:39 -04:00
Guanqun Lu
5eb6c6f0bd
some random typo fixes
2019-08-23 00:54:29 +08:00
Markus Westerlind
360c78397b
nits
2019-08-21 10:18:01 +02:00
Markus Westerlind
897ee5f3d2
cargo fmt
2019-08-21 10:13:08 +02:00
Markus Westerlind
0e01067d55
feat: Allow queries to avoid panics on cycles
...
Quickest POC I could create to get some potentially cyclic queries to
not panic and instead return a result I could act on. (gluon's module
importing need to error on cycles).
```
// Causes `db.query()` to actually return `Result<V, CycleError>`
fn query(&self, key: K, key2: K2) -> V;
```
A proper implementation of this would likely return
`Result<V, CycleError<(K, K2)>>` or maybe larger changes are needed.
cc #6
2019-08-16 20:37:54 +02:00
Aleksey Kladov
dd2b6669cc
Merge pull request #182 from matklad/runtime_id
...
use AtomicU64 for RuntimeId
2019-08-15 14:38:34 +03:00
Aleksey Kladov
efa92fdc23
use AtomicU64 for RuntimeId
...
We don't use `RuntimeId` to index memory, so using usize is
not the best fit semantically
2019-08-15 14:06:26 +03:00
Niko Matsakis
89dcc0ca57
Merge pull request #181 from matklad/ptr
...
use ptr::eq/hash for readability
2019-08-15 07:04:07 -04:00
Niko Matsakis
c80f5ead1c
Merge pull request #185 from matklad/pl
...
⬆️ parking_lot
2019-08-15 07:02:30 -04:00
Niko Matsakis
ae9ab75384
Merge pull request #183 from matklad/no-clone
...
remove needless clone
2019-08-15 07:01:34 -04:00
Niko Matsakis
b272cc1321
Merge pull request #180 from nikomatsakis/durability
...
Durability
2019-08-15 07:01:00 -04:00
Niko Matsakis
b26a690ff3
remove an unnecessary &mut
2019-08-15 06:50:10 -04:00
Niko Matsakis
969a9c2fc8
re-use the database-key instead of recreating it
2019-08-15 06:39:17 -04:00
Niko Matsakis
4cae741768
inline probe_memoized_value
2019-08-15 06:36:37 -04:00
Aleksey Kladov
5c27b734cf
⬆️ parking_lot
2019-07-15 19:43:39 +03:00
Niko Matsakis
485df37e6f
make durability helper panic on an undefined key
2019-07-05 06:06:29 -04:00
Niko Matsakis
d4f7e4b2b4
improve comment
2019-07-05 06:05:18 -04:00
Niko Matsakis
346ce6bc16
remove set_common
helper and merge into set
2019-07-05 06:01:55 -04:00
Niko Matsakis
06ad8c7930
merge set and set_with_durability in plumbing trait
2019-07-05 06:01:17 -04:00
Niko Matsakis
8d30df0a0f
log durability
2019-07-05 06:00:21 -04:00
Niko Matsakis
e4b822cca4
s/verify_value/mark_value_as_verified/
2019-07-05 05:59:21 -04:00
Niko Matsakis
87f8517d75
remove max_durability
in favor of Durability::MAX
2019-07-05 05:58:23 -04:00
Niko Matsakis
e4cca9b8ff
disallow (and remove) dead-code
2019-07-05 05:58:10 -04:00
Niko Matsakis
6252430a91
Update src/input.rs
...
Co-Authored-By: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-05 05:52:36 -04:00
Aleksey Kladov
519bde621c
tiny simplification
2019-07-05 10:39:59 +03:00
Aleksey Kladov
1faa9d6016
remove needless clone
2019-07-04 15:20:27 +03:00
Niko Matsakis
5221e95ac4
correct out of date comments and typos
2019-07-04 06:32:08 -04:00
Aleksey Kladov
a7a8309c95
use ptr::eq/hash for readability
2019-07-03 22:24:11 +03:00
Niko Matsakis
e190a291f5
Update src/debug.rs
2019-07-03 06:28:09 -04:00
Niko Matsakis
ac93c950be
make interned keys have durability high
2019-07-02 08:22:25 -04:00
Niko Matsakis
9d474363fc
s/next_revision/synthetic_write/
...
Also write some docs explaining its side-effects.
2019-07-02 07:49:01 -04:00
Niko Matsakis
a0a6bac5af
modify public API to set_foo_with_durability
2019-07-02 07:49:01 -04:00
Niko Matsakis
09c9bd9761
adjust public api from is_constant
to durability
2019-07-02 07:49:01 -04:00
Niko Matsakis
880b29a640
move durability
to its own module and make part of public API
2019-07-02 07:49:01 -04:00
Niko Matsakis
8b7808c6ae
eliminate a built-in notion of constant durability
2019-07-02 07:49:01 -04:00
Niko Matsakis
ccb85989bc
rename durability_last_changed_revision
to last_changed_revision
...
The old name was really awkward.
2019-07-02 07:49:01 -04:00
Niko Matsakis
e796af2e7a
update comment on durability_last_changed_revision
2019-07-02 07:49:01 -04:00
Niko Matsakis
25ce7ab47b
move revisions into a vector indexed by durability
2019-07-02 07:49:01 -04:00
Niko Matsakis
c756d98fbb
move revision
code to its own module, introduce AtomicRevision
...
pure refactoring
2019-07-02 07:49:01 -04:00
Niko Matsakis
86dfdd1fda
permits things to become *more* durable without a "change"
...
This will be important if we want to automatically upgrade the
durability of inputs.
2019-07-02 07:49:01 -04:00
Niko Matsakis
5bbd500c64
switch internally from IsConstant
to Durability
2019-07-02 07:49:01 -04:00
Niko Matsakis
21a70b6eb0
use a newtype'd IsConstant
for better readability
...
Random bool constants are just so gauche.
2019-07-02 07:49:01 -04:00
Niko Matsakis
e480e08013
simplify slot constant tracking
2019-07-02 07:49:01 -04:00
Niko Matsakis
30714022fd
kill the ChangedAt
struct
...
It didn't seem like it was buying us much.
2019-07-02 07:49:01 -04:00
Niko Matsakis
0a5b6b0451
permit constants to be modified
...
We now track the last revision in which constants were modified. When
we see a constant query result, we record the current revision as
well. Then later we can check if the result is "still" constant. This
lets us cut out a lot of intermediate work.
2019-07-02 07:49:01 -04:00
Aleksey Kladov
89237e85f7
⬆️ rand
2019-07-02 14:40:43 +03:00
Niko Matsakis
ed2bd527e8
use a fixed seed
2019-07-02 06:49:24 -04:00
Niko Matsakis
7bd9e0120f
use a proper standard deviation to compare oracle + approx LRU
2019-07-02 06:49:24 -04:00
Niko Matsakis
2750830694
remove outdated comment
2019-07-02 06:49:24 -04:00
Niko Matsakis
e7d704dd8b
convert DatabaseSlot
to unsafe trait
...
The unsafe impl now asserts that the `DatabaseSlot` implementor type
is indeed `Send+Sync` if `DB::DatabaseData` is `Send+Sync`. Since our
query keys/values are a part of database-data, this means that `Slot`
must be `Send+Sync` if the key/value are `Send+Sync`. We test this
with a function that will cause compliation to fail if we accidentally
introduce an `Rc<T>` etc.
2019-07-02 06:49:24 -04:00
Niko Matsakis
579e093213
generate a DatabaseData
tuple that collects all the key, values
2019-07-02 06:49:24 -04:00
Niko Matsakis
3224c322e8
switch to a NonZeroU64 so that Option<Revision> is one word
2019-07-02 06:49:24 -04:00
Niko Matsakis
4f8c4720d4
change Revision to start from 1
2019-07-02 06:49:24 -04:00
Niko Matsakis
9d550a9343
track dependencies via direct links to slots
2019-07-02 06:49:24 -04:00
Niko Matsakis
50cb001b41
introduce slots to the interner
2019-07-02 06:49:24 -04:00
Niko Matsakis
85848e1bbf
complete mysterious comments
2019-07-02 06:49:24 -04:00
Niko Matsakis
11aba6ad2b
introduce slots to input storage
2019-07-02 06:49:24 -04:00
Niko Matsakis
03e64254e9
do not store database_key
in the slot
2019-07-02 06:49:24 -04:00
Niko Matsakis
7988b5e295
switch to the "random LRU" strategy
2019-07-02 06:49:22 -04:00
Niko Matsakis
d80b3dd879
integrate lru logic into derived table
2019-07-02 06:49:02 -04:00
Niko Matsakis
e9f91f03a5
roll our own lru list
...
We could use e.g. intrusive-collections but from reading the docs and
surveying the source it wasn't *obvious* to me that it had the right
semantics.
2019-07-02 06:48:59 -04:00
Niko Matsakis
4e5a23b9d7
rewrite derived table to use Slot
(LRU not yet supported)
2019-07-02 06:48:32 -04:00
Aleksey Kladov
caa8dcfb06
Update src/runtime.rs
...
Co-Authored-By: Niko Matsakis <niko@alum.mit.edu>
2019-06-26 13:28:12 +03:00
Aleksey Kladov
6d60798eb8
Replace volatile query type with report_untracked_read fn
2019-06-26 13:10:44 +03:00
Niko Matsakis
efa4696ab7
Merge pull request #171 from matklad/lru
...
Add LRU to derived storage
2019-06-12 05:43:46 -04:00
Aleksey Kladov
88fed8d6d6
Fix correctness bug when LRU evicted volatile query
2019-06-11 12:59:53 +03:00
Aleksey Kladov
7660277d8e
switch to atomic usize
2019-06-10 10:54:17 +03:00
Aleksey Kladov
0827c88259
use single lock for LRU
2019-06-09 16:47:51 +03:00
Aleksey Kladov
3d89c0d817
Add LRU to derived storage
...
LRU allows to bound the maximum number of *values* that are present in
the table.
2019-06-07 14:26:21 +03:00
Aleksey Kladov
fcc7058e9c
implement strong panic safety
...
Previosly, panicking query would remove in-progress memos from the
table.
However, we use panic for cancellation, so it's reasonable to **not**
remove the old result after panic. This is also known as string
exception safety guarantee: not only database is in *some* consistent
state after a panic, it is in the same state it was before the panic!
2019-06-01 23:19:15 +03:00
Niko Matsakis
74294f71f3
s/RawId/InternId/
2019-04-03 11:01:20 -03:00
Niko Matsakis
40d0c8d21a
Merge pull request #157 from nikomatsakis/raw-id
...
adopt raw-id for interned keys
2019-03-31 07:53:38 -03:00
Niko Matsakis
4402338908
Revert "do not expose that RawId is stored in a u32"
...
This reverts commit 9b106e9279
.
2019-03-31 07:34:10 -03:00
Niko Matsakis
d6934ac247
adopt NonZeroU32
2019-03-31 06:49:41 -03:00
Niko Matsakis
9b106e9279
do not expose that RawId is stored in a u32
2019-03-31 06:46:29 -03:00
Niko Matsakis
da1b26a52e
adopt raw-id
2019-03-30 06:43:16 -03:00
Niko Matsakis
5e84531d7b
Merge pull request #153 from regexident/send
...
Removed remaining stray bounds for `Send + Sync` that still survived PR #42
2019-03-29 08:24:05 -04:00
Aleksey Kladov
9d6236bc79
make sure interned state is send
2019-03-27 14:33:59 +03:00
Vincent Esche
0696ed8c3b
Removed yet another pair of stray bounds for Send + Sync
. This time on keys
2019-03-27 10:44:28 +01:00
Vincent Esche
5aa0455950
Removed remaining stray bounds for Send + Sync
that still survived PR #42
2019-03-26 16:21:23 +01:00
Niko Matsakis
c040b0c673
fix gc and volatile tests
2019-03-22 16:24:37 -04:00
Niko Matsakis
c5795a3e5c
only GC outdated intern keys
2019-03-22 05:13:07 -04:00
Niko Matsakis
9689d4471b
revert take_while changes, which were just .. wrong
2019-03-22 04:58:47 -04:00
Niko Matsakis
c8b30c52e1
nit: change filter
to take_while
to make clear we stop early
...
i.e., we never proceed after we find *something* that is dirty.
2019-03-13 05:30:03 -04:00
Niko Matsakis
7d5d01104c
document the logic from a FIXME and improve panics
2019-03-13 05:27:14 -04:00
Niko Matsakis
7dcdad88e3
convert to <=
when comparing against std::u32::MAX
2019-03-13 05:18:35 -04:00
Niko Matsakis
7ed24f0fa3
use InternIndex
also to represent indices from the user
2019-03-13 05:18:35 -04:00
Niko Matsakis
71f250d037
WIP fix DiscardIf::Always, thanks matklad :)
2019-03-12 09:26:46 -04:00
Niko Matsakis
f48515747c
create a true inverse key for the lookup path
2019-03-12 08:55:37 -04:00
Niko Matsakis
56ef78109a
remove send/sync bounds
2019-02-04 22:10:05 +01:00
Niko Matsakis
1fbd61bf87
adopt InternKey trait
2019-02-04 21:01:58 +01:00
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
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
Niko Matsakis
317281528a
adjust locking strategy to be more minimal
2018-10-25 05:48:37 -04:00
Niko Matsakis
7f1d1995aa
introduce ability to ask a table what keys it has
2018-10-25 05:48:37 -04:00
Niko Matsakis
649b1a6f99
introduce a sweep
routine
2018-10-25 05:48:37 -04:00
Niko Matsakis
d429926ddd
treat constants more uniformly
...
We used to ignore constant inputs entirely. We now track them, but if we
find that a value is constant, we discard ITS inputs. This means that
-- if we track dependencies -- we have an "outer rim" of constant
values.
Also take the opportunity to reshuffle how derived inputs represent
their state.
2018-10-25 05:48:36 -04:00
Niko Matsakis
1ab8d1a64e
refactor ChangedAt
into a struct
...
There are really two orthogonal things going on here.
2018-10-25 05:47:45 -04:00
Niko Matsakis
03751d3d5c
convert Tracked to a struct variant
2018-10-25 05:47:45 -04:00
Kevin Leimkuhler
7198902ebd
Simplify map
write to exclusive write access
2018-10-24 11:00:44 -07:00
Kevin Leimkuhler
917ca42f04
Panic safely in a single threaded context
2018-10-23 21:54:14 -07:00
Niko Matsakis
e6f1f6b7fb
replace with_frozen_revision
with revision_guard
2018-10-19 06:00:15 -04:00
Niko Matsakis
2cf73b45c1
rename freeze_revision
to start_query
2018-10-19 06:00:15 -04:00
Niko Matsakis
c327d08343
add a with_frozen_revision
method that permits ad-hoc queries
2018-10-19 06:00:15 -04:00