mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Pass abilities store to mono
This commit is contained in:
parent
6472e32173
commit
eb81c68bcb
3 changed files with 31 additions and 1 deletions
|
@ -271,6 +271,7 @@ fn start_phase<'a>(
|
||||||
solved_subs,
|
solved_subs,
|
||||||
decls,
|
decls,
|
||||||
ident_ids,
|
ident_ids,
|
||||||
|
abilities_store,
|
||||||
} = typechecked;
|
} = typechecked;
|
||||||
|
|
||||||
let mut imported_module_thunks = bumpalo::collections::Vec::new_in(arena);
|
let mut imported_module_thunks = bumpalo::collections::Vec::new_in(arena);
|
||||||
|
@ -294,6 +295,7 @@ fn start_phase<'a>(
|
||||||
decls,
|
decls,
|
||||||
ident_ids,
|
ident_ids,
|
||||||
exposed_to_host: state.exposed_to_host.clone(),
|
exposed_to_host: state.exposed_to_host.clone(),
|
||||||
|
abilities_store,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Phase::MakeSpecializations => {
|
Phase::MakeSpecializations => {
|
||||||
|
@ -316,6 +318,7 @@ fn start_phase<'a>(
|
||||||
procs_base,
|
procs_base,
|
||||||
layout_cache,
|
layout_cache,
|
||||||
module_timing,
|
module_timing,
|
||||||
|
abilities_store,
|
||||||
} = found_specializations;
|
} = found_specializations;
|
||||||
|
|
||||||
BuildTask::MakeSpecializations {
|
BuildTask::MakeSpecializations {
|
||||||
|
@ -326,6 +329,7 @@ fn start_phase<'a>(
|
||||||
layout_cache,
|
layout_cache,
|
||||||
specializations_we_must_make,
|
specializations_we_must_make,
|
||||||
module_timing,
|
module_timing,
|
||||||
|
abilities_store,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,6 +423,7 @@ pub struct TypeCheckedModule<'a> {
|
||||||
pub solved_subs: Solved<Subs>,
|
pub solved_subs: Solved<Subs>,
|
||||||
pub decls: Vec<Declaration>,
|
pub decls: Vec<Declaration>,
|
||||||
pub ident_ids: IdentIds,
|
pub ident_ids: IdentIds,
|
||||||
|
pub abilities_store: AbilitiesStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -429,6 +434,7 @@ struct FoundSpecializationsModule<'a> {
|
||||||
procs_base: ProcsBase<'a>,
|
procs_base: ProcsBase<'a>,
|
||||||
subs: Subs,
|
subs: Subs,
|
||||||
module_timing: ModuleTiming,
|
module_timing: ModuleTiming,
|
||||||
|
abilities_store: AbilitiesStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -529,6 +535,7 @@ enum Msg<'a> {
|
||||||
problems: Vec<roc_mono::ir::MonoProblem>,
|
problems: Vec<roc_mono::ir::MonoProblem>,
|
||||||
solved_subs: Solved<Subs>,
|
solved_subs: Solved<Subs>,
|
||||||
module_timing: ModuleTiming,
|
module_timing: ModuleTiming,
|
||||||
|
abilities_store: AbilitiesStore,
|
||||||
},
|
},
|
||||||
MadeSpecializations {
|
MadeSpecializations {
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
|
@ -767,6 +774,7 @@ enum BuildTask<'a> {
|
||||||
ident_ids: IdentIds,
|
ident_ids: IdentIds,
|
||||||
decls: Vec<Declaration>,
|
decls: Vec<Declaration>,
|
||||||
exposed_to_host: ExposedToHost,
|
exposed_to_host: ExposedToHost,
|
||||||
|
abilities_store: AbilitiesStore,
|
||||||
},
|
},
|
||||||
MakeSpecializations {
|
MakeSpecializations {
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
|
@ -776,6 +784,7 @@ enum BuildTask<'a> {
|
||||||
layout_cache: LayoutCache<'a>,
|
layout_cache: LayoutCache<'a>,
|
||||||
specializations_we_must_make: Vec<ExternalSpecializations>,
|
specializations_we_must_make: Vec<ExternalSpecializations>,
|
||||||
module_timing: ModuleTiming,
|
module_timing: ModuleTiming,
|
||||||
|
abilities_store: AbilitiesStore,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1880,6 +1889,7 @@ fn update<'a>(
|
||||||
solved_subs,
|
solved_subs,
|
||||||
decls,
|
decls,
|
||||||
ident_ids,
|
ident_ids,
|
||||||
|
abilities_store,
|
||||||
};
|
};
|
||||||
|
|
||||||
state
|
state
|
||||||
|
@ -1904,6 +1914,7 @@ fn update<'a>(
|
||||||
layout_cache,
|
layout_cache,
|
||||||
problems,
|
problems,
|
||||||
module_timing,
|
module_timing,
|
||||||
|
abilities_store,
|
||||||
} => {
|
} => {
|
||||||
log!("found specializations for {:?}", module_id);
|
log!("found specializations for {:?}", module_id);
|
||||||
|
|
||||||
|
@ -1925,6 +1936,7 @@ fn update<'a>(
|
||||||
procs_base,
|
procs_base,
|
||||||
subs,
|
subs,
|
||||||
module_timing,
|
module_timing,
|
||||||
|
abilities_store,
|
||||||
};
|
};
|
||||||
|
|
||||||
state
|
state
|
||||||
|
@ -3642,6 +3654,7 @@ fn make_specializations<'a>(
|
||||||
specializations_we_must_make: Vec<ExternalSpecializations>,
|
specializations_we_must_make: Vec<ExternalSpecializations>,
|
||||||
mut module_timing: ModuleTiming,
|
mut module_timing: ModuleTiming,
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
|
abilities_store: AbilitiesStore,
|
||||||
) -> Msg<'a> {
|
) -> Msg<'a> {
|
||||||
let make_specializations_start = SystemTime::now();
|
let make_specializations_start = SystemTime::now();
|
||||||
let mut mono_problems = Vec::new();
|
let mut mono_problems = Vec::new();
|
||||||
|
@ -3657,6 +3670,7 @@ fn make_specializations<'a>(
|
||||||
update_mode_ids: &mut update_mode_ids,
|
update_mode_ids: &mut update_mode_ids,
|
||||||
// call_specialization_counter=0 is reserved
|
// call_specialization_counter=0 is reserved
|
||||||
call_specialization_counter: 1,
|
call_specialization_counter: 1,
|
||||||
|
abilities_store: &abilities_store,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut procs = Procs::new_in(arena);
|
let mut procs = Procs::new_in(arena);
|
||||||
|
@ -3727,6 +3741,7 @@ fn build_pending_specializations<'a>(
|
||||||
target_info: TargetInfo,
|
target_info: TargetInfo,
|
||||||
// TODO remove
|
// TODO remove
|
||||||
exposed_to_host: ExposedToHost,
|
exposed_to_host: ExposedToHost,
|
||||||
|
abilities_store: AbilitiesStore,
|
||||||
) -> Msg<'a> {
|
) -> Msg<'a> {
|
||||||
let find_specializations_start = SystemTime::now();
|
let find_specializations_start = SystemTime::now();
|
||||||
|
|
||||||
|
@ -3753,6 +3768,7 @@ fn build_pending_specializations<'a>(
|
||||||
update_mode_ids: &mut update_mode_ids,
|
update_mode_ids: &mut update_mode_ids,
|
||||||
// call_specialization_counter=0 is reserved
|
// call_specialization_counter=0 is reserved
|
||||||
call_specialization_counter: 1,
|
call_specialization_counter: 1,
|
||||||
|
abilities_store: &abilities_store,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Add modules' decls to Procs
|
// Add modules' decls to Procs
|
||||||
|
@ -3806,6 +3822,7 @@ fn build_pending_specializations<'a>(
|
||||||
procs_base,
|
procs_base,
|
||||||
problems,
|
problems,
|
||||||
module_timing,
|
module_timing,
|
||||||
|
abilities_store,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3823,7 +3840,11 @@ fn add_def_to_module<'a>(
|
||||||
use roc_can::pattern::Pattern::*;
|
use roc_can::pattern::Pattern::*;
|
||||||
|
|
||||||
match def.loc_pattern.value {
|
match def.loc_pattern.value {
|
||||||
Identifier(symbol) => {
|
Identifier(symbol)
|
||||||
|
| AbilityMemberSpecialization {
|
||||||
|
ident: symbol,
|
||||||
|
specializes: _,
|
||||||
|
} => {
|
||||||
let is_host_exposed = exposed_to_host.contains_key(&symbol);
|
let is_host_exposed = exposed_to_host.contains_key(&symbol);
|
||||||
|
|
||||||
match def.loc_expr.value {
|
match def.loc_expr.value {
|
||||||
|
@ -4026,6 +4047,7 @@ fn run_task<'a>(
|
||||||
solved_subs,
|
solved_subs,
|
||||||
imported_module_thunks,
|
imported_module_thunks,
|
||||||
exposed_to_host,
|
exposed_to_host,
|
||||||
|
abilities_store,
|
||||||
} => Ok(build_pending_specializations(
|
} => Ok(build_pending_specializations(
|
||||||
arena,
|
arena,
|
||||||
solved_subs,
|
solved_subs,
|
||||||
|
@ -4037,6 +4059,7 @@ fn run_task<'a>(
|
||||||
layout_cache,
|
layout_cache,
|
||||||
target_info,
|
target_info,
|
||||||
exposed_to_host,
|
exposed_to_host,
|
||||||
|
abilities_store,
|
||||||
)),
|
)),
|
||||||
MakeSpecializations {
|
MakeSpecializations {
|
||||||
module_id,
|
module_id,
|
||||||
|
@ -4046,6 +4069,7 @@ fn run_task<'a>(
|
||||||
layout_cache,
|
layout_cache,
|
||||||
specializations_we_must_make,
|
specializations_we_must_make,
|
||||||
module_timing,
|
module_timing,
|
||||||
|
abilities_store,
|
||||||
} => Ok(make_specializations(
|
} => Ok(make_specializations(
|
||||||
arena,
|
arena,
|
||||||
module_id,
|
module_id,
|
||||||
|
@ -4056,6 +4080,7 @@ fn run_task<'a>(
|
||||||
specializations_we_must_make,
|
specializations_we_must_make,
|
||||||
module_timing,
|
module_timing,
|
||||||
target_info,
|
target_info,
|
||||||
|
abilities_store,
|
||||||
)),
|
)),
|
||||||
}?;
|
}?;
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ use crate::layout::{
|
||||||
use bumpalo::collections::Vec;
|
use bumpalo::collections::Vec;
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
use roc_builtins::bitcode::{FloatWidth, IntWidth};
|
||||||
|
use roc_can::abilities::AbilitiesStore;
|
||||||
use roc_can::expr::{ClosureData, IntValue};
|
use roc_can::expr::{ClosureData, IntValue};
|
||||||
use roc_collections::all::{default_hasher, BumpMap, BumpMapDefault, MutMap};
|
use roc_collections::all::{default_hasher, BumpMap, BumpMapDefault, MutMap};
|
||||||
use roc_exhaustive::{Ctor, Guard, RenderAs, TagId};
|
use roc_exhaustive::{Ctor, Guard, RenderAs, TagId};
|
||||||
|
@ -1119,6 +1120,7 @@ pub struct Env<'a, 'i> {
|
||||||
pub target_info: TargetInfo,
|
pub target_info: TargetInfo,
|
||||||
pub update_mode_ids: &'i mut UpdateModeIds,
|
pub update_mode_ids: &'i mut UpdateModeIds,
|
||||||
pub call_specialization_counter: u32,
|
pub call_specialization_counter: u32,
|
||||||
|
pub abilities_store: &'i AbilitiesStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'i> Env<'a, 'i> {
|
impl<'a, 'i> Env<'a, 'i> {
|
||||||
|
|
|
@ -125,6 +125,7 @@ mod test_reporting {
|
||||||
mut solved,
|
mut solved,
|
||||||
exposed_to_host,
|
exposed_to_host,
|
||||||
mut declarations_by_id,
|
mut declarations_by_id,
|
||||||
|
abilities_store,
|
||||||
..
|
..
|
||||||
} = result?;
|
} = result?;
|
||||||
|
|
||||||
|
@ -177,6 +178,7 @@ mod test_reporting {
|
||||||
target_info,
|
target_info,
|
||||||
// call_specialization_counter=0 is reserved
|
// call_specialization_counter=0 is reserved
|
||||||
call_specialization_counter: 1,
|
call_specialization_counter: 1,
|
||||||
|
abilities_store: &abilities_store,
|
||||||
};
|
};
|
||||||
let _mono_expr = Stmt::new(
|
let _mono_expr = Stmt::new(
|
||||||
&mut mono_env,
|
&mut mono_env,
|
||||||
|
@ -334,6 +336,7 @@ mod test_reporting {
|
||||||
target_info,
|
target_info,
|
||||||
// call_specialization_counter=0 is reserved
|
// call_specialization_counter=0 is reserved
|
||||||
call_specialization_counter: 1,
|
call_specialization_counter: 1,
|
||||||
|
abilities_store: &abilities_store,
|
||||||
};
|
};
|
||||||
let _mono_expr = Stmt::new(
|
let _mono_expr = Stmt::new(
|
||||||
&mut mono_env,
|
&mut mono_env,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue