mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
Update wasm backend
This commit is contained in:
parent
6859c2e15c
commit
9d70c45781
6 changed files with 303 additions and 261 deletions
|
@ -1,7 +1,7 @@
|
|||
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
||||
use roc_mono::layout::{Layout, STLayoutInterner, UnionLayout};
|
||||
use roc_mono::layout::{InLayout, Layout, LayoutInterner, STLayoutInterner, UnionLayout};
|
||||
|
||||
use crate::{PTR_SIZE, PTR_TYPE, TARGET_INFO};
|
||||
use crate::{PTR_SIZE, PTR_TYPE};
|
||||
use roc_wasm_module::ValueType;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
|
@ -40,14 +40,14 @@ pub enum WasmLayout {
|
|||
}
|
||||
|
||||
impl WasmLayout {
|
||||
pub fn new<'a>(interner: &STLayoutInterner<'a>, layout: &Layout<'a>) -> Self {
|
||||
pub fn new<'a>(interner: &STLayoutInterner<'a>, layout: InLayout<'a>) -> Self {
|
||||
use roc_mono::layout::Builtin::*;
|
||||
use UnionLayout::*;
|
||||
use ValueType::*;
|
||||
|
||||
let (size, alignment_bytes) = layout.stack_size_and_alignment(interner, TARGET_INFO);
|
||||
let (size, alignment_bytes) = interner.stack_size_and_alignment(layout);
|
||||
|
||||
match layout {
|
||||
match interner.get(layout) {
|
||||
Layout::Builtin(Int(int_width)) => {
|
||||
use IntWidth::*;
|
||||
|
||||
|
@ -80,7 +80,7 @@ impl WasmLayout {
|
|||
},
|
||||
|
||||
Layout::LambdaSet(lambda_set) => {
|
||||
WasmLayout::new(interner, &lambda_set.runtime_representation(interner))
|
||||
WasmLayout::new(interner, lambda_set.runtime_representation())
|
||||
}
|
||||
|
||||
Layout::Builtin(Str | List(_))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue