Add List.reserve implementation for generic64

This commit is contained in:
Ahmad Sattar 2023-01-20 23:36:26 +01:00
parent 5039a73d5c
commit 9b525143cb
No known key found for this signature in database
GPG key ID: 6EAC5AB400A49604
3 changed files with 144 additions and 0 deletions

View file

@ -687,6 +687,14 @@ trait Backend<'a> {
);
self.build_list_with_capacity(sym, args[0], arg_layouts[0], ret_layout)
}
LowLevel::ListReserve => {
debug_assert_eq!(
2,
args.len(),
"ListReserve: expected to have exactly two arguments"
);
self.build_list_reserve(sym, args, arg_layouts, ret_layout)
}
LowLevel::ListGetUnsafe => {
debug_assert_eq!(
2,
@ -935,6 +943,15 @@ trait Backend<'a> {
ret_layout: &InLayout<'a>,
);
/// build_list_reserve enlarges a list to at least accommodate the given capacity.
fn build_list_reserve(
&mut self,
dst: &Symbol,
args: &'a [Symbol],
arg_layouts: &[InLayout<'a>],
ret_layout: &InLayout<'a>,
);
/// build_list_get_unsafe loads the element from the list at the index.
fn build_list_get_unsafe(
&mut self,