mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Updates for making soa
no_std
This commit is contained in:
parent
178bc469e6
commit
44d00e1f13
21 changed files with 164 additions and 151 deletions
|
@ -1,7 +1,7 @@
|
|||
use std::cell::RefCell;
|
||||
|
||||
use roc_can::{abilities::AbilitiesStore, constraint::TypeOrVar, expected::Expected};
|
||||
use roc_collections::soa::{Index, Slice};
|
||||
use roc_collections::soa::{slice_extend_new, Index, Slice};
|
||||
use roc_error_macros::internal_error;
|
||||
use roc_module::{ident::TagName, symbol::Symbol};
|
||||
use roc_region::all::Loc;
|
||||
|
@ -372,7 +372,7 @@ pub(crate) fn type_to_var_help(
|
|||
}
|
||||
}
|
||||
UnspecializedLambdaSet { unspecialized } => {
|
||||
let unspecialized_slice = SubsSlice::extend_new(
|
||||
let unspecialized_slice = slice_extend_new(
|
||||
&mut env.subs.unspecialized_lambda_sets,
|
||||
std::iter::once(unspecialized),
|
||||
);
|
||||
|
@ -545,8 +545,8 @@ pub(crate) fn type_to_var_help(
|
|||
unreachable!("we assert that the ext var is empty; otherwise we'd already know it was a tag union!");
|
||||
}
|
||||
|
||||
let tag_names = SubsSlice::extend_new(&mut env.subs.tag_names, [tag_name]);
|
||||
let symbols = SubsSlice::extend_new(&mut env.subs.symbol_names, [symbol]);
|
||||
let tag_names = slice_extend_new(&mut env.subs.tag_names, [tag_name]);
|
||||
let symbols = slice_extend_new(&mut env.subs.symbol_names, [symbol]);
|
||||
|
||||
let content =
|
||||
Content::Structure(FlatType::FunctionOrTagUnion(tag_names, symbols, ext));
|
||||
|
@ -651,7 +651,7 @@ pub(crate) fn type_to_var_help(
|
|||
}
|
||||
|
||||
AliasVariables {
|
||||
variables_start: new_variables.start,
|
||||
variables_start: new_variables.start(),
|
||||
type_variables_len: type_arguments.len() as _,
|
||||
lambda_set_variables_len: lambda_set_variables.len() as _,
|
||||
all_variables_len: all_vars_length as _,
|
||||
|
@ -734,7 +734,7 @@ pub(crate) fn type_to_var_help(
|
|||
}
|
||||
|
||||
AliasVariables {
|
||||
variables_start: new_variables.start,
|
||||
variables_start: new_variables.start(),
|
||||
type_variables_len: type_arguments.len() as _,
|
||||
lambda_set_variables_len: lambda_set_variables.len() as _,
|
||||
all_variables_len: all_vars_length as _,
|
||||
|
@ -763,10 +763,8 @@ pub(crate) fn type_to_var_help(
|
|||
match *env.subs.get_content_unchecked(var) {
|
||||
Content::RigidVar(a) => {
|
||||
// TODO(multi-abilities): check run cache
|
||||
let abilities_slice = SubsSlice::extend_new(
|
||||
&mut env.subs.symbol_names,
|
||||
abilities.sorted_iter().copied(),
|
||||
);
|
||||
let abilities_slice =
|
||||
slice_extend_new(&mut env.subs.symbol_names, abilities.sorted_iter().copied());
|
||||
env.subs
|
||||
.set_content(var, Content::RigidAbleVar(a, abilities_slice));
|
||||
}
|
||||
|
@ -776,10 +774,8 @@ pub(crate) fn type_to_var_help(
|
|||
// pass, already bound
|
||||
}
|
||||
_ => {
|
||||
let abilities_slice = SubsSlice::extend_new(
|
||||
&mut env.subs.symbol_names,
|
||||
abilities.sorted_iter().copied(),
|
||||
);
|
||||
let abilities_slice =
|
||||
slice_extend_new(&mut env.subs.symbol_names, abilities.sorted_iter().copied());
|
||||
|
||||
let flex_ability = env.register(rank, Content::FlexAbleVar(None, abilities_slice));
|
||||
|
||||
|
@ -967,7 +963,7 @@ fn find_tag_name_run(slice: &[TagName], subs: &mut Subs) -> Option<SubsSlice<Tag
|
|||
Some(occupied) => {
|
||||
let subs_slice = *occupied;
|
||||
|
||||
let prefix_slice = SubsSlice::new(subs_slice.start, slice.len() as _);
|
||||
let prefix_slice = SubsSlice::new(subs_slice.start(), slice.len() as _);
|
||||
|
||||
if slice.len() == 1 {
|
||||
return Some(prefix_slice);
|
||||
|
@ -976,7 +972,7 @@ fn find_tag_name_run(slice: &[TagName], subs: &mut Subs) -> Option<SubsSlice<Tag
|
|||
match slice.len().cmp(&subs_slice.len()) {
|
||||
Ordering::Less => {
|
||||
// we might have a prefix
|
||||
let tag_names = &subs.tag_names[subs_slice.start as usize..];
|
||||
let tag_names = &subs.tag_names[subs_slice.start() as usize..];
|
||||
|
||||
for (from_subs, from_slice) in tag_names.iter().zip(slice.iter()) {
|
||||
if from_subs != from_slice {
|
||||
|
@ -1054,8 +1050,7 @@ fn insert_tags_fast_path(
|
|||
let variable_slice =
|
||||
register_tag_arguments(env, rank, arena, types, stack, arguments_slice);
|
||||
|
||||
let new_variable_slices =
|
||||
SubsSlice::extend_new(&mut env.subs.variable_slices, [variable_slice]);
|
||||
let new_variable_slices = slice_extend_new(&mut env.subs.variable_slices, [variable_slice]);
|
||||
|
||||
macro_rules! subs_tag_name {
|
||||
($tag_name_slice:expr) => {
|
||||
|
@ -1206,10 +1201,9 @@ fn create_union_lambda(
|
|||
stack: &mut bumpalo::collections::Vec<'_, TypeToVar>,
|
||||
) -> UnionLambdas {
|
||||
let variable_slice = register_tag_arguments(env, rank, arena, types, stack, capture_types);
|
||||
let new_variable_slices =
|
||||
SubsSlice::extend_new(&mut env.subs.variable_slices, [variable_slice]);
|
||||
let new_variable_slices = slice_extend_new(&mut env.subs.variable_slices, [variable_slice]);
|
||||
|
||||
let lambda_name_slice = SubsSlice::extend_new(&mut env.subs.symbol_names, [closure]);
|
||||
let lambda_name_slice = slice_extend_new(&mut env.subs.symbol_names, [closure]);
|
||||
|
||||
UnionLambdas::from_slices(lambda_name_slice, new_variable_slices)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue