mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
preserve semantics in the glue generation
This commit is contained in:
parent
6d2d65bb1e
commit
bb97c384bb
4 changed files with 13 additions and 11 deletions
|
@ -9985,8 +9985,9 @@ where
|
||||||
I: LayoutInterner<'a>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let interned_unboxed_struct_layout = layout_interner.insert(*unboxed_struct_layout);
|
let interned_unboxed_struct_layout = layout_interner.insert(*unboxed_struct_layout);
|
||||||
let boxed_struct_layout =
|
let union_layout =
|
||||||
Layout::no_semantic(LayoutRepr::Ptr(interned_unboxed_struct_layout).direct());
|
UnionLayout::NonNullableUnwrapped(arena.alloc([interned_unboxed_struct_layout]));
|
||||||
|
let boxed_struct_layout = Layout::no_semantic(LayoutRepr::Union(union_layout).direct());
|
||||||
let boxed_struct_layout = layout_interner.insert(boxed_struct_layout);
|
let boxed_struct_layout = layout_interner.insert(boxed_struct_layout);
|
||||||
let mut answer = bumpalo::collections::Vec::with_capacity_in(field_layouts.len(), arena);
|
let mut answer = bumpalo::collections::Vec::with_capacity_in(field_layouts.len(), arena);
|
||||||
|
|
||||||
|
@ -10026,7 +10027,7 @@ where
|
||||||
|
|
||||||
let field_get_stmt = Stmt::Let(result, field_get_expr, *field, ret_stmt);
|
let field_get_stmt = Stmt::Let(result, field_get_expr, *field, ret_stmt);
|
||||||
|
|
||||||
let unbox_expr = Expr::ptr_load(arena.alloc(argument));
|
let unbox_expr = Expr::expr_unbox(argument, arena.alloc(interned_unboxed_struct_layout));
|
||||||
|
|
||||||
let unbox_stmt = Stmt::Let(
|
let unbox_stmt = Stmt::Let(
|
||||||
unboxed,
|
unboxed,
|
||||||
|
@ -10097,7 +10098,8 @@ where
|
||||||
I: LayoutInterner<'a>,
|
I: LayoutInterner<'a>,
|
||||||
{
|
{
|
||||||
let interned = layout_interner.insert(*unboxed_struct_layout);
|
let interned = layout_interner.insert(*unboxed_struct_layout);
|
||||||
let boxed_struct_layout = Layout::no_semantic(LayoutRepr::Ptr(interned).direct());
|
let box_union_layout = UnionLayout::NonNullableUnwrapped(arena.alloc([interned]));
|
||||||
|
let boxed_struct_layout = Layout::no_semantic(LayoutRepr::Union(box_union_layout).direct());
|
||||||
let boxed_struct_layout = layout_interner.insert(boxed_struct_layout);
|
let boxed_struct_layout = layout_interner.insert(boxed_struct_layout);
|
||||||
let mut answer = bumpalo::collections::Vec::with_capacity_in(field_layouts.len(), arena);
|
let mut answer = bumpalo::collections::Vec::with_capacity_in(field_layouts.len(), arena);
|
||||||
|
|
||||||
|
@ -10126,7 +10128,7 @@ where
|
||||||
|
|
||||||
let field_get_stmt = Stmt::Let(result, field_get_expr, *field, ret_stmt);
|
let field_get_stmt = Stmt::Let(result, field_get_expr, *field, ret_stmt);
|
||||||
|
|
||||||
let unbox_expr = Expr::ptr_load(arena.alloc(argument));
|
let unbox_expr = Expr::expr_unbox(argument, arena.alloc(interned));
|
||||||
let unbox_stmt = Stmt::Let(unboxed, unbox_expr, interned, arena.alloc(field_get_stmt));
|
let unbox_stmt = Stmt::Let(unboxed, unbox_expr, interned, arena.alloc(field_get_stmt));
|
||||||
|
|
||||||
let proc = Proc {
|
let proc = Proc {
|
||||||
|
|
|
@ -144,13 +144,13 @@ procedure Test.6 (Test.27, Test.28):
|
||||||
ret Test.37;
|
ret Test.37;
|
||||||
|
|
||||||
procedure Test.76 (Test.77):
|
procedure Test.76 (Test.77):
|
||||||
let Test.78 : {{}, []} = Unbox Test.77;
|
let Test.78 : {{}, []} = UnionAtIndex (Id 0) (Index 0) Test.77;
|
||||||
dec Test.77;
|
dec Test.77;
|
||||||
let Test.79 : {} = StructAtIndex 0 Test.78;
|
let Test.79 : {} = StructAtIndex 0 Test.78;
|
||||||
ret Test.79;
|
ret Test.79;
|
||||||
|
|
||||||
procedure Test.80 (Test.81):
|
procedure Test.80 (Test.81):
|
||||||
let Test.82 : {{}, []} = Unbox Test.81;
|
let Test.82 : {{}, []} = UnionAtIndex (Id 0) (Index 0) Test.81;
|
||||||
dec Test.81;
|
dec Test.81;
|
||||||
let Test.83 : [] = StructAtIndex 1 Test.82;
|
let Test.83 : [] = StructAtIndex 1 Test.82;
|
||||||
ret Test.83;
|
ret Test.83;
|
||||||
|
|
|
@ -7,13 +7,13 @@ procedure Test.1 (Test.2, Test.3):
|
||||||
ret Test.21;
|
ret Test.21;
|
||||||
|
|
||||||
procedure Test.30 (Test.31):
|
procedure Test.30 (Test.31):
|
||||||
let Test.32 : {U8, {}} = Unbox Test.31;
|
let Test.32 : {U8, {}} = UnionAtIndex (Id 0) (Index 0) Test.31;
|
||||||
dec Test.31;
|
dec Test.31;
|
||||||
let Test.33 : U8 = StructAtIndex 0 Test.32;
|
let Test.33 : U8 = StructAtIndex 0 Test.32;
|
||||||
ret Test.33;
|
ret Test.33;
|
||||||
|
|
||||||
procedure Test.34 (Test.35):
|
procedure Test.34 (Test.35):
|
||||||
let Test.36 : {U8, {}} = Unbox Test.35;
|
let Test.36 : {U8, {}} = UnionAtIndex (Id 0) (Index 0) Test.35;
|
||||||
dec Test.35;
|
dec Test.35;
|
||||||
let Test.37 : {} = StructAtIndex 1 Test.36;
|
let Test.37 : {} = StructAtIndex 1 Test.36;
|
||||||
ret Test.37;
|
ret Test.37;
|
||||||
|
|
|
@ -7,13 +7,13 @@ procedure Test.1 (Test.2, Test.3):
|
||||||
ret Test.21;
|
ret Test.21;
|
||||||
|
|
||||||
procedure Test.30 (Test.31):
|
procedure Test.30 (Test.31):
|
||||||
let Test.32 : {U8, {}} = Unbox Test.31;
|
let Test.32 : {U8, {}} = UnionAtIndex (Id 0) (Index 0) Test.31;
|
||||||
dec Test.31;
|
dec Test.31;
|
||||||
let Test.33 : U8 = StructAtIndex 0 Test.32;
|
let Test.33 : U8 = StructAtIndex 0 Test.32;
|
||||||
ret Test.33;
|
ret Test.33;
|
||||||
|
|
||||||
procedure Test.34 (Test.35):
|
procedure Test.34 (Test.35):
|
||||||
let Test.36 : {U8, {}} = Unbox Test.35;
|
let Test.36 : {U8, {}} = UnionAtIndex (Id 0) (Index 0) Test.35;
|
||||||
dec Test.35;
|
dec Test.35;
|
||||||
let Test.37 : {} = StructAtIndex 1 Test.36;
|
let Test.37 : {} = StructAtIndex 1 Test.36;
|
||||||
ret Test.37;
|
ret Test.37;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue