consider an '$aux' a relation of the unexpanded goal's variables in compile_inline_or_expanded_goal (#2062)
This commit is contained in:
@@ -574,7 +574,7 @@ enum SystemClauseType {
|
|||||||
PredicateDefined,
|
PredicateDefined,
|
||||||
#[strum_discriminants(strum(props(Arity = "3", Name = "$strip_module")))]
|
#[strum_discriminants(strum(props(Arity = "3", Name = "$strip_module")))]
|
||||||
StripModule,
|
StripModule,
|
||||||
#[strum_discriminants(strum(props(Arity = "4", Name = "$compile_inline_or_expanded_goal")))]
|
#[strum_discriminants(strum(props(Arity = "5", Name = "$compile_inline_or_expanded_goal")))]
|
||||||
CompileInlineOrExpandedGoal,
|
CompileInlineOrExpandedGoal,
|
||||||
#[strum_discriminants(strum(props(Arity = "arity", Name = "$fast_call")))]
|
#[strum_discriminants(strum(props(Arity = "arity", Name = "$fast_call")))]
|
||||||
FastCallN(usize),
|
FastCallN(usize),
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ expand_subgoal(UnexpandedGoals, MS, M, ExpandedGoals, HeadVars) :-
|
|||||||
expand_module_names(UnexpandedGoals4, MetaSpecs, Module1, ExpandedGoals0, HeadVars)
|
expand_module_names(UnexpandedGoals4, MetaSpecs, Module1, ExpandedGoals0, HeadVars)
|
||||||
; ExpandedGoals0 = UnexpandedGoals4
|
; ExpandedGoals0 = UnexpandedGoals4
|
||||||
),
|
),
|
||||||
'$compile_inline_or_expanded_goal'(ExpandedGoals0, SuppArgs, ExpandedGoals1, Module1),
|
'$compile_inline_or_expanded_goal'(ExpandedGoals0, SuppArgs, ExpandedGoals1, Module1, UnexpandedGoals0),
|
||||||
expand_module_name(ExpandedGoals1, MS, Module1, ExpandedGoals).
|
expand_module_name(ExpandedGoals1, MS, Module1, ExpandedGoals).
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1411,7 +1411,6 @@ impl Machine {
|
|||||||
is_simple_goal: bool,
|
is_simple_goal: bool,
|
||||||
goal: HeapCellValue,
|
goal: HeapCellValue,
|
||||||
key: PredicateKey,
|
key: PredicateKey,
|
||||||
expanded_vars: IndexSet<HeapCellValue, BuildHasherDefault<FxHasher>>,
|
|
||||||
supp_vars: IndexSet<HeapCellValue, BuildHasherDefault<FxHasher>>,
|
supp_vars: IndexSet<HeapCellValue, BuildHasherDefault<FxHasher>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1436,7 +1435,7 @@ impl Machine {
|
|||||||
// insertion as well as the previous
|
// insertion as well as the previous
|
||||||
// supp_vars.len() argument's variables being
|
// supp_vars.len() argument's variables being
|
||||||
// disjoint from them. if they are not, the
|
// disjoint from them. if they are not, the
|
||||||
// expanded goal are not simple.
|
// expanded goal is not simple.
|
||||||
|
|
||||||
let post_supp_args = self.machine_st.heap[s+arity-supp_vars.len()+1 .. s+arity+1]
|
let post_supp_args = self.machine_st.heap[s+arity-supp_vars.len()+1 .. s+arity+1]
|
||||||
.iter()
|
.iter()
|
||||||
@@ -1482,7 +1481,6 @@ impl Machine {
|
|||||||
is_simple_goal,
|
is_simple_goal,
|
||||||
goal,
|
goal,
|
||||||
key: (name, arity),
|
key: (name, arity),
|
||||||
expanded_vars,
|
|
||||||
supp_vars
|
supp_vars
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1496,7 +1494,6 @@ impl Machine {
|
|||||||
is_simple_goal: true,
|
is_simple_goal: true,
|
||||||
goal: str_loc_as_cell!(h),
|
goal: str_loc_as_cell!(h),
|
||||||
key: (name, 0),
|
key: (name, 0),
|
||||||
expanded_vars: IndexSet::with_hasher(FxBuildHasher::default()),
|
|
||||||
supp_vars,
|
supp_vars,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1510,7 +1507,6 @@ impl Machine {
|
|||||||
is_simple_goal: true,
|
is_simple_goal: true,
|
||||||
goal: str_loc_as_cell!(h),
|
goal: str_loc_as_cell!(h),
|
||||||
key: (name, 0),
|
key: (name, 0),
|
||||||
expanded_vars: IndexSet::with_hasher(FxBuildHasher::default()),
|
|
||||||
supp_vars,
|
supp_vars,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1532,9 +1528,12 @@ impl Machine {
|
|||||||
.push(untyped_arena_ptr_as_cell!(UntypedArenaPtr::from(idx)));
|
.push(untyped_arena_ptr_as_cell!(UntypedArenaPtr::from(idx)));
|
||||||
result.goal
|
result.goal
|
||||||
} else {
|
} else {
|
||||||
|
let mut unexpanded_vars = IndexSet::with_hasher(FxBuildHasher::default());
|
||||||
|
self.machine_st.variable_set(&mut unexpanded_vars, self.machine_st.registers[5]);
|
||||||
|
|
||||||
// all supp_vars must appear later!
|
// all supp_vars must appear later!
|
||||||
let vars = IndexSet::<HeapCellValue, BuildHasherDefault<FxHasher>>::from_iter(
|
let vars = IndexSet::<HeapCellValue, BuildHasherDefault<FxHasher>>::from_iter(
|
||||||
result.expanded_vars.difference(&result.supp_vars).cloned(),
|
unexpanded_vars.difference(&result.supp_vars).cloned(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let vars: Vec<_> = vars
|
let vars: Vec<_> = vars
|
||||||
@@ -1556,7 +1555,7 @@ impl Machine {
|
|||||||
|
|
||||||
self.machine_st.heap.push(atom_as_cell!(atom!("$aux"), 0));
|
self.machine_st.heap.push(atom_as_cell!(atom!("$aux"), 0));
|
||||||
|
|
||||||
for value in result.expanded_vars.difference(&result.supp_vars).cloned() {
|
for value in unexpanded_vars.difference(&result.supp_vars).cloned() {
|
||||||
self.machine_st.heap.push(value);
|
self.machine_st.heap.push(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user