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
Niko Matsakis
df320c71dd
Merge pull request #58 from kleimkuhler/issue-56-remove-eq-bound
...
[WIP] Removal of Eq bound on `Q::Val`
2018-10-19 05:20:44 -04:00
Niko Matsakis
2410a2242c
extend doc comment
2018-10-18 21:20:46 -04:00
Niko Matsakis
c0d8a08de9
permit provider fns to be variadic as well
2018-10-18 21:15:24 -04:00
Niko Matsakis
ed2cf2333f
support variadic queries in the trait definition
2018-10-18 19:24:38 -04:00
Kevin Leimkuhler
7b20806417
Initial removal of Eq bound on Q::Val
2018-10-18 15:29:15 -07:00
Niko Matsakis
089f489df6
Merge pull request #55 from matklad/illigal-state
...
Refactor out some illegal states
2018-10-17 04:27:08 -04:00
Aleksey Kladov
5abd02097d
Refactor out some illegal states
...
It's impossible to have an `InProgress` state here, so let's ensure
that!
2018-10-16 12:48:01 +03:00
Niko Matsakis
6a61233902
Merge pull request #51 from matklad/plumbing
...
Hide public impl detail in the plumbing module
2018-10-16 05:29:57 -04:00
Aleksey Kladov
47e87e0bc2
impl fmt::Debug for Runtime
2018-10-16 11:47:40 +03:00
Aleksey Kladov
4401e88fba
Hide public impl detail in the plumbing module
2018-10-16 11:24:51 +03:00
Niko Matsakis
5ec9161598
warn about rust_2018_idioms, not deny
...
We are on beta so we sort of straddle this line.
2018-10-15 16:40:57 -04:00
Niko Matsakis
de934274d1
block on other threads in maybe_changed_since
2018-10-15 11:55:01 -04:00
Niko Matsakis
cf72c98946
extract register_with_in_progress_thread
helper
2018-10-15 11:49:14 -04:00
Niko Matsakis
29831a7430
remove ErrorDetected variant from ProbeState
2018-10-15 09:31:25 -04:00
Niko Matsakis
a8fd113636
merge read_probe
and probe
2018-10-15 09:30:08 -04:00
Niko Matsakis
be983aacdf
extract read_upgrade into a separate helper
...
And use it from `maybe_changed_since` where it makes sense.
2018-10-15 08:53:52 -04:00
Niko Matsakis
2ba9c97815
rewrite to thread a Vec<Receiver> to signal waiters
...
This is both more precise and the logic is simpler.
2018-10-15 08:28:55 -04:00
Niko Matsakis
373e1158f3
only acquire a read-lock when verifying inputs
...
We no longer use a placeholder.
2018-10-15 05:32:24 -04:00
Niko Matsakis
1799e12aa4
more debug! when executing from inputs
2018-10-15 05:25:05 -04:00
Niko Matsakis
04288dadef
track whether a query is in progress more accurately
2018-10-15 05:24:36 -04:00
Niko Matsakis
9d60b1e1cd
make query-descriptor-set cheaply cloneable
2018-10-14 20:15:27 -04:00
Niko Matsakis
d2c3025009
refactor probe
to be more generic
2018-10-14 07:23:38 -04:00
Niko Matsakis
be08029f8c
[WIP] introduce blocking/notification
2018-10-14 06:59:43 -04:00
Niko Matsakis
da94299f19
[WIP] restructure to handle blocking (which we do not yet initiate)
2018-10-13 06:28:05 -04:00
Niko Matsakis
975eaf58d7
change InProgress
to a struct form
2018-10-13 06:08:29 -04:00
Niko Matsakis
ea0b196a5d
[WIP] await_other_guard fn
2018-10-13 06:04:57 -04:00
Niko Matsakis
00c76be635
refactor derived read to only require read lock
...
The old setup acquired `upgradable_read` even when the value was cached.
At that point you might as well just a mutex.
2018-10-13 05:45:57 -04:00
Niko Matsakis
a0e14e1806
runtime: dependency graph (wip)
2018-10-12 13:41:55 -04:00
Niko Matsakis
ca329ddd10
store the runtime-id in the InProgress
indicator
2018-10-12 12:11:49 -04:00
Niko Matsakis
36f72c0b58
give each forked runtime a unique id
2018-10-12 12:11:49 -04:00
Niko Matsakis
e7e9c1bebb
rename revision_lock
to query_lock
and update comments
2018-10-12 12:11:49 -04:00
Niko Matsakis
4f4676df60
remove a bunch of unused imports
2018-10-12 11:21:40 -04:00
Niko Matsakis
be62e8c7a1
add runtime log
2018-10-12 11:21:40 -04:00
Niko Matsakis
890207346f
do not hold input write lock while incrementing revision
2018-10-12 05:28:17 -04:00
Niko Matsakis
d11a15aff9
add debugging methods on input::set
2018-10-12 05:27:42 -04:00
Niko Matsakis
f7d6ebe76a
introduce a ParallelDatabase
trait
2018-10-11 20:22:38 -04:00
Niko Matsakis
c6f78d5f27
have queries freeze the revision
2018-10-11 16:48:20 -04:00
Niko Matsakis
41b36da054
tracking pending increments and add is_current_revision_canceled
2018-10-11 08:37:15 -04:00
Niko Matsakis
4a8b264b7f
add a revision lock
2018-10-11 08:18:16 -04:00
Niko Matsakis
a353ffb13c
add back implied outlives bounds
...
Those were reverted on beta.
2018-10-11 05:49:05 -04:00
Niko Matsakis
6778898a34
track when a value *became* constant
...
Turns out we need this, as demonstrated by the included test =)
2018-10-11 04:53:49 -04:00
Niko Matsakis
16d151e4c8
add debugging APIs -- just is_constant
for now
2018-10-11 04:37:29 -04:00
Niko Matsakis
42b88fe7e6
rewrite map to just grab a write lock, and fix some latent bugs
2018-10-09 20:36:29 -04:00
Niko Matsakis
a7317084dc
support set_constant
in inputs
...
FIXME: Need test for the `panic!` case etc
2018-10-09 20:36:29 -04:00
Niko Matsakis
032b269113
extract a set_common
helper
2018-10-09 20:36:29 -04:00
Niko Matsakis
1afca5d505
add a Constant
for ChangedAt
2018-10-09 20:36:29 -04:00
Niko Matsakis
3ffd166f2c
check if input has changed before incrementing revision
...
WIP -- needs test
2018-10-09 20:36:29 -04:00
Niko Matsakis
6a0ed30d73
rename MutQueryStorageOps
to InputQueryStorageOps
2018-10-09 20:36:29 -04:00
Niko Matsakis
a45d482a97
more descriptive assertion failure for overflow
2018-10-09 18:00:27 -04:00
Aleksey Kladov
e42c68913e
check revision for overflow
2018-10-10 00:48:19 +03:00
Aleksey Kladov
74486afdec
elide some lifetimes
2018-10-10 00:44:26 +03:00
Aleksey Kladov
f28e8c1be5
disable in-band lifetimes
2018-10-09 22:39:03 +03:00
Aleksey Kladov
c3fb7a1f24
disable nll
2018-10-09 22:37:55 +03:00
Aleksey Kladov
69b9dff557
Use AtomicUsize instead of AtomicU64
2018-10-09 22:37:38 +03:00
Aleksey Kladov
1c349d4229
Switch crate to pub(crate)
2018-10-09 22:34:30 +03:00
Niko Matsakis
3b5f16cbcb
Merge pull request #43 from nikomatsakis/derived-storage
...
Combine memoized and volatile to make "derived storage"
2018-10-09 15:19:14 -04:00
Niko Matsakis
0dd96865c7
refactor to unwrap less
2018-10-09 15:11:57 -04:00
Niko Matsakis
6658a47a36
rename is_volatile
to should_track_inputs
2018-10-09 13:28:33 -04:00
Niko Matsakis
c93868c9dc
make volatile queries memoize
...
This ensures consistency of results.
2018-10-09 12:41:56 -04:00
Niko Matsakis
7c65d07ea6
rename from WeakMemoizedStorage to DerivedStorage
2018-10-09 12:15:33 -04:00
Niko Matsakis
5ad0049b9f
merge volatile and memoized queries
2018-10-09 12:14:09 -04:00
Niko Matsakis
2d6e454638
add the idea of "untracked reads" and use it to optimize volatile
...
Now we won't be tracking the inputs to a volatile query, since we don't
care about them anyway.
2018-10-09 11:04:25 -04:00
Niko Matsakis
1e6bfc7fdd
introduce a callback into execute_query_implementation
2018-10-09 10:26:33 -04:00
Niko Matsakis
30236cc110
introduce a new helper, verify_inputs
2018-10-09 09:27:59 -04:00
Niko Matsakis
121821117d
Merge pull request #36 from matklad/weak-memoized
...
Merge Memoized and Dependency storages
2018-10-09 08:53:57 -04:00
Niko Matsakis
296d33aae7
factor out ChangedAt
to record when something changed
2018-10-09 08:53:13 -04:00
Niko Matsakis
4efbd411fa
check with old_memo.value.is_some()
before revalidating inputs
2018-10-09 08:40:53 -04:00
Niko Matsakis
f04d66fce4
rename to MemoizationPolicy
2018-10-09 08:39:41 -04:00
Niko Matsakis
067e478e48
correct spelling, add spacing between fields
2018-10-09 08:37:57 -04:00
Niko Matsakis
d3fdfad141
Merge pull request #42 from memoryruins/remove-send-bounds
...
Remove Send bounds on Query keys and values
2018-10-09 08:22:16 -04:00
Niko Matsakis
ac6f2a5689
Merge pull request #40 from matklad/reexport-runtime
...
Re-export runtime
2018-10-09 08:21:44 -04:00
memoryruins
4c7bd8745a
Remove bounds on Query keys and values
2018-10-07 15:14:26 -04:00
Aleksey Kladov
f14d846146
Re-export runtime
...
cc #17
2018-10-07 14:08:22 +03:00
Aleksey Kladov
6c09f40733
Remove DefaultKey trait
...
We no longer use `.get` function directly, so DefaultKey does not make
much sense
2018-10-07 14:01:58 +03:00
Aleksey Kladov
b411d51a05
Merge Memoized and Dependency storages
...
closes #18
2018-10-06 20:15:12 +03:00
Niko Matsakis
2f5c2f1b44
add a comment
2018-10-06 07:12:29 -04:00
Niko Matsakis
0225fc615c
add a set_unchecked
method that can be used to do mocking in tests
2018-10-05 15:23:17 -04:00
Niko Matsakis
c75e7e44f7
add a test showing that you can write use fn
2018-10-05 10:39:55 -04:00
Niko Matsakis
8366b3a38b
rename query_prototype
to query_group
2018-10-05 10:35:50 -04:00
Niko Matsakis
55ec1f51d3
switch to use fn
2018-10-05 10:30:17 -04:00
Niko Matsakis
1b98ecb7a8
change to db.query(Query).set(key, value)
2018-10-05 06:58:51 -04:00
Niko Matsakis
0ee6f3884d
make query_prototype
also define queries, remove query_definition
2018-10-05 05:55:35 -04:00
Niko Matsakis
cd5622c6de
make query method get
by default
...
Use `Query.set(db, key, value)` to set. Not sure about this.
2018-10-05 05:28:51 -04:00
Niko Matsakis
d6c7080877
introduce a GetQueryTable
trait and use to get the query tables
2018-10-05 05:15:21 -04:00
Niko Matsakis
84dca313f7
factor out a QueryFunction
trait -- inputs don't implement it
2018-10-05 04:59:33 -04:00
Niko Matsakis
a4fb4b7b13
rename query context to database
2018-10-05 04:54:51 -04:00
Niko Matsakis
89a0ff4221
Merge pull request #21 from nikomatsakis/docs
...
change `query_prototype` to take entire trait; update the docs
2018-10-02 06:01:57 -04:00
Niko Matsakis
2ddc8032ee
make query_prototype
take trait, rename hello_world to compiler
2018-10-01 20:42:41 -04:00
Niko Matsakis
5472cfdbc8
simplify the logic by using changed_at
and not verified_at
...
I think they are actually equivalent, as we have already fond that the
inputs did not change in the range `changed_at..=verified_at`.
2018-10-01 13:20:18 -04:00
Aleksey Kladov
981606a121
Assert inputs are not modified concurrently
2018-10-01 16:29:19 +03:00
Niko Matsakis
157e1e47f1
add support for "dependency only" tracking
2018-10-01 08:40:15 -04:00
Niko Matsakis
5a802ae05c
add a helper method overwrite_placeholder
2018-10-01 08:40:15 -04:00
Niko Matsakis
5849af83ac
track the "changed at" revision for every query read as well
2018-10-01 08:40:14 -04:00
Niko Matsakis
436d4d5084
combine changed_at
and value
into a stamped value in the Memo
2018-10-01 08:39:50 -04:00
Niko Matsakis
b5d1ba9000
extract StampedValue into the runtime module
2018-10-01 08:39:50 -04:00
Aleksey Kladov
e13187f747
Track cycles in volatile queries
2018-10-01 13:58:54 +03:00
Niko Matsakis
968149dc34
rename from of
to get
and use read
in tests
2018-09-30 10:59:08 -04:00
Niko Matsakis
6b5871c5af
nicer macro syntax
...
we give bad error messages if misused, though
2018-09-30 10:55:59 -04:00
Niko Matsakis
0846e6ebba
write tests for input
2018-09-30 10:50:46 -04:00
Niko Matsakis
e2da42d36a
add "input" storage
2018-09-30 10:22:11 -04:00