mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-30 07:14:46 +00:00
turn module_thunks into a slice
This commit is contained in:
parent
6a6ea64323
commit
2e773e5f66
2 changed files with 14 additions and 7 deletions
|
@ -3952,7 +3952,7 @@ fn make_specializations<'a>(
|
||||||
let mut procs = Procs::new_in(arena);
|
let mut procs = Procs::new_in(arena);
|
||||||
|
|
||||||
procs.partial_procs = procs_base.partial_procs;
|
procs.partial_procs = procs_base.partial_procs;
|
||||||
procs.module_thunks.extend(procs_base.module_thunks);
|
procs.module_thunks = procs_base.module_thunks;
|
||||||
procs.runtime_errors = procs_base.runtime_errors;
|
procs.runtime_errors = procs_base.runtime_errors;
|
||||||
procs.imported_module_thunks = procs_base.imported_module_thunks;
|
procs.imported_module_thunks = procs_base.imported_module_thunks;
|
||||||
|
|
||||||
|
@ -3990,7 +3990,7 @@ fn make_specializations<'a>(
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
struct ProcsBase<'a> {
|
struct ProcsBase<'a> {
|
||||||
partial_procs: BumpMap<Symbol, PartialProc<'a>>,
|
partial_procs: BumpMap<Symbol, PartialProc<'a>>,
|
||||||
module_thunks: std::vec::Vec<Symbol>,
|
module_thunks: &'a [Symbol],
|
||||||
pending_specializations: BumpMap<Symbol, MutMap<ProcLayout<'a>, PendingSpecialization<'a>>>,
|
pending_specializations: BumpMap<Symbol, MutMap<ProcLayout<'a>, PendingSpecialization<'a>>>,
|
||||||
runtime_errors: BumpMap<Symbol, &'a str>,
|
runtime_errors: BumpMap<Symbol, &'a str>,
|
||||||
imported_module_thunks: &'a [Symbol],
|
imported_module_thunks: &'a [Symbol],
|
||||||
|
@ -4028,9 +4028,11 @@ fn build_pending_specializations<'a>(
|
||||||
) -> Msg<'a> {
|
) -> Msg<'a> {
|
||||||
let find_specializations_start = SystemTime::now();
|
let find_specializations_start = SystemTime::now();
|
||||||
|
|
||||||
|
let mut module_thunks = bumpalo::collections::Vec::new_in(arena);
|
||||||
|
|
||||||
let mut procs_base = ProcsBase {
|
let mut procs_base = ProcsBase {
|
||||||
partial_procs: BumpMap::default(),
|
partial_procs: BumpMap::default(),
|
||||||
module_thunks: std::vec::Vec::new(),
|
module_thunks: &[],
|
||||||
pending_specializations: BumpMap::default(),
|
pending_specializations: BumpMap::default(),
|
||||||
runtime_errors: BumpMap::default(),
|
runtime_errors: BumpMap::default(),
|
||||||
imported_module_thunks,
|
imported_module_thunks,
|
||||||
|
@ -4058,6 +4060,7 @@ fn build_pending_specializations<'a>(
|
||||||
Declare(def) | Builtin(def) => add_def_to_module(
|
Declare(def) | Builtin(def) => add_def_to_module(
|
||||||
&mut layout_cache,
|
&mut layout_cache,
|
||||||
&mut procs_base,
|
&mut procs_base,
|
||||||
|
&mut module_thunks,
|
||||||
&mut mono_env,
|
&mut mono_env,
|
||||||
def,
|
def,
|
||||||
&exposed_to_host,
|
&exposed_to_host,
|
||||||
|
@ -4068,6 +4071,7 @@ fn build_pending_specializations<'a>(
|
||||||
add_def_to_module(
|
add_def_to_module(
|
||||||
&mut layout_cache,
|
&mut layout_cache,
|
||||||
&mut procs_base,
|
&mut procs_base,
|
||||||
|
&mut module_thunks,
|
||||||
&mut mono_env,
|
&mut mono_env,
|
||||||
def,
|
def,
|
||||||
&exposed_to_host,
|
&exposed_to_host,
|
||||||
|
@ -4082,6 +4086,8 @@ fn build_pending_specializations<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
procs_base.module_thunks = module_thunks.into_bump_slice();
|
||||||
|
|
||||||
let problems = mono_env.problems.to_vec();
|
let problems = mono_env.problems.to_vec();
|
||||||
|
|
||||||
let find_specializations_end = SystemTime::now();
|
let find_specializations_end = SystemTime::now();
|
||||||
|
@ -4103,6 +4109,7 @@ fn build_pending_specializations<'a>(
|
||||||
fn add_def_to_module<'a>(
|
fn add_def_to_module<'a>(
|
||||||
layout_cache: &mut LayoutCache<'a>,
|
layout_cache: &mut LayoutCache<'a>,
|
||||||
procs: &mut ProcsBase<'a>,
|
procs: &mut ProcsBase<'a>,
|
||||||
|
module_thunks: &mut bumpalo::collections::Vec<'a, Symbol>,
|
||||||
mono_env: &mut roc_mono::ir::Env<'a, '_>,
|
mono_env: &mut roc_mono::ir::Env<'a, '_>,
|
||||||
def: roc_can::def::Def,
|
def: roc_can::def::Def,
|
||||||
exposed_to_host: &MutMap<Symbol, Variable>,
|
exposed_to_host: &MutMap<Symbol, Variable>,
|
||||||
|
@ -4193,7 +4200,7 @@ fn add_def_to_module<'a>(
|
||||||
}
|
}
|
||||||
body => {
|
body => {
|
||||||
// mark this symbols as a top-level thunk before any other work on the procs
|
// mark this symbols as a top-level thunk before any other work on the procs
|
||||||
procs.module_thunks.push(symbol);
|
module_thunks.push(symbol);
|
||||||
|
|
||||||
// If this is an exposed symbol, we need to
|
// If this is an exposed symbol, we need to
|
||||||
// register it as such. Otherwise, since it
|
// register it as such. Otherwise, since it
|
||||||
|
|
|
@ -8,7 +8,7 @@ use crate::layout::{
|
||||||
};
|
};
|
||||||
use bumpalo::collections::Vec;
|
use bumpalo::collections::Vec;
|
||||||
use bumpalo::Bump;
|
use bumpalo::Bump;
|
||||||
use roc_collections::all::{default_hasher, BumpMap, BumpMapDefault, BumpSet, MutMap, MutSet};
|
use roc_collections::all::{default_hasher, BumpMap, BumpMapDefault, MutMap, MutSet};
|
||||||
use roc_module::ident::{ForeignSymbol, Lowercase, TagName};
|
use roc_module::ident::{ForeignSymbol, Lowercase, TagName};
|
||||||
use roc_module::low_level::LowLevel;
|
use roc_module::low_level::LowLevel;
|
||||||
use roc_module::symbol::{IdentIds, ModuleId, Symbol};
|
use roc_module::symbol::{IdentIds, ModuleId, Symbol};
|
||||||
|
@ -418,7 +418,7 @@ impl<'a> ExternalSpecializations<'a> {
|
||||||
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: &'a [Symbol],
|
pub imported_module_thunks: &'a [Symbol],
|
||||||
pub module_thunks: BumpSet<Symbol>,
|
pub module_thunks: &'a [Symbol],
|
||||||
pub pending_specializations:
|
pub pending_specializations:
|
||||||
Option<BumpMap<Symbol, MutMap<ProcLayout<'a>, PendingSpecialization<'a>>>>,
|
Option<BumpMap<Symbol, MutMap<ProcLayout<'a>, PendingSpecialization<'a>>>>,
|
||||||
pub specialized: BumpMap<(Symbol, ProcLayout<'a>), InProgressProc<'a>>,
|
pub specialized: BumpMap<(Symbol, ProcLayout<'a>), InProgressProc<'a>>,
|
||||||
|
@ -432,7 +432,7 @@ impl<'a> Procs<'a> {
|
||||||
Self {
|
Self {
|
||||||
partial_procs: BumpMap::new_in(arena),
|
partial_procs: BumpMap::new_in(arena),
|
||||||
imported_module_thunks: &[],
|
imported_module_thunks: &[],
|
||||||
module_thunks: BumpSet::new_in(arena),
|
module_thunks: &[],
|
||||||
pending_specializations: Some(BumpMap::new_in(arena)),
|
pending_specializations: Some(BumpMap::new_in(arena)),
|
||||||
specialized: BumpMap::new_in(arena),
|
specialized: BumpMap::new_in(arena),
|
||||||
runtime_errors: BumpMap::new_in(arena),
|
runtime_errors: BumpMap::new_in(arena),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue