pub struct CursorContinuation<'rcu, C: PageTableConfig> {
pub entry_own: EntryOwner<C>,
pub idx: usize,
pub tree_level: nat,
pub children: Seq<Option<OwnerSubtree<C>>>,
pub path: TreePath<CONST_NR_ENTRIES>,
pub guard_perm: GuardPerm<'rcu, C>,
}Fields§
§entry_own: EntryOwner<C>§idx: usize§tree_level: nat§children: Seq<Option<OwnerSubtree<C>>>§path: TreePath<CONST_NR_ENTRIES>§guard_perm: GuardPerm<'rcu, C>Implementations§
Source§impl<'rcu, C: PageTableConfig> CursorContinuation<'rcu, C>
impl<'rcu, C: PageTableConfig> CursorContinuation<'rcu, C>
Sourcepub open spec fn child(self) -> OwnerSubtree<C>
pub open spec fn child(self) -> OwnerSubtree<C>
{ self.children[self.idx as int].unwrap() }Sourcepub open spec fn take_child_spec(self) -> (OwnerSubtree<C>, Self)
pub open spec fn take_child_spec(self) -> (OwnerSubtree<C>, Self)
{
let child = self.children[self.idx as int].unwrap();
let cont = Self {
children: self.children.remove(self.idx as int).insert(self.idx as int, None),
..self
};
(child, cont)
}Sourcepub proof fn take_child(tracked &mut self) -> res : OwnerSubtree<C>
pub proof fn take_child(tracked &mut self) -> res : OwnerSubtree<C>
requires
old(self).idx < old(self).children.len(),old(self).children[old(self).idx as int] is Some,ensuresres == old(self).take_child_spec().0,*self == old(self).take_child_spec().1,Sourcepub open spec fn put_child_spec(self, child: OwnerSubtree<C>) -> Self
pub open spec fn put_child_spec(self, child: OwnerSubtree<C>) -> Self
{
Self {
children: self
.children
.remove(self.idx as int)
.insert(self.idx as int, Some(child)),
..self
}
}Sourcepub proof fn put_child(tracked &mut self, tracked child: OwnerSubtree<C>)
pub proof fn put_child(tracked &mut self, tracked child: OwnerSubtree<C>)
requires
old(self).idx < old(self).children.len(),old(self).children[old(self).idx as int] is None,ensures*self == old(self).put_child_spec(child),Sourcepub proof fn take_put_child(self)
pub proof fn take_put_child(self)
requires
self.idx < self.children.len(),self.children[self.idx as int] is Some,ensuresself.take_child_spec().1.put_child_spec(self.take_child_spec().0) == self,Sourcepub open spec fn make_cont_spec(
self,
idx: usize,
guard_perm: GuardPerm<'rcu, C>,
) -> (Self, Self)
pub open spec fn make_cont_spec( self, idx: usize, guard_perm: GuardPerm<'rcu, C>, ) -> (Self, Self)
{
let child = Self {
entry_own: self.children[self.idx as int].unwrap().value,
tree_level: (self.tree_level + 1) as nat,
idx: idx,
children: self.children[self.idx as int].unwrap().children,
path: self.path.push_tail(self.idx as usize),
guard_perm: guard_perm,
};
let cont = Self {
children: self.children.update(self.idx as int, None),
..self
};
(child, cont)
}Sourcepub proof fn make_cont(tracked
&mut self,
idx: usize,
tracked guard_perm: Tracked<GuardPerm<'rcu, C>>,
) -> res : Self
pub proof fn make_cont(tracked &mut self, idx: usize, tracked guard_perm: Tracked<GuardPerm<'rcu, C>>, ) -> res : Self
requires
old(self).all_some(),old(self).idx < NR_ENTRIES(),idx < NR_ENTRIES(),ensuresres == old(self).make_cont_spec(idx, guard_perm@).0,*self == old(self).make_cont_spec(idx, guard_perm@).1,Sourcepub open spec fn restore_spec(self, child: Self) -> (Self, GuardPerm<'rcu, C>)
pub open spec fn restore_spec(self, child: Self) -> (Self, GuardPerm<'rcu, C>)
{
let child_node = OwnerSubtree {
value: child.entry_own,
level: child.tree_level,
children: child.children,
};
(
Self {
children: self.children.update(self.idx as int, Some(child_node)),
..self
},
child.guard_perm,
)
}Sourcepub proof fn restore(tracked &mut self, tracked child: Self) -> tracked guard_perm : GuardPerm<'rcu, C>
pub proof fn restore(tracked &mut self, tracked child: Self) -> tracked guard_perm : GuardPerm<'rcu, C>
ensures
*self == old(self).restore_spec(child).0,guard_perm == old(self).restore_spec(child).1,Sourcepub open spec fn map_children(
self,
f: FnSpec<(EntryOwner<C>, TreePath<CONST_NR_ENTRIES>), bool>,
) -> bool
pub open spec fn map_children( self, f: FnSpec<(EntryOwner<C>, TreePath<CONST_NR_ENTRIES>), bool>, ) -> bool
{
forall |i: int| {
0 <= i < self.children.len()
==> (self.children[i] is Some
==> self
.children[i]
.unwrap()
.tree_predicate_map(self.path.push_tail(i as usize), f))
}
}Sourcepub open spec fn level(self) -> PagingLevel
pub open spec fn level(self) -> PagingLevel
{ self.entry_own.node.unwrap().level }Sourcepub open spec fn inv(self) -> bool
pub open spec fn inv(self) -> bool
{
&&& self.children.len() == NR_ENTRIES()
&&& 0 <= self.idx < NR_ENTRIES()
&&& forall |i: int| {
0 <= i < NR_ENTRIES()
==> (self.children[i] is Some
==> {
&&& self.children[i].unwrap().value.parent_level == self.level()
&&& self.children[i].unwrap().inv()
&&& self.children[i].unwrap().level == self.tree_level + 1
})
}
&&& self.entry_own.is_node()
&&& self.entry_own.inv()
&&& self.entry_own.node.unwrap().relate_guard_perm(self.guard_perm)
&&& self.tree_level == INC_LEVELS() - self.level()
&&& self.tree_level < INC_LEVELS() - 1
}Sourcepub open spec fn all_some(self) -> bool
pub open spec fn all_some(self) -> bool
{ forall |i: int| 0 <= i < NR_ENTRIES() ==> self.children[i] is Some }Sourcepub open spec fn all_but_index_some(self) -> bool
pub open spec fn all_but_index_some(self) -> bool
{
&&& forall |i: int| 0 <= i < self.idx ==> self.children[i] is Some
&&& forall |i: int| self.idx < i < NR_ENTRIES() ==> self.children[i] is Some
&&& self.children[self.idx as int] is None
}Sourcepub proof fn do_inc_index(tracked &mut self)
pub proof fn do_inc_index(tracked &mut self)
requires
old(self).idx + 1 < NR_ENTRIES(),ensures*self == old(self).inc_index(),Sourcepub open spec fn node_locked(self, guards: Guards<'rcu, C>) -> bool
pub open spec fn node_locked(self, guards: Guards<'rcu, C>) -> bool
{ guards.lock_held(self.guard_perm.value().inner.inner@.ptr.addr()) }Sourcepub open spec fn relate_region(self, regions: MetaRegionOwners) -> bool
pub open spec fn relate_region(self, regions: MetaRegionOwners) -> bool
{
&&& self.entry_own.node.unwrap().relate_region(regions)
&&& forall |i: int| {
0 <= i < self.children.len() && self.children[i] is Some
==> PageTableOwner(self.children[i].unwrap())
.relate_region_rec(
self.entry_own.node.unwrap().path.push_tail(i as usize),
regions,
)
}
}Source§impl<'a, C: PageTableConfig> CursorContinuation<'a, C>
impl<'a, C: PageTableConfig> CursorContinuation<'a, C>
Sourcepub open spec fn into_subtree(self) -> OwnerSubtree<C>
pub open spec fn into_subtree(self) -> OwnerSubtree<C>
{
Node {
value: self.entry_own,
children: self.children,
level: self.tree_level,
}
}Sourcepub proof fn into_subtree_inv(self)
pub proof fn into_subtree_inv(self)
requires
self.inv(),self.all_some(),ensuresself.into_subtree().inv(),Auto Trait Implementations§
impl<'rcu, C> Freeze for CursorContinuation<'rcu, C>
impl<'rcu, C> !RefUnwindSafe for CursorContinuation<'rcu, C>
impl<'rcu, C> Send for CursorContinuation<'rcu, C>
impl<'rcu, C> Sync for CursorContinuation<'rcu, C>
impl<'rcu, C> Unpin for CursorContinuation<'rcu, C>
impl<'rcu, C> !UnwindSafe for CursorContinuation<'rcu, C>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more