Skip to content

Commit

Permalink
unwrap lambda sets for RC
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Jul 28, 2023
1 parent 81b4b3d commit ce640fe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions crates/compiler/gen_llvm/src/llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2872,7 +2872,7 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
DecRef(symbol) => {
let (value, layout) = scope.load_symbol_and_layout(symbol);

match layout_interner.get_repr(layout) {
match layout_interner.runtime_representation(layout) {
LayoutRepr::Builtin(Builtin::Str) => todo!(),
LayoutRepr::Builtin(Builtin::List(element_layout)) => {
debug_assert!(value.is_struct_value());
Expand All @@ -2884,14 +2884,17 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(

other_layout if other_layout.is_refcounted(layout_interner) => {
if value.is_pointer_value() {
let value_ptr = match other_layout {
LayoutRepr::Union(union_layout)
if union_layout
.stores_tag_id_in_pointer(env.target_info) =>
{
tag_pointer_clear_tag_id(env, value.into_pointer_value())
let clear_tag_id = match other_layout {
LayoutRepr::Union(union_layout) => {
union_layout.stores_tag_id_in_pointer(env.target_info)
}
_ => value.into_pointer_value(),
_ => false,
};

let value_ptr = if clear_tag_id {
tag_pointer_clear_tag_id(env, value.into_pointer_value())
} else {
value.into_pointer_value()
};

let then_block = env.context.append_basic_block(parent, "then");
Expand Down Expand Up @@ -2944,7 +2947,7 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
debug_assert!(value.is_pointer_value());
let value = value.into_pointer_value();

let clear_tag_id = match layout_interner.chase_recursive(layout) {
let clear_tag_id = match layout_interner.runtime_representation(layout) {
LayoutRepr::Union(union) => union.stores_tag_id_in_pointer(env.target_info),
_ => false,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler/gen_llvm/src/llvm/lowlevel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ pub(crate) fn run_low_level<'a, 'ctx>(
"cast_to_i8_ptr",
);

let value_ptr = match layout_interner.get_repr(data_layout) {
let value_ptr = match layout_interner.runtime_representation(data_layout) {
LayoutRepr::Union(union_layout)
if union_layout.stores_tag_id_in_pointer(env.target_info) =>
{
Expand Down

0 comments on commit ce640fe

Please sign in to comment.