From: Mark Thom Date: Sun, 21 Mar 2021 17:58:37 +0000 (-0600) Subject: remove vestigial attribute goals struct field and related predicates X-Git-Tag: v0.9.0~114 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=111de1462c7cead26331f7a9e4f4b48ac7ec4bc8;p=scryer-prolog.git remove vestigial attribute goals struct field and related predicates --- diff --git a/src/clause_types.rs b/src/clause_types.rs index 657945d6..51894bed 100644 --- a/src/clause_types.rs +++ b/src/clause_types.rs @@ -159,8 +159,6 @@ pub(crate) enum SystemClauseType { CharCode, CharType, CharsToNumber, - ClearAttributeGoals, - CloneAttributeGoals, CodesToNumber, CopyTermWithoutAttrVars, CheckCutPoint, @@ -183,7 +181,6 @@ pub(crate) enum SystemClauseType { DeleteAttribute, DeleteHeadAttribute, DynamicModuleResolution(usize), - EnqueueAttributeGoal, EnqueueAttributedVar, FetchGlobalVar, FirstStream, @@ -323,8 +320,6 @@ impl SystemClauseType { &SystemClauseType::CharType => clause_name!("$char_type"), &SystemClauseType::CharsToNumber => clause_name!("$chars_to_number"), &SystemClauseType::CheckCutPoint => clause_name!("$check_cp"), - &SystemClauseType::ClearAttributeGoals => clause_name!("$clear_attribute_goals"), - &SystemClauseType::CloneAttributeGoals => clause_name!("$clone_attribute_goals"), &SystemClauseType::CodesToNumber => clause_name!("$codes_to_number"), &SystemClauseType::CopyTermWithoutAttrVars => { clause_name!("$copy_term_without_attr_vars") @@ -436,7 +431,6 @@ impl SystemClauseType { &SystemClauseType::DeleteAttribute => clause_name!("$del_attr_non_head"), &SystemClauseType::DeleteHeadAttribute => clause_name!("$del_attr_head"), &SystemClauseType::DynamicModuleResolution(_) => clause_name!("$module_call"), - &SystemClauseType::EnqueueAttributeGoal => clause_name!("$enqueue_attribute_goal"), &SystemClauseType::EnqueueAttributedVar => clause_name!("$enqueue_attr_var"), &SystemClauseType::FetchGlobalVar => clause_name!("$fetch_global_var"), &SystemClauseType::FirstStream => clause_name!("$first_stream"), @@ -627,8 +621,6 @@ impl SystemClauseType { ("$char_code", 2) => Some(SystemClauseType::CharCode), ("$char_type", 2) => Some(SystemClauseType::CharType), ("$chars_to_number", 2) => Some(SystemClauseType::CharsToNumber), - ("$clear_attribute_goals", 0) => Some(SystemClauseType::ClearAttributeGoals), - ("$clone_attribute_goals", 1) => Some(SystemClauseType::CloneAttributeGoals), ("$codes_to_number", 2) => Some(SystemClauseType::CodesToNumber), ("$copy_term_without_attr_vars", 2) => Some(SystemClauseType::CopyTermWithoutAttrVars), ("$create_partial_string", 3) => Some(SystemClauseType::CreatePartialString), @@ -648,7 +640,6 @@ impl SystemClauseType { ("$lookup_db_ref", 3) => Some(SystemClauseType::LookupDBRef), ("$lookup_op_db_ref", 4) => Some(SystemClauseType::LookupOpDBRef), ("$module_call", _) => Some(SystemClauseType::DynamicModuleResolution(arity - 2)), - ("$enqueue_attribute_goal", 1) => Some(SystemClauseType::EnqueueAttributeGoal), ("$enqueue_attr_var", 1) => Some(SystemClauseType::EnqueueAttributedVar), ("$partial_string_tail", 2) => Some(SystemClauseType::PartialStringTail), ("$peek_byte", 2) => Some(SystemClauseType::PeekByte), diff --git a/src/machine/attributed_variables.rs b/src/machine/attributed_variables.rs index cbb7f8ce..394cba71 100644 --- a/src/machine/attributed_variables.rs +++ b/src/machine/attributed_variables.rs @@ -11,7 +11,6 @@ pub(super) type Bindings = Vec<(usize, Addr)>; #[derive(Debug)] pub(super) struct AttrVarInitializer { - pub(super) attribute_goals: Vec, pub(super) attr_var_queue: Vec, pub(super) bindings: Bindings, pub(super) cp: LocalCodePtr, @@ -22,7 +21,6 @@ pub(super) struct AttrVarInitializer { impl AttrVarInitializer { pub(super) fn new(verify_attrs_loc: usize) -> Self { AttrVarInitializer { - attribute_goals: vec![], attr_var_queue: vec![], bindings: vec![], instigating_p: LocalCodePtr::default(), @@ -33,7 +31,6 @@ impl AttrVarInitializer { #[inline] pub(super) fn reset(&mut self) { - self.attribute_goals.clear(); self.attr_var_queue.clear(); self.bindings.clear(); } diff --git a/src/machine/project_attributes.pl b/src/machine/project_attributes.pl index 26632ea6..e62b2278 100644 --- a/src/machine/project_attributes.pl +++ b/src/machine/project_attributes.pl @@ -5,15 +5,6 @@ project_attributes(QueryVars, AttrVars) :- sort(Modules0, Modules), call_project_attributes(Modules, QueryVars, AttrVars). -enqueue_goals(Goals0) :- - nonvar(Goals0), - Goals0 = [Goal | Goals], - nonvar(Goal), - !, - '$enqueue_attribute_goal'(Goal), - enqueue_goals(Goals). -enqueue_goals(_). - '$print_project_attributes_exception'(Module, E) :- ( ( E = error(existence_error(procedure, project_attributes/2), _) ; E = error(evaluation_error((Module:project_attributes)/2), _) @@ -38,7 +29,6 @@ call_project_attributes([Module|Modules], QueryVars, AttrVars) :- call_attribute_goals([], _, _). call_attribute_goals([Module|Modules], GoalCaller, AttrVars) :- call(GoalCaller, AttrVars, Module, Goals), - enqueue_goals(Goals), call_attribute_goals(Modules, GoalCaller, AttrVars). '$print_attribute_goals_exception'(Module, E) :- @@ -85,7 +75,6 @@ module_prefixed_goals([G|Gs], Module, [MG|MGs], TailGs) :- call_attribute_goals_with_module_prefix([], _, _, []). call_attribute_goals_with_module_prefix([Module | Modules], GoalCaller, AttrVars, Goals) :- call(GoalCaller, AttrVars, Module, Goals0), - enqueue_goals(Goals0), module_prefixed_goals(Goals0, Module, Goals, Gs), call_attribute_goals_with_module_prefix(Modules, GoalCaller, AttrVars, Gs). diff --git a/src/machine/system_calls.rs b/src/machine/system_calls.rs index ee462ae3..a956577e 100644 --- a/src/machine/system_calls.rs +++ b/src/machine/system_calls.rs @@ -31,7 +31,6 @@ use indexmap::IndexSet; use ref_thread_local::RefThreadLocal; -use std::cmp; use std::collections::BTreeSet; use std::convert::TryFrom; use std::env; @@ -657,20 +656,6 @@ impl MachineState { Ok(()) } - fn fetch_attribute_goals(&mut self, mut attr_goals: Vec) { - attr_goals.sort_unstable_by(|a1, a2| { - self.compare_term_test(a1, a2) - .unwrap_or(cmp::Ordering::Less) - }); - - self.term_dedup(&mut attr_goals); - - let attr_goals = Addr::HeapCell(self.heap.to_list(attr_goals.into_iter())); - let target = self[temp_v!(1)]; - - (self.unify_fn)(self, attr_goals, target); - } - fn call_continuation_chunk(&mut self, chunk: Addr, return_p: LocalCodePtr) -> LocalCodePtr { let chunk = self.store(self.deref(chunk)); @@ -2797,10 +2782,6 @@ impl MachineState { } } } - &SystemClauseType::EnqueueAttributeGoal => { - let addr = self[temp_v!(1)]; - self.attr_var_init.attribute_goals.push(addr); - } &SystemClauseType::EnqueueAttributedVar => { let addr = self[temp_v!(1)]; @@ -2811,16 +2792,6 @@ impl MachineState { _ => {} } } - /* - &SystemClauseType::ExpandGoal => { - self.p = CodePtr::Local(LocalCodePtr::UserGoalExpansion(0)); - return Ok(()); - } - &SystemClauseType::ExpandTerm => { - self.p = CodePtr::Local(LocalCodePtr::UserTermExpansion(0)); - return Ok(()); - } - */ &SystemClauseType::GetNextDBRef => { let a1 = self[temp_v!(1)]; @@ -3153,13 +3124,6 @@ impl MachineState { &SystemClauseType::TruncateIfNoLiftedHeapGrowth => { self.truncate_if_no_lifted_heap_diff(|_| Addr::EmptyList) } - &SystemClauseType::ClearAttributeGoals => { - self.attr_var_init.attribute_goals.clear(); - } - &SystemClauseType::CloneAttributeGoals => { - let attr_goals = self.attr_var_init.attribute_goals.clone(); - self.fetch_attribute_goals(attr_goals); - } &SystemClauseType::GetAttributedVariableList => { let attr_var = self.store(self.deref(self[temp_v!(1)])); let attr_var_list = match attr_var { diff --git a/src/toplevel.pl b/src/toplevel.pl index c3fe190d..27c76d20 100644 --- a/src/toplevel.pl +++ b/src/toplevel.pl @@ -169,7 +169,6 @@ submit_query_and_print_results_(Term, VarList) :- submit_query_and_print_results_(_, _) :- % clear attribute goal lists, which may be populated by % copy_term/3 prior to failure. - '$clear_attribute_goals', write('false.'), nl.