mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 07:41:12 +00:00
use vector instead of set
This commit is contained in:
parent
9740fffe51
commit
9d343ab206
2 changed files with 13 additions and 9 deletions
|
@ -8,7 +8,7 @@ use roc_builtins::std::StdLib;
|
||||||
use roc_can::constraint::Constraint;
|
use roc_can::constraint::Constraint;
|
||||||
use roc_can::def::{Declaration, Def};
|
use roc_can::def::{Declaration, Def};
|
||||||
use roc_can::module::{canonicalize_module_defs, Module};
|
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::{
|
use roc_constrain::module::{
|
||||||
constrain_imports, pre_constrain_imports, ConstrainableImports, Import,
|
constrain_imports, pre_constrain_imports, ConstrainableImports, Import,
|
||||||
};
|
};
|
||||||
|
@ -553,7 +553,7 @@ fn start_phase<'a>(
|
||||||
ident_ids,
|
ident_ids,
|
||||||
} = typechecked;
|
} = 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) {
|
if let Some(imports) = state.module_cache.imports.get(&module_id) {
|
||||||
for imported in imports.iter() {
|
for imported in imports.iter() {
|
||||||
|
@ -570,7 +570,7 @@ fn start_phase<'a>(
|
||||||
module_id,
|
module_id,
|
||||||
module_timing,
|
module_timing,
|
||||||
solved_subs,
|
solved_subs,
|
||||||
imported_module_thunks,
|
imported_module_thunks: imported_module_thunks.into_bump_slice(),
|
||||||
decls,
|
decls,
|
||||||
ident_ids,
|
ident_ids,
|
||||||
exposed_to_host: state.exposed_to_host.clone(),
|
exposed_to_host: state.exposed_to_host.clone(),
|
||||||
|
@ -1035,7 +1035,7 @@ enum BuildTask<'a> {
|
||||||
module_timing: ModuleTiming,
|
module_timing: ModuleTiming,
|
||||||
layout_cache: LayoutCache<'a>,
|
layout_cache: LayoutCache<'a>,
|
||||||
solved_subs: Solved<Subs>,
|
solved_subs: Solved<Subs>,
|
||||||
imported_module_thunks: BumpSet<Symbol>,
|
imported_module_thunks: &'a [Symbol],
|
||||||
module_id: ModuleId,
|
module_id: ModuleId,
|
||||||
ident_ids: IdentIds,
|
ident_ids: IdentIds,
|
||||||
decls: Vec<Declaration>,
|
decls: Vec<Declaration>,
|
||||||
|
@ -3985,7 +3985,7 @@ fn make_specializations<'a>(
|
||||||
fn build_pending_specializations<'a>(
|
fn build_pending_specializations<'a>(
|
||||||
arena: &'a Bump,
|
arena: &'a Bump,
|
||||||
solved_subs: Solved<Subs>,
|
solved_subs: Solved<Subs>,
|
||||||
imported_module_thunks: BumpSet<Symbol>,
|
imported_module_thunks: &'a [Symbol],
|
||||||
home: ModuleId,
|
home: ModuleId,
|
||||||
mut ident_ids: IdentIds,
|
mut ident_ids: IdentIds,
|
||||||
decls: Vec<Declaration>,
|
decls: Vec<Declaration>,
|
||||||
|
|
|
@ -350,7 +350,7 @@ impl<'a> ExternalSpecializations<'a> {
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Procs<'a> {
|
pub struct Procs<'a> {
|
||||||
pub partial_procs: BumpMap<Symbol, PartialProc<'a>>,
|
pub partial_procs: BumpMap<Symbol, PartialProc<'a>>,
|
||||||
pub imported_module_thunks: BumpSet<Symbol>,
|
pub imported_module_thunks: &'a [Symbol],
|
||||||
pub module_thunks: BumpSet<Symbol>,
|
pub module_thunks: BumpSet<Symbol>,
|
||||||
pub pending_specializations:
|
pub pending_specializations:
|
||||||
Option<BumpMap<Symbol, MutMap<ProcLayout<'a>, PendingSpecialization<'a>>>>,
|
Option<BumpMap<Symbol, MutMap<ProcLayout<'a>, PendingSpecialization<'a>>>>,
|
||||||
|
@ -364,7 +364,7 @@ impl<'a> Procs<'a> {
|
||||||
pub fn new_in(arena: &'a Bump) -> Self {
|
pub fn new_in(arena: &'a Bump) -> Self {
|
||||||
Self {
|
Self {
|
||||||
partial_procs: BumpMap::new_in(arena),
|
partial_procs: BumpMap::new_in(arena),
|
||||||
imported_module_thunks: BumpSet::new_in(arena),
|
imported_module_thunks: &[],
|
||||||
module_thunks: BumpSet::new_in(arena),
|
module_thunks: BumpSet::new_in(arena),
|
||||||
pending_specializations: Some(BumpMap::new_in(arena)),
|
pending_specializations: Some(BumpMap::new_in(arena)),
|
||||||
specialized: BumpMap::new_in(arena),
|
specialized: BumpMap::new_in(arena),
|
||||||
|
@ -382,6 +382,10 @@ pub enum InProgressProc<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Procs<'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(
|
pub fn get_specialized_procs_without_rc(
|
||||||
self,
|
self,
|
||||||
env: &mut Env<'a, '_>,
|
env: &mut Env<'a, '_>,
|
||||||
|
@ -6091,7 +6095,7 @@ fn reuse_function_symbol<'a>(
|
||||||
.raw_from_var(env.arena, arg_var, env.subs)
|
.raw_from_var(env.arena, arg_var, env.subs)
|
||||||
.expect("creating layout does not fail");
|
.expect("creating layout does not fail");
|
||||||
|
|
||||||
if procs.imported_module_thunks.contains(&original) {
|
if procs.is_imported_module_thunk(original) {
|
||||||
let layout = match raw {
|
let layout = match raw {
|
||||||
RawFunctionLayout::ZeroArgumentThunk(layout) => layout,
|
RawFunctionLayout::ZeroArgumentThunk(layout) => layout,
|
||||||
RawFunctionLayout::Function(_, lambda_set, _) => {
|
RawFunctionLayout::Function(_, lambda_set, _) => {
|
||||||
|
@ -6562,7 +6566,7 @@ fn call_by_name_help<'a>(
|
||||||
add_needed_external(procs, env, original_fn_var, proc_name);
|
add_needed_external(procs, env, original_fn_var, proc_name);
|
||||||
|
|
||||||
debug_assert_ne!(proc_name.module_id(), ModuleId::ATTR);
|
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(
|
force_thunk(
|
||||||
env,
|
env,
|
||||||
proc_name,
|
proc_name,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue