Push layout interner further through Layout

This commit is contained in:
Ayaz Hafiz 2022-08-31 14:14:34 -05:00
parent ed04c2040a
commit 3b4b1838b8
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
34 changed files with 1279 additions and 634 deletions

View file

@ -4,7 +4,7 @@ use bumpalo::Bump;
use roc_collections::all::MutMap;
use roc_error_macros::internal_error;
use roc_module::symbol::Symbol;
use roc_mono::layout::Layout;
use roc_mono::layout::{Layout, STLayoutInterner};
use crate::layout::{CallConv, ReturnMethod, StackMemoryFormat, WasmLayout};
use crate::wasm_module::{Align, CodeBuilder, LocalId, ValueType, VmSymbolState};
@ -168,11 +168,12 @@ impl<'a> Storage<'a> {
/// They are allocated a certain offset and size in the stack frame.
pub fn allocate_var(
&mut self,
interner: &STLayoutInterner<'a>,
layout: Layout<'a>,
symbol: Symbol,
kind: StoredVarKind,
) -> StoredValue {
let wasm_layout = WasmLayout::new(&layout);
let wasm_layout = WasmLayout::new(interner, &layout);
self.symbol_layouts.insert(symbol, layout);
let storage = match wasm_layout {
@ -217,6 +218,7 @@ impl<'a> Storage<'a> {
/// stack frame, because it's a lot easier to keep track of the data flow.
pub fn allocate_args(
&mut self,
interner: &STLayoutInterner<'a>,
args: &[(Layout<'a>, Symbol)],
code_builder: &mut CodeBuilder,
arena: &'a Bump,
@ -226,7 +228,7 @@ impl<'a> Storage<'a> {
for (layout, symbol) in args {
self.symbol_layouts.insert(*symbol, *layout);
let wasm_layout = WasmLayout::new(layout);
let wasm_layout = WasmLayout::new(interner, layout);
let local_index = self.arg_types.len() as u32;
let storage = match wasm_layout {