diff --git a/compiler/load/src/file.rs b/compiler/load/src/file.rs index ad541252f7..543c75c037 100644 --- a/compiler/load/src/file.rs +++ b/compiler/load/src/file.rs @@ -8,7 +8,7 @@ use roc_builtins::std::StdLib; use roc_can::constraint::Constraint; use roc_can::def::{Declaration, Def}; use roc_can::module::{canonicalize_module_defs, Module}; -use roc_collections::all::{default_hasher, BumpMap, BumpMapDefault, BumpSet, MutMap, MutSet}; +use roc_collections::all::{default_hasher, BumpMap, MutMap, MutSet}; use roc_constrain::module::{ constrain_imports, pre_constrain_imports, ConstrainableImports, Import, }; @@ -553,7 +553,7 @@ fn start_phase<'a>( ident_ids, } = typechecked; - let mut imported_module_thunks = BumpSet::new_in(arena); + let mut imported_module_thunks = bumpalo::collections::Vec::new_in(arena); if let Some(imports) = state.module_cache.imports.get(&module_id) { for imported in imports.iter() { @@ -570,7 +570,7 @@ fn start_phase<'a>( module_id, module_timing, solved_subs, - imported_module_thunks, + imported_module_thunks: imported_module_thunks.into_bump_slice(), decls, ident_ids, exposed_to_host: state.exposed_to_host.clone(), @@ -1035,7 +1035,7 @@ enum BuildTask<'a> { module_timing: ModuleTiming, layout_cache: LayoutCache<'a>, solved_subs: Solved, - imported_module_thunks: BumpSet, + imported_module_thunks: &'a [Symbol], module_id: ModuleId, ident_ids: IdentIds, decls: Vec, @@ -3985,7 +3985,7 @@ fn make_specializations<'a>( fn build_pending_specializations<'a>( arena: &'a Bump, solved_subs: Solved, - imported_module_thunks: BumpSet, + imported_module_thunks: &'a [Symbol], home: ModuleId, mut ident_ids: IdentIds, decls: Vec, diff --git a/compiler/mono/src/ir.rs b/compiler/mono/src/ir.rs index 61a5869d46..f64f338c21 100644 --- a/compiler/mono/src/ir.rs +++ b/compiler/mono/src/ir.rs @@ -350,7 +350,7 @@ impl<'a> ExternalSpecializations<'a> { #[derive(Clone, Debug)] pub struct Procs<'a> { pub partial_procs: BumpMap>, - pub imported_module_thunks: BumpSet, + pub imported_module_thunks: &'a [Symbol], pub module_thunks: BumpSet, pub pending_specializations: Option, PendingSpecialization<'a>>>>, @@ -364,7 +364,7 @@ impl<'a> Procs<'a> { pub fn new_in(arena: &'a Bump) -> Self { Self { partial_procs: BumpMap::new_in(arena), - imported_module_thunks: BumpSet::new_in(arena), + imported_module_thunks: &[], module_thunks: BumpSet::new_in(arena), pending_specializations: Some(BumpMap::new_in(arena)), specialized: BumpMap::new_in(arena), @@ -382,6 +382,10 @@ pub enum InProgressProc<'a> { } impl<'a> Procs<'a> { + fn is_imported_module_thunk(&self, symbol: Symbol) -> bool { + self.imported_module_thunks.iter().any(|x| *x == symbol) + } + pub fn get_specialized_procs_without_rc( self, env: &mut Env<'a, '_>, @@ -6091,7 +6095,7 @@ fn reuse_function_symbol<'a>( .raw_from_var(env.arena, arg_var, env.subs) .expect("creating layout does not fail"); - if procs.imported_module_thunks.contains(&original) { + if procs.is_imported_module_thunk(original) { let layout = match raw { RawFunctionLayout::ZeroArgumentThunk(layout) => layout, RawFunctionLayout::Function(_, lambda_set, _) => { @@ -6562,7 +6566,7 @@ fn call_by_name_help<'a>( add_needed_external(procs, env, original_fn_var, proc_name); debug_assert_ne!(proc_name.module_id(), ModuleId::ATTR); - if procs.imported_module_thunks.contains(&proc_name) { + if procs.is_imported_module_thunk(proc_name) { force_thunk( env, proc_name,