add Addr::AttVar to address ordering
This commit is contained in:
@@ -747,7 +747,7 @@ impl PartialOrd<Ref> for Addr {
|
|||||||
Some(Ordering::Less)
|
Some(Ordering::Less)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
&Addr::HeapCell(h) =>
|
&Addr::HeapCell(h) | &Addr::AttrVar(h, _) =>
|
||||||
match r {
|
match r {
|
||||||
&Ref::StackCell(..) => Some(Ordering::Less),
|
&Ref::StackCell(..) => Some(Ordering::Less),
|
||||||
&Ref::HeapCell(h1) => h.partial_cmp(&h1)
|
&Ref::HeapCell(h1) => h.partial_cmp(&h1)
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ get_attrs_var_check -->
|
|||||||
|
|
||||||
put_attrs(Name/Arity) -->
|
put_attrs(Name/Arity) -->
|
||||||
put_attr(Name, Arity),
|
put_attr(Name, Arity),
|
||||||
{ numbervars([Var, Attr], 0, _) },
|
{ numbervars([Var, Attr], 0, _) },
|
||||||
[(put_atts(Var, Attr) :- lists:maplist(put_atts(Var), Attr))].
|
[(put_atts(Var, Attr) :- lists:maplist(put_atts(Var), Attr))].
|
||||||
put_attrs((Name/Arity, Atts)) -->
|
put_attrs((Name/Arity, Atts)) -->
|
||||||
{ nonvar(Atts) },
|
{ nonvar(Atts) },
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ impl IndexStore {
|
|||||||
.and_then(|ref module| module.code_dir.get(&(name, arity)))
|
.and_then(|ref module| module.code_dir.get(&(name, arity)))
|
||||||
.cloned()
|
.cloned()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn get_cleaner_sites(&self) -> (usize, usize) {
|
pub(super) fn get_cleaner_sites(&self) -> (usize, usize) {
|
||||||
let r_w_h = clause_name!("run_cleaners_with_handling");
|
let r_w_h = clause_name!("run_cleaners_with_handling");
|
||||||
let r_wo_h = clause_name!("run_cleaners_without_handling");
|
let r_wo_h = clause_name!("run_cleaners_without_handling");
|
||||||
@@ -109,7 +109,7 @@ impl IndexStore {
|
|||||||
|
|
||||||
pub type CompiledResult = (Predicate, VecDeque<TopLevel>);
|
pub type CompiledResult = (Predicate, VecDeque<TopLevel>);
|
||||||
|
|
||||||
impl CodeRepo {
|
impl CodeRepo {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
CodeRepo {
|
CodeRepo {
|
||||||
@@ -130,14 +130,14 @@ impl CodeRepo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn truncate_terms(&mut self, key: PredicateKey, len: usize, queue_len: usize)
|
pub fn truncate_terms(&mut self, key: PredicateKey, len: usize, queue_len: usize)
|
||||||
-> (Predicate, VecDeque<TopLevel>)
|
-> (Predicate, VecDeque<TopLevel>)
|
||||||
{
|
{
|
||||||
self.term_dir.get_mut(&key)
|
self.term_dir.get_mut(&key)
|
||||||
.map(|entry| (Predicate((entry.0).0.drain(len ..).collect()),
|
.map(|entry| (Predicate((entry.0).0.drain(len ..).collect()),
|
||||||
entry.1.drain(queue_len ..).collect()))
|
entry.1.drain(queue_len ..).collect()))
|
||||||
.unwrap_or((Predicate::new(), VecDeque::from(vec![])))
|
.unwrap_or((Predicate::new(), VecDeque::from(vec![])))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_in_situ_result(&mut self, result: &CompiledResult, in_situ_code_dir: &mut InSituCodeDir,
|
pub fn add_in_situ_result(&mut self, result: &CompiledResult, in_situ_code_dir: &mut InSituCodeDir,
|
||||||
flags: MachineFlags)
|
flags: MachineFlags)
|
||||||
@@ -154,10 +154,10 @@ impl CodeRepo {
|
|||||||
|
|
||||||
let mut cg = CodeGenerator::<DebrayAllocator>::new(true, flags);
|
let mut cg = CodeGenerator::<DebrayAllocator>::new(true, flags);
|
||||||
// clone the decl to avoid the need to wipe its register cells later.
|
// clone the decl to avoid the need to wipe its register cells later.
|
||||||
let mut decl_code = cg.compile_predicate(&decl.0.clone())?;
|
let mut decl_code = cg.compile_predicate(&decl.0.clone())?;
|
||||||
|
|
||||||
compile_appendix(&mut decl_code, queue, true, flags)?;
|
compile_appendix(&mut decl_code, queue, true, flags)?;
|
||||||
|
|
||||||
self.in_situ_code.extend(decl_code.into_iter());
|
self.in_situ_code.extend(decl_code.into_iter());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ impl SubModuleUser for IndexStore {
|
|||||||
use_qualified_module(self, submodule, exports)?;
|
use_qualified_module(self, submodule, exports)?;
|
||||||
submodule.dump_expansions(code_repo, flags).map_err(SessionError::from)
|
submodule.dump_expansions(code_repo, flags).map_err(SessionError::from)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn use_module(&mut self, code_repo: &mut CodeRepo, flags: MachineFlags, submodule: &Module)
|
fn use_module(&mut self, code_repo: &mut CodeRepo, flags: MachineFlags, submodule: &Module)
|
||||||
-> Result<(), SessionError>
|
-> Result<(), SessionError>
|
||||||
{
|
{
|
||||||
@@ -429,7 +429,8 @@ impl Machine {
|
|||||||
let mut heap_locs = HashMap::new();
|
let mut heap_locs = HashMap::new();
|
||||||
|
|
||||||
self.code_repo.cached_query = code;
|
self.code_repo.cached_query = code;
|
||||||
self.machine_st.run_query(&mut self.indices, &mut self.policies, &self.code_repo, &alloc_locs, &mut heap_locs);
|
self.machine_st.run_query(&mut self.indices, &mut self.policies, &self.code_repo,
|
||||||
|
&alloc_locs, &mut heap_locs);
|
||||||
|
|
||||||
if self.machine_st.fail {
|
if self.machine_st.fail {
|
||||||
self.fail(&heap_locs)
|
self.fail(&heap_locs)
|
||||||
@@ -632,7 +633,7 @@ impl MachineState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.query_stepper(indices, policies, code_repo);
|
self.query_stepper(indices, policies, code_repo);
|
||||||
|
|
||||||
match self.p {
|
match self.p {
|
||||||
CodePtr::Local(LocalCodePtr::TopLevel(_, p)) if p > 0 => {},
|
CodePtr::Local(LocalCodePtr::TopLevel(_, p)) if p > 0 => {},
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
Reference in New Issue
Block a user