mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Logic to load 128-bit numbers
This commit is contained in:
parent
ee1c4478da
commit
2e31350010
3 changed files with 58 additions and 14 deletions
|
@ -2,6 +2,15 @@ use roc_mono::layout::{Layout, UnionLayout};
|
|||
|
||||
use crate::{wasm_module::ValueType, PTR_SIZE, PTR_TYPE};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum StackMemoryFormat {
|
||||
/// Record, Str, List, Dict, etc.
|
||||
Aggregate,
|
||||
Int128,
|
||||
Float128,
|
||||
Decimal,
|
||||
}
|
||||
|
||||
// See README for background information on Wasm locals, memory and function calls
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum WasmLayout {
|
||||
|
@ -10,7 +19,11 @@ pub enum WasmLayout {
|
|||
Primitive(ValueType, u32),
|
||||
|
||||
// Local pointer to stack memory
|
||||
StackMemory { size: u32, alignment_bytes: u32 },
|
||||
StackMemory {
|
||||
size: u32,
|
||||
alignment_bytes: u32,
|
||||
format: StackMemoryFormat,
|
||||
},
|
||||
|
||||
// Local pointer to heap memory
|
||||
HeapMemory,
|
||||
|
@ -35,23 +48,32 @@ impl WasmLayout {
|
|||
Layout::Builtin(Float64) => Self::Primitive(F64, size),
|
||||
|
||||
Layout::Builtin(
|
||||
Int128
|
||||
| Decimal
|
||||
| Float128
|
||||
| Str
|
||||
| Dict(_, _)
|
||||
| Set(_)
|
||||
| List(_)
|
||||
| EmptyStr
|
||||
| EmptyList
|
||||
| EmptyDict
|
||||
| EmptySet,
|
||||
Str | Dict(_, _) | Set(_) | List(_) | EmptyStr | EmptyList | EmptyDict | EmptySet,
|
||||
)
|
||||
| Layout::Struct(_)
|
||||
| Layout::LambdaSet(_)
|
||||
| Layout::Union(NonRecursive(_)) => Self::StackMemory {
|
||||
size,
|
||||
alignment_bytes,
|
||||
format: StackMemoryFormat::Aggregate,
|
||||
},
|
||||
|
||||
Layout::Builtin(Int128) => Self::StackMemory {
|
||||
size,
|
||||
alignment_bytes,
|
||||
format: StackMemoryFormat::Int128,
|
||||
},
|
||||
|
||||
Layout::Builtin(Decimal) => Self::StackMemory {
|
||||
size,
|
||||
alignment_bytes,
|
||||
format: StackMemoryFormat::Decimal,
|
||||
},
|
||||
|
||||
Layout::Builtin(Float128) => Self::StackMemory {
|
||||
size,
|
||||
alignment_bytes,
|
||||
format: StackMemoryFormat::Float128,
|
||||
},
|
||||
|
||||
Layout::Union(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue