This commit is contained in:
Folkert 2023-06-18 14:21:48 +02:00
parent 4a9514d2c4
commit 0247237fe8
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
16 changed files with 625 additions and 163 deletions

View file

@ -741,6 +741,14 @@ impl<'a> BorrowInfState<'a> {
self.if_is_owned_then_own(z, *x);
}
UnionFieldPtrAtIndex { structure: x, .. } => {
// if the structure (record/tag/array) is owned, the extracted value is
self.if_is_owned_then_own(*x, z);
// if the extracted value is owned, the structure must be too
self.if_is_owned_then_own(z, *x);
}
GetTagId { structure: x, .. } => {
// if the structure (record/tag/array) is owned, the extracted value is
self.if_is_owned_then_own(*x, z);
@ -1035,7 +1043,9 @@ pub fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
unreachable!("These lowlevel operations are turned into mono Expr's")
}
PtrWrite => arena.alloc_slice_copy(&[irrelevant, irrelevant]),
PtrStore => arena.alloc_slice_copy(&[owned, borrowed]),
PtrLoad => arena.alloc_slice_copy(&[owned]),
PtrToZeroed => arena.alloc_slice_copy(&[owned]),
PtrCast | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr | RefCountDecDataPtr
| RefCountIsUnique => {