]> Repositorios git - scryer-prolog.git/commitdiff
remove vestigial attribute goals struct field and related predicates
authorMark Thom <[email protected]>
Sun, 21 Mar 2021 17:58:37 +0000 (11:58 -0600)
committerMark Thom <[email protected]>
Sun, 21 Mar 2021 18:06:53 +0000 (12:06 -0600)
src/clause_types.rs
src/machine/attributed_variables.rs
src/machine/project_attributes.pl
src/machine/system_calls.rs
src/toplevel.pl

index 657945d6307737f08364e28d1b2ce4c8f3e6fd82..51894bed506cd23d5d73fb03a2b17092be218ea6 100644 (file)
@@ -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),
index cbb7f8cefe3a5cbb4de2780232ee1d3bf1a362eb..394cba714472519f6ffea4e4a83c545ca71113d7 100644 (file)
@@ -11,7 +11,6 @@ pub(super) type Bindings = Vec<(usize, Addr)>;
 
 #[derive(Debug)]
 pub(super) struct AttrVarInitializer {
-    pub(super) attribute_goals: Vec<Addr>,
     pub(super) attr_var_queue: Vec<usize>,
     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();
     }
index 26632ea607c76183f8739720e4f541dd0bc3f1ec..e62b22787cd934601597251c14bc0a33d15550da 100644 (file)
@@ -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).
 
index ee462ae36ba6c09741eec43cfdfe27bf0b06ee48..a956577eabf4d406954a44f0d5de48c16a322927 100644 (file)
@@ -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<Addr>) {
-        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 {
index c3fe190dab77a158d88d014585c98489624c1d9e..27c76d208830d8693e0f4f2d5e2c536184dacd08 100644 (file)
@@ -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.