mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
Optimise away a memory copy for returned structs in simple cases
This commit is contained in:
parent
4f55b7a56e
commit
52a56bfa27
2 changed files with 12 additions and 6 deletions
|
@ -6,14 +6,14 @@ use crate::{PTR_SIZE, PTR_TYPE};
|
|||
// See README for background information on Wasm locals, memory and function calls
|
||||
#[derive(Debug)]
|
||||
pub enum WasmLayout {
|
||||
// Most number types can fit in a Wasm local without any stack memory.
|
||||
// Roc i8 is represented as an i32 local. Store the type and the original size.
|
||||
// Primitive number value. Just a Wasm local, without any stack memory.
|
||||
// For example, Roc i8 is represented as Wasm i32. Store the type and the original size.
|
||||
LocalOnly(ValueType, u32),
|
||||
|
||||
// A `local` pointing to stack memory
|
||||
// Local pointer to stack memory
|
||||
StackMemory { size: u32, alignment_bytes: u32 },
|
||||
|
||||
// A `local` pointing to heap memory
|
||||
// Local pointer to heap memory
|
||||
HeapMemory,
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue