evacuate when allocating anon vars

This commit is contained in:
Mark Thom
2019-02-24 13:40:58 -07:00
parent 8f9c620a89
commit dc89ed57f2
6 changed files with 15 additions and 10 deletions

View File

@@ -211,7 +211,7 @@ impl<'a> Allocator<'a> for DebrayAllocator
}
}
fn mark_anon_var<Target>(&mut self, lvl: Level, target: &mut Vec<Target>)
fn mark_anon_var<Target>(&mut self, lvl: Level, term_loc: GenContext, target: &mut Vec<Target>)
where Target: CompilationTarget<'a>
{
let r = RegType::Temp(self.alloc_reg_to_non_var());
@@ -220,8 +220,13 @@ impl<'a> Allocator<'a> for DebrayAllocator
Level::Deep => target.push(Target::subterm_to_variable(r)),
Level::Root | Level::Shallow => {
let k = self.arg_c;
self.arg_c += 1;
if let GenContext::Last(chunk_num) = term_loc {
self.evacuate_arg(chunk_num, target);
}
self.arg_c += 1;
target.push(Target::argument_to_variable(r, k));
}
};