mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
remove label from Struct layout
This commit is contained in:
parent
e2a7c970bc
commit
46062439b5
7 changed files with 233 additions and 211 deletions
|
@ -238,7 +238,7 @@ pub fn build_expr<'a, B: Backend>(
|
|||
.ins()
|
||||
.stack_addr(cfg.pointer_type(), slot, Offset32::new(0))
|
||||
}
|
||||
Tag { tag_layout, arguments , tag_id, union_size, .. } => {
|
||||
Tag { tag_layout, arguments, .. } => {
|
||||
let cfg = env.cfg;
|
||||
let ptr_bytes = cfg.pointer_bytes() as u32;
|
||||
|
||||
|
@ -256,14 +256,6 @@ pub fn build_expr<'a, B: Backend>(
|
|||
// Create instructions for storing each field's expression
|
||||
let mut offset = 0;
|
||||
|
||||
// still need to insert the tag discriminator for non-single unions
|
||||
// when there are no arguments, e.g. `Nothing : Maybe a`
|
||||
if *union_size > 1 {
|
||||
let val = builder.ins().iconst(types::I64, *tag_id as i64);
|
||||
builder.ins().stack_store(val, slot, Offset32::new(0));
|
||||
offset += ptr_bytes;
|
||||
}
|
||||
|
||||
for (field_expr, field_layout) in arguments.iter() {
|
||||
let val = build_expr(env, &scope, module, builder, field_expr, procs);
|
||||
|
||||
|
@ -276,7 +268,6 @@ pub fn build_expr<'a, B: Backend>(
|
|||
offset += field_size;
|
||||
}
|
||||
|
||||
|
||||
builder
|
||||
.ins()
|
||||
.stack_addr(cfg.pointer_type(), slot, Offset32::new(0))
|
||||
|
|
|
@ -370,8 +370,6 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
Tag {
|
||||
arguments,
|
||||
tag_layout,
|
||||
union_size,
|
||||
tag_id,
|
||||
..
|
||||
} => {
|
||||
let ptr_size = env.ptr_bytes;
|
||||
|
@ -387,23 +385,6 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
let mut field_types = Vec::with_capacity_in(num_fields, env.arena);
|
||||
let mut field_vals = Vec::with_capacity_in(num_fields, env.arena);
|
||||
|
||||
// insert the discriminant value
|
||||
if *union_size > 1 {
|
||||
let val = env
|
||||
.context
|
||||
.i64_type()
|
||||
.const_int(*tag_id as u64, true)
|
||||
.into();
|
||||
|
||||
let field_type = env.context.i64_type().into();
|
||||
|
||||
field_types.push(field_type);
|
||||
field_vals.push(val);
|
||||
|
||||
let field_size = ptr_size;
|
||||
filler -= field_size;
|
||||
}
|
||||
|
||||
for (field_expr, field_layout) in arguments.iter() {
|
||||
let val = build_expr(env, &scope, parent, field_expr, procs);
|
||||
let field_type =
|
||||
|
|
|
@ -66,7 +66,7 @@ pub fn basic_type_from_layout<'ctx>(
|
|||
// Determine types
|
||||
let mut field_types = Vec::with_capacity_in(sorted_fields.len(), arena);
|
||||
|
||||
for (_, field_layout) in sorted_fields.iter() {
|
||||
for field_layout in sorted_fields.iter() {
|
||||
field_types.push(basic_type_from_layout(
|
||||
arena,
|
||||
context,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue