properly update dynamically updated predicates in module indices

This commit is contained in:
Mark Thom
2019-03-08 23:11:06 -07:00
parent da0e1b9436
commit 92c36aa0d9
2 changed files with 8 additions and 12 deletions

View File

@@ -183,7 +183,7 @@ fn compile_into_module<R: Read>(wam: &mut Machine, module_name: ClauseName, src:
if module.module_decl.exports.contains(&(name.clone(), arity)) { if module.module_decl.exports.contains(&(name.clone(), arity)) {
if let Some(idx) = wam.indices.code_dir.get(&(name.clone(), arity)) { if let Some(idx) = wam.indices.code_dir.get(&(name.clone(), arity)) {
if module.module_decl.name == idx.0.borrow().1 { if module.module_decl.name == module_name {
if module_code.len() > 0 { if module_code.len() > 0 {
set_code_index!(idx, IndexPtr::Index(wam.code_repo.code.len()), set_code_index!(idx, IndexPtr::Index(wam.code_repo.code.len()),
module_name.clone()); module_name.clone());
@@ -423,10 +423,7 @@ impl ListingCompiler {
let idx = code_dir.entry((name.clone(), arity)).or_insert(CodeIndex::default()); let idx = code_dir.entry((name.clone(), arity)).or_insert(CodeIndex::default());
set_code_index!(idx, IndexPtr::Index(p), self.get_module_name()); set_code_index!(idx, IndexPtr::Index(p), self.get_module_name());
/*
println!("{}/{}:", name.as_str(), arity);
print_code(&decl_code);
*/
self.localize_self_calls(name, arity, &mut decl_code, p); self.localize_self_calls(name, arity, &mut decl_code, p);
code.extend(decl_code.into_iter()); code.extend(decl_code.into_iter());
} }

View File

@@ -104,7 +104,6 @@ impl SubModuleUser for IndexStore {
fn remove_code_index(&mut self, key: PredicateKey) fn remove_code_index(&mut self, key: PredicateKey)
{ {
self.code_dir.remove(&key); self.code_dir.remove(&key);
self.dynamic_code_dir.remove(&(key.0.owning_module(), key.0, key.1));
} }
fn insert_dir_entry(&mut self, name: ClauseName, arity: usize, idx: CodeIndex) fn insert_dir_entry(&mut self, name: ClauseName, arity: usize, idx: CodeIndex)