thread alias analysis solutions

This commit is contained in:
Folkert 2021-05-28 23:57:11 +02:00
parent 1b3bbaf5de
commit b75c40e65b
4 changed files with 22 additions and 1 deletions

1
Cargo.lock generated
View File

@ -2914,6 +2914,7 @@ dependencies = [
"inlinable_string",
"libloading 0.6.7",
"maplit",
"morphic_lib",
"pretty_assertions 0.5.1",
"quickcheck 0.8.5",
"quickcheck_macros 0.8.0",

View File

@ -21,6 +21,7 @@ roc_mono = { path = "../mono" }
roc_load = { path = "../load" }
roc_gen = { path = "../gen" }
roc_reporting = { path = "../reporting" }
morphic_lib = { path = "../../vendor/morphic_lib" }
im = "14" # im and im-rc should always have the same version!
im-rc = "14" # im and im-rc should always have the same version!
bumpalo = { version = "3.6.1", features = ["collections"] }

View File

@ -157,8 +157,27 @@ pub fn gen_from_mono_module(
headers.push((proc, fn_val));
}
use roc_load::file::AliasAnalysisSolutions::*;
let solutions = match loaded.alias_analysis_solutions {
NotAvailable => panic!(),
Available(solutions) => solutions,
};
let module_solutions = solutions
.mod_solutions(roc_mono::alias_analysis::MOD_APP)
.unwrap();
// Build each proc using its header info.
for (proc, fn_val) in headers {
let bytes = proc.name.to_ne_bytes();
let func_name = morphic_lib::FuncName(&bytes);
let func_specs = module_solutions.func_solutions(func_name).unwrap();
for spec_name in func_specs.specs() {
let morphic_lib::FuncSpec(bytes) = spec_name;
dbg!(proc.name, unsafe { std::str::from_utf8_unchecked(bytes) },);
let spec = func_specs.spec(spec_name).unwrap();
}
// NOTE: This is here to be uncommented in case verification fails.
// (This approach means we don't have to defensively clone name here.)
//

View File

@ -2085,7 +2085,7 @@ fn update<'a>(
&mut state.procedures,
);
if false {
if true {
let it = state.procedures.iter().map(|x| x.1);
match roc_mono::alias_analysis::spec_program(it) {