fix allocator bug.
This commit is contained in:
@@ -18,7 +18,6 @@ pub trait Allocator<'a>
|
|||||||
fn reset(&mut self);
|
fn reset(&mut self);
|
||||||
fn reset_contents(&mut self) {}
|
fn reset_contents(&mut self) {}
|
||||||
fn reset_arg(&mut self, usize);
|
fn reset_arg(&mut self, usize);
|
||||||
fn reset_arg_at_head(&mut self, &'a Term);
|
|
||||||
|
|
||||||
fn advance_arg(&mut self);
|
fn advance_arg(&mut self);
|
||||||
|
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
|||||||
let mut code = Vec::new();
|
let mut code = Vec::new();
|
||||||
|
|
||||||
if let &QueryTerm::Term(ref term) = p0 {
|
if let &QueryTerm::Term(ref term) = p0 {
|
||||||
self.marker.reset_arg_at_head(term);
|
self.marker.reset_arg(term.arity());
|
||||||
self.compile_seq_prelude(&conjunct_info, &mut code);
|
self.compile_seq_prelude(&conjunct_info, &mut code);
|
||||||
|
|
||||||
if let &Term::Clause(..) = term {
|
if let &Term::Clause(..) = term {
|
||||||
@@ -586,8 +586,6 @@ impl<'a, TermMarker: Allocator<'a>> CodeGenerator<'a, TermMarker>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// self.marker.reset_arg_at_head(term);
|
|
||||||
|
|
||||||
let iter = ChunkedIterator::from_rule_body(p1, clauses);
|
let iter = ChunkedIterator::from_rule_body(p1, clauses);
|
||||||
try!(self.compile_seq(iter, &conjunct_info, &mut code, false));
|
try!(self.compile_seq(iter, &conjunct_info, &mut code, false));
|
||||||
|
|
||||||
|
|||||||
@@ -273,11 +273,9 @@ impl<'a> Allocator<'a> for DebrayAllocator<'a>
|
|||||||
Level::Shallow => {
|
Level::Shallow => {
|
||||||
let k = self.arg_c;
|
let k = self.arg_c;
|
||||||
|
|
||||||
if !r.is_perm() {
|
|
||||||
if self.is_curr_arg_distinct_from(var) {
|
if self.is_curr_arg_distinct_from(var) {
|
||||||
self.evacuate_arg(term_loc.chunk_num(), target);
|
self.evacuate_arg(term_loc.chunk_num(), target);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
self.arg_c += 1;
|
self.arg_c += 1;
|
||||||
|
|
||||||
@@ -345,19 +343,4 @@ impl<'a> Allocator<'a> for DebrayAllocator<'a>
|
|||||||
self.arg_c = 1;
|
self.arg_c = 1;
|
||||||
self.temp_lb = arity + 1;
|
self.temp_lb = arity + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reset_arg_at_head(&mut self, term: &'a Term) {
|
|
||||||
self.arg_c = 1;
|
|
||||||
self.temp_lb = term.arity() + 1;
|
|
||||||
|
|
||||||
match term {
|
|
||||||
&Term::Clause(_, _, ref subterms, _) =>
|
|
||||||
for (idx, tr) in subterms.iter().enumerate() {
|
|
||||||
if let &Term::Var(_, _) = tr.as_ref() {
|
|
||||||
self.in_use.insert(idx + 1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
_ => {}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user