fix bug with mark_non_var
This commit is contained in:
@@ -35,7 +35,7 @@ Extend rusty-wam to include the following, among other features:
|
|||||||
- A representation of 'partial strings' as difference lists
|
- A representation of 'partial strings' as difference lists
|
||||||
of characters (_done_).
|
of characters (_done_).
|
||||||
* `term_expansion/2` and `goal_expansion/2` (_in progress_).
|
* `term_expansion/2` and `goal_expansion/2` (_in progress_).
|
||||||
* Definite Clause Grammars.
|
* Definite Clause Grammars (_in progress_).
|
||||||
* Attributed variables using the SICStus Prolog interface and
|
* Attributed variables using the SICStus Prolog interface and
|
||||||
semantics. Adding coroutines like `dif/2`, `freeze/2`, etc.
|
semantics. Adding coroutines like `dif/2`, `freeze/2`, etc.
|
||||||
is straightforward with attributed variables.
|
is straightforward with attributed variables.
|
||||||
|
|||||||
@@ -232,23 +232,22 @@ impl<'a> Allocator<'a> for DebrayAllocator
|
|||||||
{
|
{
|
||||||
let r = cell.get();
|
let r = cell.get();
|
||||||
|
|
||||||
if r.reg_num() == 0 {
|
let r = match lvl {
|
||||||
let r = match lvl {
|
Level::Shallow => {
|
||||||
Level::Shallow => {
|
let k = self.arg_c;
|
||||||
let k = self.arg_c;
|
|
||||||
|
|
||||||
if let GenContext::Last(chunk_num) = term_loc {
|
if let GenContext::Last(chunk_num) = term_loc {
|
||||||
self.evacuate_arg(chunk_num, target);
|
self.evacuate_arg(chunk_num, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.arg_c += 1;
|
self.arg_c += 1;
|
||||||
RegType::Temp(k)
|
RegType::Temp(k)
|
||||||
},
|
},
|
||||||
_ => RegType::Temp(self.alloc_reg_to_non_var())
|
_ if r.reg_num() == 0 => RegType::Temp(self.alloc_reg_to_non_var()),
|
||||||
};
|
_ => r
|
||||||
|
};
|
||||||
|
|
||||||
cell.set(r);
|
cell.set(r);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mark_var<Target>(&mut self, var: Rc<Var>, lvl: Level, cell: &'a Cell<VarReg>,
|
fn mark_var<Target>(&mut self, var: Rc<Var>, lvl: Level, cell: &'a Cell<VarReg>,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ term_expansion(Term0, (ModHead :- ModBody)) :-
|
|||||||
!,
|
!,
|
||||||
nonvar(Head),
|
nonvar(Head),
|
||||||
Head =.. [RuleName | Args],
|
Head =.. [RuleName | Args],
|
||||||
append(Args, ['$VAR'(0), '$VAR'(N)], ModArgs),
|
append(Args, ['$VAR'(0), '$VAR'(N)], ModArgs), %% problematic line.
|
||||||
ModHead =.. [RuleName | ModArgs],
|
ModHead =.. [RuleName | ModArgs],
|
||||||
nonvar(Body),
|
nonvar(Body),
|
||||||
expand_body(Body, ModBody1, 0, N1),
|
expand_body(Body, ModBody1, 0, N1),
|
||||||
|
|||||||
@@ -347,9 +347,9 @@ impl Machine {
|
|||||||
self.machine_st.copy_and_align_ball_to_heap();
|
self.machine_st.copy_and_align_ball_to_heap();
|
||||||
|
|
||||||
let error_str = self.machine_st.print_exception(Addr::HeapCell(h),
|
let error_str = self.machine_st.print_exception(Addr::HeapCell(h),
|
||||||
&heap_locs,
|
&heap_locs,
|
||||||
TermFormatter {},
|
TermFormatter {},
|
||||||
PrinterOutputter::new())
|
PrinterOutputter::new())
|
||||||
.result();
|
.result();
|
||||||
|
|
||||||
EvalSession::from(SessionError::QueryFailureWithException(error_str))
|
EvalSession::from(SessionError::QueryFailureWithException(error_str))
|
||||||
|
|||||||
Reference in New Issue
Block a user