]> Repositorios git - scryer-prolog.git/commitdiff
inference count call_inline, fail on undefined index
authorMark Thom <[email protected]>
Wed, 20 Jul 2022 19:31:44 +0000 (13:31 -0600)
committerMark Thom <[email protected]>
Thu, 27 Oct 2022 05:36:07 +0000 (23:36 -0600)
src/machine/dispatch.rs
src/machine/machine_indices.rs
src/machine/system_calls.rs

index 3793ac0b4df632f8675ce5c4b49cf686195f430a..8101cfea23313fdc07ba8bb4a0d8869700ea6796 100644 (file)
@@ -5014,6 +5014,11 @@ impl Machine {
 
                     if self.machine_st.fail {
                         self.machine_st.backtrack();
+                    } else {
+                        try_or_throw!(
+                            self.machine_st,
+                            (self.machine_st.increment_call_count_fn)(&mut self.machine_st)
+                        );
                     }
                 }
                 &Instruction::ExecuteInlineCallN(arity, _) => {
@@ -5025,6 +5030,11 @@ impl Machine {
 
                     if self.machine_st.fail {
                         self.machine_st.backtrack();
+                    } else {
+                        try_or_throw!(
+                            self.machine_st,
+                            (self.machine_st.increment_call_count_fn)(&mut self.machine_st)
+                        );
                     }
                 }
             }
index 601e912f2d80e4eb79ff19449bd1509d258528c7..26776d6f6e58b03a0038c1197487150f29531e16 100644 (file)
@@ -166,15 +166,6 @@ impl CodeIndex {
         }
     }
 
-
-    #[inline(always)]
-    pub(crate) fn is_dynamic_undefined(&self) -> bool {
-        match self.0.tag() {
-            IndexPtrTag::DynamicUndefined => true,
-            _ => false,
-        }
-    }
-
     pub(crate) fn local(&self) -> Option<usize> {
         match self.0.tag() {
             IndexPtrTag::Index => Some(self.0.p() as usize),
index 3eca612d0a121daff0c77a6fcb8cc54c22144422..dfc1800badcd7775f16f08b6afc9d26cb872322f 100644 (file)
@@ -1018,7 +1018,7 @@ impl Machine {
                     let index_cell = self.machine_st.heap[s+goal_arity+1];
 
                     if let Some(code_index) = get_structure_index(index_cell) {
-                        if code_index.is_undefined() || code_index.is_dynamic_undefined() {
+                        if code_index.is_undefined() {
                             self.machine_st.fail = true;
                             return Ok(());
                         }