get rid of unneeded mut and refactor addref (#19594)
This commit is contained in:
committed by
GitHub
parent
205f070a99
commit
df040c05da
@ -190,7 +190,7 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
|
|||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn slot_list(&mut self) -> &SlotList<T> {
|
pub fn slot_list(&self) -> &SlotList<T> {
|
||||||
&*self.borrow_slot_list_guard()
|
&*self.borrow_slot_list_guard()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,10 +201,6 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
|
|||||||
self.with_slot_list_guard_mut(user)
|
self.with_slot_list_guard_mut(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ref_count(&self) -> &AtomicU64 {
|
|
||||||
&self.borrow_owned_entry().ref_count
|
|
||||||
}
|
|
||||||
|
|
||||||
// create an entry that is equivalent to this process:
|
// create an entry that is equivalent to this process:
|
||||||
// 1. new empty (refcount=0, slot_list={})
|
// 1. new empty (refcount=0, slot_list={})
|
||||||
// 2. update(slot, account_info)
|
// 2. update(slot, account_info)
|
||||||
@ -329,7 +325,7 @@ impl<T: IsCached> WriteAccountMapEntry<T> {
|
|||||||
});
|
});
|
||||||
if addref {
|
if addref {
|
||||||
// If it's the first non-cache insert, also bump the stored ref count
|
// If it's the first non-cache insert, also bump the stored ref count
|
||||||
self.ref_count().fetch_add(1, Ordering::Relaxed);
|
self.borrow_owned_entry().add_un_ref(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user