add global_count inference counter that is always incremented (#2009)

This commit is contained in:
Mark
2023-11-20 16:24:31 -07:00
parent 1e5bb2d3da
commit 54166b91eb
6 changed files with 47 additions and 34 deletions

View File

@@ -36,7 +36,7 @@ macro_rules! try_or_throw {
macro_rules! increment_call_count {
($s:expr) => {{
if !($s.increment_call_count_fn)(&mut $s) {
if !$s.increment_call_count() {
$s.backtrack();
continue;
}
@@ -3675,6 +3675,16 @@ impl Machine {
try_or_throw!(self.machine_st, self.install_inference_counter());
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
}
&Instruction::CallInferenceCount => {
let global_count = self.machine_st.cwil.global_count.clone();
self.inference_count(self.machine_st.registers[1], global_count);
step_or_fail!(self, self.machine_st.p += 1);
}
&Instruction::ExecuteInferenceCount => {
let global_count = self.machine_st.cwil.global_count.clone();
self.inference_count(self.machine_st.registers[1], global_count);
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
}
&Instruction::CallLiftedHeapLength => {
self.lifted_heap_length();
step_or_fail!(self, self.machine_st.p += 1);