Add gen support for Nat

This commit is contained in:
Jared Ramirez 2021-01-01 17:40:47 -06:00
parent 37510e6aae
commit faa8f66b6c
9 changed files with 137 additions and 63 deletions

View file

@ -947,6 +947,7 @@ pub fn load_and_typecheck(
stdlib: StdLib,
src_dir: &Path,
exposed_types: SubsByModule,
ptr_bytes: u32,
) -> Result<LoadedModule, LoadingProblem> {
use LoadResult::*;
@ -959,6 +960,7 @@ pub fn load_and_typecheck(
src_dir,
exposed_types,
Phase::SolveTypes,
ptr_bytes,
)? {
Monomorphized(_) => unreachable!(""),
TypeChecked(module) => Ok(module),
@ -971,6 +973,7 @@ pub fn load_and_monomorphize<'a>(
stdlib: StdLib,
src_dir: &Path,
exposed_types: SubsByModule,
ptr_bytes: u32,
) -> Result<MonomorphizedModule<'a>, LoadingProblem> {
use LoadResult::*;
@ -983,6 +986,7 @@ pub fn load_and_monomorphize<'a>(
src_dir,
exposed_types,
Phase::MakeSpecializations,
ptr_bytes,
)? {
Monomorphized(module) => Ok(module),
TypeChecked(_) => unreachable!(""),
@ -996,6 +1000,7 @@ pub fn load_and_monomorphize_from_str<'a>(
stdlib: StdLib,
src_dir: &Path,
exposed_types: SubsByModule,
ptr_bytes: u32,
) -> Result<MonomorphizedModule<'a>, LoadingProblem> {
use LoadResult::*;
@ -1008,6 +1013,7 @@ pub fn load_and_monomorphize_from_str<'a>(
src_dir,
exposed_types,
Phase::MakeSpecializations,
ptr_bytes,
)? {
Monomorphized(module) => Ok(module),
TypeChecked(_) => unreachable!(""),
@ -1144,6 +1150,7 @@ fn load<'a>(
src_dir: &Path,
exposed_types: SubsByModule,
goal_phase: Phase,
ptr_bytes: u32,
) -> Result<LoadResult<'a>, LoadingProblem>
where
{
@ -1259,8 +1266,14 @@ where
// added. In that case, do nothing, and keep waiting
// until we receive a Shutdown message.
if let Some(task) = find_task(&worker, injector, stealers) {
run_task(task, worker_arena, src_dir, msg_tx.clone())
.expect("Msg channel closed unexpectedly.");
run_task(
task,
worker_arena,
src_dir,
msg_tx.clone(),
ptr_bytes,
)
.expect("Msg channel closed unexpectedly.");
}
}
}
@ -3341,6 +3354,7 @@ fn make_specializations<'a>(
mut layout_cache: LayoutCache<'a>,
specializations_we_must_make: ExternalSpecializations,
mut module_timing: ModuleTiming,
ptr_bytes: u32,
) -> Msg<'a> {
let make_specializations_start = SystemTime::now();
let mut mono_problems = Vec::new();
@ -3351,6 +3365,7 @@ fn make_specializations<'a>(
subs: &mut subs,
home,
ident_ids: &mut ident_ids,
ptr_bytes,
};
procs
@ -3396,6 +3411,7 @@ fn build_pending_specializations<'a>(
decls: Vec<Declaration>,
mut module_timing: ModuleTiming,
mut layout_cache: LayoutCache<'a>,
ptr_bytes: u32,
// TODO remove
exposed_to_host: MutMap<Symbol, Variable>,
) -> Msg<'a> {
@ -3410,6 +3426,7 @@ fn build_pending_specializations<'a>(
subs: &mut subs,
home,
ident_ids: &mut ident_ids,
ptr_bytes,
};
// Add modules' decls to Procs
@ -3613,6 +3630,7 @@ fn run_task<'a>(
arena: &'a Bump,
src_dir: &Path,
msg_tx: MsgSender<'a>,
ptr_bytes: u32,
) -> Result<(), LoadingProblem> {
use BuildTask::*;
@ -3685,6 +3703,7 @@ fn run_task<'a>(
decls,
module_timing,
layout_cache,
ptr_bytes,
exposed_to_host,
)),
MakeSpecializations {
@ -3704,6 +3723,7 @@ fn run_task<'a>(
layout_cache,
specializations_we_must_make,
module_timing,
ptr_bytes,
)),
}?;