mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 23:31:12 +00:00
feat(wasm): LowLevel::ListLen
This commit is contained in:
parent
b35deacebe
commit
40da207859
2 changed files with 21 additions and 4 deletions
|
@ -52,8 +52,25 @@ pub fn decode_low_level<'a>(
|
|||
return NotImplemented;
|
||||
}
|
||||
StrTrim => return BuiltinCall(bitcode::STR_TRIM),
|
||||
ListLen => match ret_layout {
|
||||
WasmLayout::StackMemory { .. } => return NotImplemented,
|
||||
WasmLayout::Primitive(value_type, _) => match value_type {
|
||||
I32 => {
|
||||
if let StoredValue::StackMemory { location, .. } = storage.get(&args[0]) {
|
||||
let (local_id, offset) =
|
||||
location.local_and_offset(storage.stack_frame_pointer);
|
||||
|
||||
ListLen | ListGetUnsafe | ListSet | ListSingle | ListRepeat | ListReverse | ListConcat
|
||||
code_builder.get_local(local_id);
|
||||
code_builder.i32_load(Align::Bytes4, offset + 4);
|
||||
} else {
|
||||
internal_error!("Unexpected storage for {:?}", args[0]);
|
||||
};
|
||||
}
|
||||
_ => return NotImplemented,
|
||||
},
|
||||
},
|
||||
|
||||
ListGetUnsafe | ListSet | ListSingle | ListRepeat | ListReverse | ListConcat
|
||||
| ListContains | ListAppend | ListPrepend | ListJoin | ListRange | ListMap | ListMap2
|
||||
| ListMap3 | ListMap4 | ListMapWithIndex | ListKeepIf | ListWalk | ListWalkUntil
|
||||
| ListWalkBackwards | ListKeepOks | ListKeepErrs | ListSortWith | ListSublist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue