remove interms field from MachineState

This commit is contained in:
Mark Thom
2025-11-24 22:19:09 -08:00
parent e4d9692535
commit f2e044e5b8
8 changed files with 258 additions and 212 deletions

View File

@@ -560,20 +560,17 @@ impl CodeGenerator {
&InlinedClauseType::CompareNumber(mut cmp) => {
self.marker.reset_arg(2);
let (mut lcode, at_1) = self.compile_arith_expr(&terms[0], 1, term_loc, 1)?;
let (mut lcode, at_1) = self.compile_arith_expr(&terms[0], term_loc, 1)?;
if !matches!(terms[0], Term::Var(..)) {
self.marker.advance_arg();
}
let (mut rcode, at_2) = self.compile_arith_expr(&terms[1], 2, term_loc, 2)?;
let (mut rcode, at_2) = self.compile_arith_expr(&terms[1], term_loc, 2)?;
code.append(&mut lcode);
code.append(&mut rcode);
let at_1 = at_1.unwrap_or(interm!(1));
let at_2 = at_2.unwrap_or(interm!(2));
compare_number_instr!(cmp, at_1, at_2)
}
InlinedClauseType::IsAtom(..) => match &terms[0] {
@@ -787,11 +784,10 @@ impl CodeGenerator {
fn compile_arith_expr(
&mut self,
term: &Term,
target_int: usize,
term_loc: GenContext,
arg: usize,
) -> Result<ArithCont, ArithmeticError> {
let mut evaluator = ArithmeticEvaluator::new(&mut self.marker, target_int);
let mut evaluator = ArithmeticEvaluator::new(&mut self.marker);
evaluator.compile_is(term, term_loc, arg)
}
@@ -804,7 +800,7 @@ impl CodeGenerator {
) -> Result<(), CompilationError> {
macro_rules! compile_expr {
($self:expr, $terms:expr, $term_loc:expr, $code:expr) => {{
let (acode, at) = $self.compile_arith_expr($terms, 1, $term_loc, 2)?;
let (acode, at) = $self.compile_arith_expr($terms, $term_loc, 2)?;
$code.extend(acode.into_iter());
at
}};
@@ -877,7 +873,6 @@ impl CodeGenerator {
}
};
let at = at.unwrap_or(interm!(1));
self.add_call(code, instr!("is", temp_v!(1), at), call_policy);
Ok(())
}