Commit graph

478 commits

Author SHA1 Message Date
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
Niko Matsakis
1fef80d659 expand incremental tests 2018-09-30 07:32:24 -04:00
Niko Matsakis
9bfd8ebbfa add debugging, get incremental test working 2018-09-30 07:28:22 -04:00
Niko Matsakis
e134ffcdf4 add a public next_revision method and start on incremental test 2018-09-30 06:59:28 -04:00
Niko Matsakis
4f04f9335c implement maybe_changed_since for volatile, fix comments 2018-09-30 06:09:06 -04:00
Niko Matsakis
7c78d60360 rename transparent to volatile 2018-09-30 06:05:42 -04:00
Niko Matsakis
b12b607db2 have query-descriptors invoke maybe_changed_since 2018-09-30 06:04:09 -04:00
Niko Matsakis
4449e97944 start threading through inputs and revision information 2018-09-29 10:19:10 -04:00
Niko Matsakis
907fe96628 add a Memoized struct 2018-09-29 07:24:53 -04:00
Niko Matsakis
738e285c5c add a (unused) report_query_read to runtime to track deps 2018-09-29 07:23:45 -04:00
Niko Matsakis
5ed8cafe04 introduce active query and some (unused) fields 2018-09-29 07:15:41 -04:00
Niko Matsakis
dc94984a2b introduce a LocalState type 2018-09-29 07:02:32 -04:00
Niko Matsakis
2e7e77516e refactor to have a revision and shared state in runtime
Pare down our feature list to what we actually *use*
2018-09-29 06:52:56 -04:00
Niko Matsakis
36e2b9cdcc checkpoint: weird rustc bug permitting extra members 2018-09-29 06:41:00 -04:00
Niko Matsakis
d7b1d194de remove the pub use for runtime to keep the "main namespace" clean
Not sure which is better.
2018-09-29 06:20:12 -04:00
Niko Matsakis
8921a1bcde introduce a QueryDescriptor trait 2018-09-29 06:04:02 -04:00
Niko Matsakis
c85edccc1e remove the horrible dyn_descriptor and generate an enum 2018-09-29 06:01:44 -04:00
Niko Matsakis
d6821d1097 allow user to define link to storage/runtime entirely
This seems like a more consistent abstraction.
2018-09-29 05:52:14 -04:00
Niko Matsakis
4b4ab53cdb improve comment 2018-09-29 05:48:28 -04:00
Niko Matsakis
4054817a96 add a comment 2018-09-29 05:45:58 -04:00
Niko Matsakis
5bee46108d remove the need to manually specify the QueryDescriptor
The macro can handle it now.
2018-09-29 05:44:34 -04:00
Niko Matsakis
2e40e9d1e5 rename BaseQueryContext to just QueryContext
And use it like `salsa::QueryContext` elsewhere.
2018-09-29 05:34:29 -04:00
Niko Matsakis
288fe5b25f add a "runtime" and use that from query context impls 2018-09-29 05:31:26 -04:00
Niko Matsakis
ac7b02b7ef add some comments and one more test 2018-09-29 04:53:59 -04:00
Niko Matsakis
7dcbaf4f2f add test for transparent queries 2018-09-29 04:50:08 -04:00
Niko Matsakis
1b873281a1 permit multiple queries in query_prototype 2018-09-29 04:34:19 -04:00
Niko Matsakis
fe21e28b8c add transparent storage and ability to select it in macro 2018-09-29 04:27:45 -04:00
Niko Matsakis
ed92e0f408 keep QueryState private 2018-09-28 17:47:40 -04:00
Niko Matsakis
fcd8e97500 rename storage to memoized 2018-09-28 17:47:09 -04:00
Niko Matsakis
9b4267f7c1 add a boilerplate reducing macro 2018-09-28 14:26:46 -04:00
Niko Matsakis
302a89fea5 rewrite to use parking lot rw-locks and make everything threadsafe 2018-09-28 14:02:39 -04:00
Niko Matsakis
086005dc52 convert the example into a test 2018-09-28 13:54:40 -04:00
Niko Matsakis
abb4345c08 add a bunch of comments, some new bounds 2018-09-28 13:53:15 -04:00
Niko Matsakis
3646890b38 make the example build 2018-09-28 11:40:43 -04:00
Niko Matsakis
798a8a418c add an example and get it building 2018-09-28 11:26:53 -04:00
Niko Matsakis
cae379fd06 import the code 2018-09-28 11:04:52 -04:00
Niko Matsakis
b26f0c17ea add readme, license, etc 2018-09-28 11:01:27 -04:00