mark is/2 allocated permanent variables as safe, add CompareNumber terms to ClauseType::is_inlined

This commit is contained in:
Mark
2023-06-23 11:13:51 -06:00
parent 89ed1aa8de
commit 4ad113a6f8
3 changed files with 18 additions and 20 deletions

View File

@@ -2311,6 +2311,12 @@ pub fn generate_instructions_rs() -> TokenStream {
(atom!(#name), #arity) => true (atom!(#name), #arity) => true
} }
); );
is_inlined_arms.push(
quote! {
(atom!(#name), #arity) => true
}
);
} }
for (name, arity, variant) in instr_data.compare_term_variants { for (name, arity, variant) in instr_data.compare_term_variants {

View File

@@ -803,7 +803,6 @@ impl<'b> CodeGenerator<'b> {
let at = match &terms[0] { let at = match &terms[0] {
&Term::Var(ref vr, ref name) => { &Term::Var(ref vr, ref name) => {
let var_num = name.to_var_num().unwrap(); let var_num = name.to_var_num().unwrap();
self.marker.mark_temp_to_safe_perm(var_num);
self.marker.mark_var::<QueryInstruction>( self.marker.mark_var::<QueryInstruction>(
var_num, var_num,
@@ -813,6 +812,8 @@ impl<'b> CodeGenerator<'b> {
code, code,
); );
self.marker.mark_safe_var_unconditionally(var_num);
compile_expr!(self, &terms[1], term_loc, code) compile_expr!(self, &terms[1], term_loc, code)
} }
&Term::Literal(_, c @ Literal::Integer(_) | &Term::Literal(_, c @ Literal::Integer(_) |

View File

@@ -414,8 +414,7 @@ impl DebrayAllocator {
self.perm_free_list.pop_front(); self.perm_free_list.pop_front();
match &mut self.var_data.records[var_num].allocation { match &mut self.var_data.records[var_num].allocation {
&mut VarAlloc::Perm(p, ref mut allocation) => { &mut VarAlloc::Perm(p, _) => {
*allocation = PermVarAllocation::Pending;
Some(p) Some(p)
} }
_ => unreachable!() _ => unreachable!()
@@ -426,21 +425,18 @@ impl DebrayAllocator {
} }
} }
pub(crate) fn mark_temp_to_safe_perm(&mut self, var_num: usize) { pub(crate) fn mark_safe_var_unconditionally(&mut self, var_num: usize) {
match &self.var_data.records[var_num].allocation { let branch_designator = self.current_branch_designator();
&VarAlloc::Temp { to_perm_var_num: Some(perm_var_num), .. } => {
let branch_designator = self.current_branch_designator();
match &mut self.var_data.records[perm_var_num].allocation { match &mut self.var_data.records[var_num].allocation {
VarAlloc::Perm(_, PermVarAllocation::Done { deep_safety, shallow_safety, .. }) => { VarAlloc::Perm(_, PermVarAllocation::Done { deep_safety, shallow_safety, .. }) => {
*deep_safety = VarSafetyStatus::unneeded(branch_designator); *deep_safety = VarSafetyStatus::unneeded(branch_designator);
*shallow_safety = VarSafetyStatus::unneeded(branch_designator); *shallow_safety = VarSafetyStatus::unneeded(branch_designator);
}
_ => unreachable!()
}
} }
_ => { VarAlloc::Temp { safety, .. } => {
*safety = VarSafetyStatus::unneeded(branch_designator);
} }
_ => unreachable!(),
} }
} }
@@ -708,11 +704,6 @@ impl Allocator for DebrayAllocator {
if record.running_count < record.num_occurrences { if record.running_count < record.num_occurrences {
record.running_count += 1; record.running_count += 1;
} else if r.is_perm() { } else if r.is_perm() {
match &mut self.var_data.records[var_num].allocation {
VarAlloc::Perm(_, allocation) => *allocation = PermVarAllocation::Pending,
_ => unreachable!(),
}
self.perm_free_list.push_back((term_loc.chunk_num(), var_num)); self.perm_free_list.push_back((term_loc.chunk_num(), var_num));
} }