Code gen toplevel module functions

This commit is contained in:
Richard Feldman 2020-05-01 17:53:32 -04:00
parent 1a2367c8aa
commit ee31eac0c5
7 changed files with 183 additions and 141 deletions

View file

@ -63,7 +63,17 @@ macro_rules! assert_llvm_evals_to {
// Populate Procs and get the low-level Expr from the canonical Expr
let mut mono_problems = Vec::new();
let main_body = Expr::new(&arena, &mut subs, &mut mono_problems, loc_expr.value, &mut procs, home, &mut ident_ids, ptr_bytes);
let mut mono_env = roc_mono::expr::Env {
arena: &arena,
subs: &mut subs,
problems: &mut mono_problems,
home,
ident_ids: &mut ident_ids,
pointer_size: ptr_bytes,
symbol_counter: 0,
jump_counter: arena.alloc(0),
};
let main_body = Expr::new(&mut mono_env, loc_expr.value, &mut procs);
// Put this module's ident_ids back in the interns, so we can use them in Env.
env.interns.all_ident_ids.insert(home, ident_ids);
@ -215,7 +225,17 @@ macro_rules! assert_opt_evals_to {
// Populate Procs and get the low-level Expr from the canonical Expr
let mut mono_problems = Vec::new();
let main_body = Expr::new(&arena, &mut subs, &mut mono_problems, loc_expr.value, &mut procs, home, &mut ident_ids, ptr_bytes);
let mut mono_env = roc_mono::expr::Env {
arena: &arena,
subs: &mut subs,
problems: &mut mono_problems,
home,
ident_ids: &mut ident_ids,
pointer_size: ptr_bytes,
symbol_counter: 0,
jump_counter: arena.alloc(0),
};
let main_body = Expr::new(&mut mono_env, loc_expr.value, &mut procs);
// Put this module's ident_ids back in the interns, so we can use them in Env.
env.interns.all_ident_ids.insert(home, ident_ids);
@ -361,7 +381,17 @@ macro_rules! emit_expr {
let mut ident_ids = env.interns.all_ident_ids.remove(&home).unwrap();
// Populate Procs and get the low-level Expr from the canonical Expr
let main_body = Expr::new(&arena, &mut subs, loc_expr.value, &mut procs, home, &mut ident_ids, $crate::helpers::eval::POINTER_SIZE);
let mut mono_env = roc_mono::expr::Env {
arena: &arena,
subs: &mut subs,
problems: &mut mono_problems,
home,
ident_ids: &mut ident_ids,
pointer_size: ptr_bytes,
symbol_counter: 0,
jump_counter: arena.alloc(0),
};
let main_body = Expr::new(&mut mono_env, loc_expr.value, &mut procs);
// Put this module's ident_ids back in the interns, so we can use them in Env.
env.interns.all_ident_ids.insert(home, ident_ids);