fix permanent variable handling over branches and cells (#2154)
This commit is contained in:
@@ -10,6 +10,7 @@ use crate::parser::ast::*;
|
|||||||
use crate::targets::*;
|
use crate::targets::*;
|
||||||
use crate::temp_v;
|
use crate::temp_v;
|
||||||
use crate::types::*;
|
use crate::types::*;
|
||||||
|
use crate::variable_records::*;
|
||||||
|
|
||||||
use crate::instr;
|
use crate::instr;
|
||||||
use crate::machine::disjuncts::*;
|
use crate::machine::disjuncts::*;
|
||||||
@@ -277,7 +278,6 @@ impl DebrayAllocator {
|
|||||||
code: &mut CodeDeque,
|
code: &mut CodeDeque,
|
||||||
) -> RegType {
|
) -> RegType {
|
||||||
self.mark_var::<QueryInstruction>(var_num, Level::Shallow, vr, term_loc, code);
|
self.mark_var::<QueryInstruction>(var_num, Level::Shallow, vr, term_loc, code);
|
||||||
|
|
||||||
vr.get().norm()
|
vr.get().norm()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,6 +296,13 @@ impl DebrayAllocator {
|
|||||||
self.mark_var_in_non_callable(var_num, term_loc, vr, code);
|
self.mark_var_in_non_callable(var_num, term_loc, vr, code);
|
||||||
temp_v!(arg)
|
temp_v!(arg)
|
||||||
} else {
|
} else {
|
||||||
|
match &self.var_data.records[var_num].allocation {
|
||||||
|
VarAlloc::Perm(_, PermVarAllocation::Pending) => {
|
||||||
|
self.mark_var_in_non_callable(var_num, term_loc, vr, code);
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
self.increment_running_count(var_num);
|
self.increment_running_count(var_num);
|
||||||
RegType::Perm(p)
|
RegType::Perm(p)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,7 +189,6 @@ impl DebrayAllocator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
unreachable!();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,7 +473,7 @@ impl DebrayAllocator {
|
|||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn get_binding(&self, var_num: usize) -> RegType {
|
pub fn get_binding(&self, var_num: usize) -> RegType {
|
||||||
self.var_data.records[var_num].allocation.as_reg_type()
|
self.var_data.records[var_num].allocation.as_reg_type()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn num_perm_vars(&self) -> usize {
|
pub fn num_perm_vars(&self) -> usize {
|
||||||
@@ -748,11 +747,11 @@ impl Allocator for DebrayAllocator {
|
|||||||
RegType::Temp(0) => {
|
RegType::Temp(0) => {
|
||||||
let o = self.alloc_reg_to_var::<Target>(var_num, lvl, term_loc, code);
|
let o = self.alloc_reg_to_var::<Target>(var_num, lvl, term_loc, code);
|
||||||
cell.set(VarReg::Norm(RegType::Temp(o)));
|
cell.set(VarReg::Norm(RegType::Temp(o)));
|
||||||
|
|
||||||
(RegType::Temp(o), true)
|
(RegType::Temp(o), true)
|
||||||
}
|
}
|
||||||
RegType::Perm(0) => {
|
RegType::Perm(0) => {
|
||||||
let p = self.alloc_perm_var(var_num, term_loc.chunk_num());
|
let p = self.alloc_perm_var(var_num, term_loc.chunk_num());
|
||||||
|
cell.set(VarReg::Norm(RegType::Perm(p)));
|
||||||
(RegType::Perm(p), true)
|
(RegType::Perm(p), true)
|
||||||
}
|
}
|
||||||
r @ RegType::Perm(_) => {
|
r @ RegType::Perm(_) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user