mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 15:21:12 +00:00
Add comments to ModifyRc enum
This commit is contained in:
parent
cba0c02339
commit
01f81c5092
1 changed files with 9 additions and 0 deletions
|
@ -1115,8 +1115,17 @@ impl<'a> BranchInfo<'a> {
|
|||
|
||||
#[derive(Clone, Copy, Debug, PartialEq)]
|
||||
pub enum ModifyRc {
|
||||
/// Increment a reference count
|
||||
Inc(Symbol, u64),
|
||||
/// Decrement a reference count
|
||||
Dec(Symbol),
|
||||
/// A DecRef is a non-recursive reference count decrement
|
||||
/// e.g. If we Dec a list of lists, then if the reference count of the outer list is one,
|
||||
/// a Dec will recursively decrement all elements, then free the memory of the outer list.
|
||||
/// A DecRef would just free the outer list.
|
||||
/// That is dangerous because you may not free the elements, but in our Zig builtins,
|
||||
/// sometimes we know we already dealt with the elements (e.g. by copying them all over
|
||||
/// to a new list) and so we can just do a DecRef, which is much cheaper in such a case.
|
||||
DecRef(Symbol),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue