Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3bf0ceb
Run nested cycles in a single fixpoint iteration
MichaReiser Sep 27, 2025
702fc10
Remove inline from `validate_same_iteration`
MichaReiser Sep 30, 2025
6264d7a
Nits
MichaReiser Oct 1, 2025
f9aca5b
Move locking into sync table
MichaReiser Oct 2, 2025
2649303
More trying
MichaReiser Oct 2, 2025
202fe55
More in progress work
MichaReiser Oct 4, 2025
45fefe9
More progress
MichaReiser Oct 5, 2025
86e8e3c
Fix most parallel tests
MichaReiser Oct 6, 2025
65d973f
More bugfixes
MichaReiser Oct 6, 2025
3efde91
Short circuit in some cases
MichaReiser Oct 6, 2025
995acd7
Short circuit in drop
MichaReiser Oct 6, 2025
445f812
Delete some unused code
MichaReiser Oct 6, 2025
824559a
A working solution
MichaReiser Oct 8, 2025
f7f630e
Simplify more
MichaReiser Oct 8, 2025
307aae5
Avoid repeated query lookups in `transfer_lock`
MichaReiser Oct 8, 2025
9c79821
Use recursion for unblocking
MichaReiser Oct 8, 2025
4dc0939
Fix hang in `maybe_changed_after`
MichaReiser Oct 8, 2025
2273fc7
Move claiming of transferred memos into a separate function
MichaReiser Oct 8, 2025
8d5dab7
More aggressive use of attributes
MichaReiser Oct 9, 2025
7f3d2ee
Make re-entrant a const parameter
MichaReiser Oct 9, 2025
85ef516
Smaller clean-ups
MichaReiser Oct 9, 2025
1dc2bea
Only collect cycle heads one level deep
MichaReiser Oct 9, 2025
6c5495a
More cleanups
MichaReiser Oct 9, 2025
2071c7f
More docs
MichaReiser Oct 9, 2025
c72efef
More comments
MichaReiser Oct 9, 2025
0a2d865
More documentation, cleanups
MichaReiser Oct 10, 2025
92a9ab6
More documentation, cleanups
MichaReiser Oct 10, 2025
868fb50
Remove inline attribute
MichaReiser Oct 10, 2025
b34ea29
Fix failing tracked structs test
MichaReiser Oct 10, 2025
8d786ae
Fix panic
MichaReiser Oct 10, 2025
5813326
Fix persistence test
MichaReiser Oct 10, 2025
81137dd
Add test for panic in nested cycle
MichaReiser Oct 10, 2025
282382a
Allow cycle initial values same-stack
MichaReiser Oct 10, 2025
d6f0f20
Try inlining fetch
MichaReiser Oct 10, 2025
e532693
Remove some inline attributes
MichaReiser Oct 10, 2025
14c64ee
Add safety comment
MichaReiser Oct 10, 2025
bb97d96
Clippy
MichaReiser Oct 10, 2025
7bb93a9
Panic if `provisional_retry` runs too many times
MichaReiser Oct 11, 2025
c5cc3dd
Better handling of panics in cycles
MichaReiser Oct 11, 2025
7b39c24
Don't use const-generic for `REENTRANT`
MichaReiser Oct 11, 2025
054c469
More nit improvements
MichaReiser Oct 11, 2025
f89c430
Remove `IterationCount::panicked`
MichaReiser Oct 11, 2025
e2fda86
Prefer outer most cycles in `outer_cycle`
MichaReiser Oct 12, 2025
00f5f7f
Code review feedback
MichaReiser Oct 16, 2025
9293c3d
Iterate only once in panic test when running with miri
MichaReiser Oct 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use recursion for unblocking
  • Loading branch information
MichaReiser committed Oct 9, 2025
commit 9c7982115e995ff26859cb2672dc8d7155c603a0
55 changes: 23 additions & 32 deletions src/runtime/dependency_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,22 @@ impl DependencyGraph {
database_key: DatabaseKeyIndex,
wait_result: WaitResult,
) {
// If `database_key` is `c` and it has been transfered to `b` earlier, remove its entry.
tracing::debug!("unblock_transferred_queries({database_key:?}");
fn unblock_recursive(
me: &mut DependencyGraph,
query: DatabaseKeyIndex,
wait_result: WaitResult,
) {
me.transferred.remove(&query);
if let Some(transitive) = me.transferred_dependents.remove(&query) {
for query in transitive {
me.unblock_runtimes_blocked_on(query, wait_result);
unblock_recursive(me, query, wait_result);
}
}
}

// If `database_key` is `c` and it has been transferred to `b` earlier, remove its entry.
tracing::trace!("unblock_transferred_queries({database_key:?}");
if let Some((_, owner)) = self.transferred.remove(&database_key) {
let owner_dependents = self.transferred_dependents.get_mut(&owner).unwrap();
let index = owner_dependents
Expand All @@ -176,24 +190,7 @@ impl DependencyGraph {
owner_dependents.swap_remove(index);
}

let mut unblocked: SmallVec<[_; 4]> = SmallVec::new();
let mut queue: SmallVec<[_; 4]> = smallvec![database_key];

while let Some(current) = queue.pop() {
self.transferred.remove(&current);
let transitive = self
.transferred_dependents
.remove(&current)
.unwrap_or_default();

queue.extend(transitive);

unblocked.push(current);
}

for query in unblocked {
self.unblock_runtimes_blocked_on(query, wait_result);
}
unblock_recursive(self, database_key, wait_result);
}

/// Returns `Ok(thread_id)` if `database_key_index` is a query who's lock ownership has been transferred to `thread_id` (potentially over multiple steps)
Expand Down Expand Up @@ -392,7 +389,7 @@ impl DependencyGraph {
}

fn update_transferred_edges(&mut self, query: DatabaseKeyIndex, new_owner_thread: ThreadId) {
tracing::info!("Resuming transitive dependents of query {query:?}");
tracing::trace!("Resuming transitive dependents of query {query:?}");

let mut queue: SmallVec<[_; 4]> = smallvec![query];

Expand All @@ -418,17 +415,11 @@ impl DependencyGraph {
edge.blocked_on_id
);
edge.blocked_on_id = new_owner_thread;
}

#[cfg(debug_assertions)]
{
for id in self.query_dependents.get(&query).into_iter().flatten() {
debug_assert!(
!self.depends_on(new_owner_thread, *id),
"Circular reference between blocked edges: {:#?}",
self.edges
);
}
debug_assert!(
!DependencyGraph::depends_on_impl(&self.edges, new_owner_thread, *dependent),
"Circular reference between blocked edges: {:#?}",
self.edges
);
}
}
}
Expand Down