remove alignment bump again

This commit is contained in:
Folkert 2021-09-12 14:01:41 +02:00
parent d09faad2c1
commit 0b893eb972
3 changed files with 6 additions and 24 deletions

View file

@ -268,25 +268,19 @@ fn decode_from_utf8_result<'a, 'ctx, 'env>(
let ctx = env.context; let ctx = env.context;
let fields = match env.ptr_bytes { let fields = match env.ptr_bytes {
8 => [ 8 | 4 => [
env.ptr_int().into(), env.ptr_int().into(),
super::convert::zig_str_type(env).into(), super::convert::zig_str_type(env).into(),
env.context.bool_type().into(), env.context.bool_type().into(),
ctx.i8_type().into(), ctx.i8_type().into(),
], ],
4 => [
super::convert::zig_str_type(env).into(),
env.ptr_int().into(),
env.context.bool_type().into(),
ctx.i8_type().into(),
],
_ => unreachable!(), _ => unreachable!(),
}; };
let record_type = env.context.struct_type(&fields, false); let record_type = env.context.struct_type(&fields, false);
match env.ptr_bytes { match env.ptr_bytes {
8 => { 8 | 4 => {
let zig_struct = builder let zig_struct = builder
.build_load(pointer, "load_utf8_validate_bytes_result") .build_load(pointer, "load_utf8_validate_bytes_result")
.into_struct_value(); .into_struct_value();
@ -309,20 +303,6 @@ fn decode_from_utf8_result<'a, 'ctx, 'env>(
struct_from_fields(env, record_type, values.iter().copied().enumerate()) struct_from_fields(env, record_type, values.iter().copied().enumerate())
} }
4 => {
let result_ptr_cast = env
.builder
.build_bitcast(
pointer,
record_type.ptr_type(AddressSpace::Generic),
"to_unnamed",
)
.into_pointer_value();
builder
.build_load(result_ptr_cast, "load_utf8_validate_bytes_result")
.into_struct_value()
}
_ => unreachable!(), _ => unreachable!(),
} }
} }

View file

@ -1158,8 +1158,8 @@ impl<'a> Builtin<'a> {
// //
// In webassembly, For that to be safe // In webassembly, For that to be safe
// they must be aligned to allow such access // they must be aligned to allow such access
List(_) | EmptyList => pointer_size.max(8), List(_) | EmptyList => pointer_size,
Str | EmptyStr => pointer_size.max(8), Str | EmptyStr => pointer_size,
} }
} }

View file

@ -2531,6 +2531,8 @@ fn pattern_match_unit_tag() {
); );
} }
// see for why this is disabled on wasm32 https://github.com/rtfeldman/roc/issues/1687
#[cfg(not(feature = "wasm-cli-run"))]
#[test] #[test]
fn mirror_llvm_alignment_padding() { fn mirror_llvm_alignment_padding() {
// see https://github.com/rtfeldman/roc/issues/1569 // see https://github.com/rtfeldman/roc/issues/1569