Merge remote-tracking branch 'origin/trunk' into layout-builtin-numbers-refactor

This commit is contained in:
Folkert 2021-11-21 23:19:55 +01:00
commit f96d60a13e
9 changed files with 108 additions and 46 deletions

View file

@ -1140,8 +1140,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),
}