From: Mark Thom Date: Wed, 20 Jul 2022 19:31:44 +0000 (-0600) Subject: inference count call_inline, fail on undefined index X-Git-Tag: v0.9.1^2~55 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=0aec980aa8c12f0afed414e495f88fad413f48c3;p=scryer-prolog.git inference count call_inline, fail on undefined index --- diff --git a/src/machine/dispatch.rs b/src/machine/dispatch.rs index 3793ac0b..8101cfea 100644 --- a/src/machine/dispatch.rs +++ b/src/machine/dispatch.rs @@ -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) + ); } } } diff --git a/src/machine/machine_indices.rs b/src/machine/machine_indices.rs index 601e912f..26776d6f 100644 --- a/src/machine/machine_indices.rs +++ b/src/machine/machine_indices.rs @@ -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 { match self.0.tag() { IndexPtrTag::Index => Some(self.0.p() as usize), diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index 3eca612d..dfc1800b 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -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(()); }