diff --git a/compiler/gen_wasm/src/wasm32_result.rs b/compiler/gen_wasm/src/wasm32_result.rs index de0e939932..79d7f56596 100644 --- a/compiler/gen_wasm/src/wasm32_result.rs +++ b/compiler/gen_wasm/src/wasm32_result.rs @@ -186,7 +186,12 @@ wasm_result_primitive!(f64, f64_store, Align::Bytes8); wasm_result_stack_memory!(u128); wasm_result_stack_memory!(i128); wasm_result_stack_memory!(RocDec); -wasm_result_stack_memory!(RocStr); + +impl Wasm32Result for RocStr { + fn build_wrapper_body(code_builder: &mut CodeBuilder, main_function_index: u32) { + build_wrapper_body_stack_memory(code_builder, main_function_index, 12) + } +} impl Wasm32Result for RocList { fn build_wrapper_body(code_builder: &mut CodeBuilder, main_function_index: u32) { diff --git a/compiler/gen_wasm/src/wasm32_sized.rs b/compiler/gen_wasm/src/wasm32_sized.rs index f59b7fffd4..e7cfd7d9a0 100644 --- a/compiler/gen_wasm/src/wasm32_sized.rs +++ b/compiler/gen_wasm/src/wasm32_sized.rs @@ -31,12 +31,12 @@ impl Wasm32Sized for () { } impl Wasm32Sized for RocStr { - const SIZE_OF_WASM: usize = 8; + const SIZE_OF_WASM: usize = 12; const ALIGN_OF_WASM: usize = 4; } impl Wasm32Sized for RocList { - const SIZE_OF_WASM: usize = 8; + const SIZE_OF_WASM: usize = 12; const ALIGN_OF_WASM: usize = 4; } diff --git a/compiler/test_gen/src/wasm_str.rs b/compiler/test_gen/src/wasm_str.rs index 91e208acb2..87020c7bd5 100644 --- a/compiler/test_gen/src/wasm_str.rs +++ b/compiler/test_gen/src/wasm_str.rs @@ -355,8 +355,8 @@ fn small_str_concat_small_to_big() { #[test] fn small_str_concat_small_to_small_staying_small() { assert_evals_to!( - r#"Str.concat "J" "JJJJJJJJJJJ""#, - [0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x8b], + r#"Str.concat "0" "1234567890""#, + [0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x8b], [u8; 12] ); }