mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 21:39:07 +00:00
Convert over Subs to use the new soa crate
This commit is contained in:
parent
586959780b
commit
2567c8b545
17 changed files with 240 additions and 401 deletions
|
@ -121,7 +121,7 @@ fn deep_copy_var_help(
|
|||
|
||||
macro_rules! copy_sequence {
|
||||
($length:expr, $variables:expr) => {{
|
||||
let new_variables = SubsSlice::reserve_into_subs(subs, $length as _);
|
||||
let new_variables = subs.reserve_into_vars($length as _);
|
||||
for (target_index, var_index) in (new_variables.indices()).zip($variables) {
|
||||
let var = subs[var_index];
|
||||
let copy_var = work!(var);
|
||||
|
@ -134,7 +134,7 @@ fn deep_copy_var_help(
|
|||
|
||||
macro_rules! copy_union {
|
||||
($tags:expr) => {{
|
||||
let new_variable_slices = SubsSlice::reserve_variable_slices(subs, $tags.len());
|
||||
let new_variable_slices = subs.reserve_variable_slices($tags.len());
|
||||
|
||||
let it = (new_variable_slices.indices()).zip($tags.variables());
|
||||
for (target_index, index) in it {
|
||||
|
@ -311,7 +311,7 @@ fn deep_copy_var_help(
|
|||
|
||||
let new_solved = copy_union!(solved);
|
||||
let new_rec_var = recursion_var.map(|v| work!(v));
|
||||
let new_unspecialized = SubsSlice::reserve_uls_slice(subs, unspecialized.len());
|
||||
let new_unspecialized = subs.reserve_uls_slice(unspecialized.len());
|
||||
|
||||
for (new_uls_index, uls_index) in
|
||||
(new_unspecialized.into_iter()).zip(unspecialized.into_iter())
|
||||
|
|
|
@ -329,7 +329,7 @@ pub(crate) fn type_to_var_help(
|
|||
region: _,
|
||||
} => {
|
||||
let arguments = types.get_type_arguments(typ_index);
|
||||
let new_arguments = VariableSubsSlice::reserve_into_subs(env.subs, arguments.len());
|
||||
let new_arguments = env.subs.reserve_into_vars(arguments.len());
|
||||
for (target_index, var_index) in
|
||||
(new_arguments.indices()).zip(arguments.into_iter())
|
||||
{
|
||||
|
@ -403,7 +403,7 @@ pub(crate) fn type_to_var_help(
|
|||
// This case is important for the rank of boolean variables
|
||||
Function(closure_type, ret_type) => {
|
||||
let arguments = types.get_type_arguments(typ_index);
|
||||
let new_arguments = VariableSubsSlice::reserve_into_subs(env.subs, arguments.len());
|
||||
let new_arguments = env.subs.reserve_into_vars(arguments.len());
|
||||
for (target_index, var_index) in
|
||||
(new_arguments.indices()).zip(arguments.into_iter())
|
||||
{
|
||||
|
@ -603,8 +603,7 @@ pub(crate) fn type_to_var_help(
|
|||
let all_vars_length = type_arguments.len()
|
||||
+ lambda_set_variables.len()
|
||||
+ infer_ext_in_output_variables.len();
|
||||
let new_variables =
|
||||
VariableSubsSlice::reserve_into_subs(env.subs, all_vars_length);
|
||||
let new_variables = env.subs.reserve_into_vars(all_vars_length);
|
||||
|
||||
let type_arguments_offset = 0;
|
||||
let lambda_set_vars_offset = type_arguments_offset + type_arguments.len();
|
||||
|
@ -704,8 +703,7 @@ pub(crate) fn type_to_var_help(
|
|||
let lambda_set_vars_offset = type_arguments_offset + type_arguments.len();
|
||||
let infer_ext_vars_offset = lambda_set_vars_offset + lambda_set_variables.len();
|
||||
|
||||
let new_variables =
|
||||
VariableSubsSlice::reserve_into_subs(env.subs, all_vars_length);
|
||||
let new_variables = env.subs.reserve_into_vars(all_vars_length);
|
||||
|
||||
for (((target_index, typ), region), abilities) in
|
||||
(new_variables.indices().skip(type_arguments_offset))
|
||||
|
@ -1025,7 +1023,7 @@ fn register_tag_arguments(
|
|||
if arguments.is_empty() {
|
||||
VariableSubsSlice::default()
|
||||
} else {
|
||||
let new_variables = VariableSubsSlice::reserve_into_subs(env.subs, arguments.len());
|
||||
let new_variables = env.subs.reserve_into_vars(arguments.len());
|
||||
let it = new_variables.indices().zip(arguments.into_iter());
|
||||
|
||||
for (target_index, argument) in it {
|
||||
|
@ -1075,7 +1073,7 @@ fn insert_tags_fast_path(
|
|||
}
|
||||
}
|
||||
|
||||
let new_variable_slices = SubsSlice::reserve_variable_slices(env.subs, tags.len());
|
||||
let new_variable_slices = env.subs.reserve_variable_slices(tags.len());
|
||||
match find_tag_name_run(&types[tags], env.subs) {
|
||||
Some(new_tag_names) => {
|
||||
let it = (new_variable_slices.indices()).zip(payload_slices.into_iter());
|
||||
|
@ -1089,7 +1087,7 @@ fn insert_tags_fast_path(
|
|||
UnionTags::from_slices(new_tag_names, new_variable_slices)
|
||||
}
|
||||
None => {
|
||||
let new_tag_names = SubsSlice::reserve_tag_names(env.subs, tags.len());
|
||||
let new_tag_names = env.subs.reserve_tag_names(tags.len());
|
||||
|
||||
let it = (new_variable_slices.indices())
|
||||
.zip(new_tag_names.indices())
|
||||
|
@ -1124,7 +1122,7 @@ fn insert_tags_slow_path(
|
|||
{
|
||||
let tag_argument_types = &types[tag_argument_types_index];
|
||||
|
||||
let new_slice = VariableSubsSlice::reserve_into_subs(env.subs, tag_argument_types.len());
|
||||
let new_slice = env.subs.reserve_into_vars(tag_argument_types.len());
|
||||
|
||||
for (i, arg) in (new_slice.indices()).zip(tag_argument_types.into_iter()) {
|
||||
let var = RegisterVariable::with_stack(env, rank, arena, types, arg, stack);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue