Merge pull request #4851 from JTeeuwissen/main

replace borrowed boolean with ownership enum
This commit is contained in:
Folkert de Vries 2023-01-09 23:24:39 +01:00 committed by GitHub
commit 61a2091b27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 85 additions and 58 deletions

View file

@ -2,6 +2,7 @@ use bumpalo::collections::vec::Vec;
use roc_module::low_level::LowLevel;
use roc_module::symbol::{IdentIds, Symbol};
use crate::borrow::Ownership;
use crate::ir::{
BranchInfo, Call, CallType, Expr, JoinPointId, Literal, Param, Stmt, UpdateModeId,
};
@ -418,7 +419,7 @@ fn eq_tag_union_help<'a>(
} else {
let loop_params_iter = operands.iter().map(|arg| Param {
symbol: *arg,
borrow: true,
ownership: Ownership::Borrowed,
layout: Layout::Union(union_layout),
});
@ -718,13 +719,13 @@ fn eq_list<'a>(
let param_addr1 = Param {
symbol: addr1,
borrow: false,
ownership: Ownership::Owned,
layout: layout_isize,
};
let param_addr2 = Param {
symbol: addr2,
borrow: false,
ownership: Ownership::Owned,
layout: layout_isize,
};

View file

@ -6,6 +6,7 @@ use roc_module::low_level::{LowLevel, LowLevel::*};
use roc_module::symbol::{IdentIds, Symbol};
use roc_target::PtrWidth;
use crate::borrow::Ownership;
use crate::code_gen_help::let_lowlevel;
use crate::ir::{
BranchInfo, Call, CallType, Expr, JoinPointId, Literal, ModifyRc, Param, Stmt, UpdateModeId,
@ -944,7 +945,7 @@ fn refcount_list_elems<'a>(
let param_addr = Param {
symbol: addr,
borrow: false,
ownership: Ownership::Owned,
layout: layout_isize,
};
@ -1602,7 +1603,7 @@ fn refcount_union_tailrec<'a>(
let jp_param = Param {
symbol: next_ptr,
borrow: true,
ownership: Ownership::Borrowed,
layout,
};
@ -1622,7 +1623,7 @@ fn refcount_union_tailrec<'a>(
let loop_init = Stmt::Jump(tailrec_loop, root.arena.alloc([initial_structure]));
let loop_param = Param {
symbol: current,
borrow: true,
ownership: Ownership::Borrowed,
layout: Layout::Union(union_layout),
};