mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 08:34:33 +00:00
Delete HeapMemory variant of WasmLayout, just treat pointers as Primitive
When I created this (at the very beginning of the Wasm backend), I didn't really have a clear reason for it. I just thought it might end up making sense treat heap pointers differently from numbers, somehow. But the semantic differences between pointers and other numbers is not relevant to WasmLayout. The semantics are clear from where the Symbol appears in the IR. Also we were storing heap pointers in locals, for no real reason. And the fact that it's *different* meant a lot of new cases in match expressions, to do the exact same thing as Primitives but with a pointless difference. Until now, we haven't really used this variant in any of our tests. But the refcount pointer needed it... and everything broke!
This commit is contained in:
parent
3581c7f5be
commit
079a8311ec
3 changed files with 2 additions and 21 deletions
|
@ -39,9 +39,6 @@ pub enum WasmLayout {
|
|||
alignment_bytes: u32,
|
||||
format: StackMemoryFormat,
|
||||
},
|
||||
|
||||
// Local pointer to heap memory
|
||||
HeapMemory,
|
||||
}
|
||||
|
||||
impl WasmLayout {
|
||||
|
@ -105,7 +102,7 @@ impl WasmLayout {
|
|||
| NullableWrapped { .. }
|
||||
| NullableUnwrapped { .. },
|
||||
)
|
||||
| Layout::RecursivePointer => Self::HeapMemory,
|
||||
| Layout::RecursivePointer => Self::Primitive(PTR_TYPE, PTR_SIZE),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +117,6 @@ impl WasmLayout {
|
|||
Self::Primitive(I64, _) => &[I64],
|
||||
Self::Primitive(F32, _) => &[F32],
|
||||
Self::Primitive(F64, _) => &[F64],
|
||||
Self::HeapMemory => &[I32],
|
||||
|
||||
// 1 Roc argument => 0-2 Wasm arguments (depending on size and calling convention)
|
||||
Self::StackMemory { size, format, .. } => conv.stack_memory_arg_types(*size, *format),
|
||||
|
@ -130,7 +126,6 @@ impl WasmLayout {
|
|||
pub fn return_method(&self) -> ReturnMethod {
|
||||
match self {
|
||||
Self::Primitive(ty, _) => ReturnMethod::Primitive(*ty),
|
||||
Self::HeapMemory => ReturnMethod::Primitive(PTR_TYPE),
|
||||
Self::StackMemory { size, .. } => {
|
||||
if *size == 0 {
|
||||
ReturnMethod::NoReturnValue
|
||||
|
@ -145,7 +140,6 @@ impl WasmLayout {
|
|||
match self {
|
||||
Self::Primitive(_, size) => *size,
|
||||
Self::StackMemory { size, .. } => *size,
|
||||
Self::HeapMemory => PTR_SIZE,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue