mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
WIP
This commit is contained in:
parent
e0b9377dcf
commit
e19b03f290
7 changed files with 157 additions and 159 deletions
|
@ -4,9 +4,7 @@ use crate::llvm::build::{
|
|||
tag_pointer_clear_tag_id, Env, FAST_CALL_CONV, LLVM_SADD_WITH_OVERFLOW_I64, TAG_DATA_INDEX,
|
||||
};
|
||||
use crate::llvm::build_list::{incrementing_elem_loop, list_len, load_list};
|
||||
use crate::llvm::convert::{
|
||||
basic_type_from_layout, block_of_memory_slices, ptr_int, union_data_block_of_memory,
|
||||
};
|
||||
use crate::llvm::convert::{basic_type_from_layout, ptr_int};
|
||||
use bumpalo::collections::Vec;
|
||||
use inkwell::basic_block::BasicBlock;
|
||||
use inkwell::context::Context;
|
||||
|
@ -1399,28 +1397,8 @@ fn build_rec_union_recursive_decrement<'a, 'ctx, 'env>(
|
|||
debug_assert!(ptr_as_i64_ptr.is_pointer_value());
|
||||
|
||||
// therefore we must cast it to our desired type
|
||||
let union_type = match union_layout {
|
||||
UnionLayout::NonRecursive(_) => unreachable!(),
|
||||
UnionLayout::Recursive(_) | UnionLayout::NullableWrapped { .. } => {
|
||||
union_data_block_of_memory(
|
||||
env.context,
|
||||
tag_id_int_type,
|
||||
tags,
|
||||
env.ptr_bytes,
|
||||
)
|
||||
.into()
|
||||
}
|
||||
UnionLayout::NonNullableUnwrapped { .. }
|
||||
| UnionLayout::NullableUnwrapped { .. } => {
|
||||
block_of_memory_slices(env.context, tags, env.ptr_bytes)
|
||||
}
|
||||
};
|
||||
|
||||
let recursive_field_ptr = cast_basic_basic(
|
||||
env.builder,
|
||||
ptr_as_i64_ptr,
|
||||
union_type.ptr_type(AddressSpace::Generic).into(),
|
||||
);
|
||||
let union_type = basic_type_from_layout(env, &Layout::Union(union_layout));
|
||||
let recursive_field_ptr = cast_basic_basic(env.builder, ptr_as_i64_ptr, union_type);
|
||||
|
||||
deferred_rec.push(recursive_field_ptr);
|
||||
} else if field_layout.contains_refcounted() {
|
||||
|
@ -1487,9 +1465,6 @@ fn build_rec_union_recursive_decrement<'a, 'ctx, 'env>(
|
|||
let (_, only_branch) = cases.pop().unwrap();
|
||||
env.builder.build_unconditional_branch(only_branch);
|
||||
} else {
|
||||
// read the tag_id
|
||||
// let current_tag_id = get_tag_id(env, parent, &union_layout, value_ptr.into());
|
||||
|
||||
let default_block = env.context.append_basic_block(parent, "switch_default");
|
||||
|
||||
// switch on it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue