detect attributed variables by properly detecting them in copy_term/2
This commit is contained in:
@@ -143,6 +143,8 @@ impl MachineState {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let value = unmark_cell_bits!(value);
|
||||||
|
|
||||||
seen_vars.push(value);
|
seen_vars.push(value);
|
||||||
seen_set.insert(h);
|
seen_set.insert(h);
|
||||||
|
|
||||||
|
|||||||
@@ -166,8 +166,7 @@ impl<T: CopierTarget> CopyTermState<T> {
|
|||||||
self.trail.push((Ref::attr_var(h), attr_var_as_cell!(h)));
|
self.trail.push((Ref::attr_var(h), attr_var_as_cell!(h)));
|
||||||
|
|
||||||
if let AttrVarPolicy::DeepCopy = self.attr_var_policy {
|
if let AttrVarPolicy::DeepCopy = self.attr_var_policy {
|
||||||
self.target
|
self.target.push(attr_var_as_cell!(threshold));
|
||||||
.push(attr_var_as_cell!(threshold));
|
|
||||||
|
|
||||||
let list_val = self.target[h + 1];
|
let list_val = self.target[h + 1];
|
||||||
self.target.push(list_val);
|
self.target.push(list_val);
|
||||||
@@ -195,58 +194,14 @@ impl<T: CopierTarget> CopyTermState<T> {
|
|||||||
_ => {}
|
_ => {}
|
||||||
);
|
);
|
||||||
|
|
||||||
if addr == ra {
|
if rd == ra {
|
||||||
self.reinstantiate_var(addr, self.scan);
|
self.reinstantiate_var(ra, self.scan);
|
||||||
self.scan += 1;
|
self.scan += 1;
|
||||||
} else {
|
} else {
|
||||||
*self.value_at_scan() = ra;
|
*self.value_at_scan() = ra;
|
||||||
// self.copy_compound(rd, ra);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
fn copy_compound(&mut self, rd: HeapCellValue, ra: HeapCellValue) {
|
|
||||||
let h = rd.get_value();
|
|
||||||
let trail_item = self.target[h];
|
|
||||||
let threshold = self.target.threshold();
|
|
||||||
|
|
||||||
self.trail.push((Ref::heap_cell(h), trail_item));
|
|
||||||
self.target[self.scan].set_value(threshold);
|
|
||||||
|
|
||||||
read_heap_cell!(ra,
|
|
||||||
(HeapCellValueTag::Atom, (_name, arity)) => {
|
|
||||||
self.target.push(ra);
|
|
||||||
|
|
||||||
for i in 0..arity {
|
|
||||||
self.target.push(self.target[h + 1 + i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
self.target[h] = str_loc_as_cell!(self.scan + 1);
|
|
||||||
}
|
|
||||||
(HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => {
|
|
||||||
self.target.push(ra);
|
|
||||||
self.target.push(self.target[h + 1]);
|
|
||||||
|
|
||||||
self.target[h] = pstr_loc_as_cell!(self.scan + 1);
|
|
||||||
}
|
|
||||||
(HeapCellValueTag::CStr, cstr_atom) => {
|
|
||||||
self.target[h] = atom_as_cstr_cell!(cstr_atom);
|
|
||||||
}
|
|
||||||
(HeapCellValueTag::Str, s) => {
|
|
||||||
self.copy_structure(s);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
*self.value_at_scan() = rd;
|
|
||||||
self.trail.pop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
self.scan += 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
fn copy_structure(&mut self, addr: usize) {
|
fn copy_structure(&mut self, addr: usize) {
|
||||||
read_heap_cell!(self.target[addr],
|
read_heap_cell!(self.target[addr],
|
||||||
(HeapCellValueTag::Atom, (name, arity)) => {
|
(HeapCellValueTag::Atom, (name, arity)) => {
|
||||||
|
|||||||
@@ -221,9 +221,9 @@ impl TrailEntry {
|
|||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(crate) fn get_tag(self) -> TrailEntryTag {
|
pub(crate) fn get_tag(self) -> TrailEntryTag {
|
||||||
match self.tag_or_err() {
|
match self.tag_or_err() {
|
||||||
Ok(tag) => tag,
|
Ok(tag) => tag,
|
||||||
Err(_) => TrailEntryTag::TrailedAttachedValue,
|
Err(_) => TrailEntryTag::TrailedAttachedValue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|||||||
Reference in New Issue
Block a user