mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 00:24:34 +00:00
feat(wasm): use allocate with ref count
This commit is contained in:
parent
c14b4b81e0
commit
b35deacebe
1 changed files with 7 additions and 5 deletions
|
@ -627,17 +627,19 @@ impl<'a> WasmBackend<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr::Array { elems, elem_layout } => {
|
Expr::Array { elems, elem_layout } => {
|
||||||
if let StoredValue::StackMemory { location, .. } = storage {
|
if let StoredValue::StackMemory {
|
||||||
|
location,
|
||||||
|
alignment_bytes,
|
||||||
|
..
|
||||||
|
} = storage
|
||||||
|
{
|
||||||
let (local_id, offset) =
|
let (local_id, offset) =
|
||||||
location.local_and_offset(self.storage.stack_frame_pointer);
|
location.local_and_offset(self.storage.stack_frame_pointer);
|
||||||
|
|
||||||
// TODO: will be passed into roc_alloc
|
|
||||||
let size = elem_layout.stack_size(PTR_SIZE) * (elems.len() as u32);
|
let size = elem_layout.stack_size(PTR_SIZE) * (elems.len() as u32);
|
||||||
|
|
||||||
self.code_builder.get_local(local_id);
|
self.code_builder.get_local(local_id);
|
||||||
// TODO: we'll need a pointer here actually
|
self.allocate_with_refcount(Some(size), *alignment_bytes, 1);
|
||||||
// waiting on #2169
|
|
||||||
self.code_builder.i32_const(0);
|
|
||||||
self.code_builder.i32_store(Align::Bytes4, offset);
|
self.code_builder.i32_store(Align::Bytes4, offset);
|
||||||
|
|
||||||
// length of the list
|
// length of the list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue