[m-dev.] for review: clipping instmap deltas to the plain nonlocals
Zoltan Somogyi
zs at cs.mu.OZ.AU
Fri Aug 25 16:46:23 AEST 2000
For review by Fergus, since he suggested the approach.
The motivation for this diff was to allow me to locate the bug responsible
for Tom's bug report about the compiler abort when compiling his XML parser,
which looked to be caused by my changes to instmap deltas. However, that bug
is still there after I undid those changes. It consists of deforestation
replacing an assignment to a variable with "true" with the goal_info of the
"true" saying it binds the variable bound by the assignment, later optimizing
away this "true" with another "true" with an empty instmap delta, and then
finding that the arm of the if-then-else in which this happens does not define
that variable even though the other arm does. This happens in a procedure body
altered several times by deforestation, so my guess is that deforestation
generates HLDS that is good enough for the code generator, but some of whose
goal_infos have subtle bugs that mislead further invocations of deforestation
itself, perhaps because recursive invocations of deforestation look at the
goal_infos before the rest of the compiler does, and maybe before they have
been set properly. In any case, it looks like that is a bug for Simon.
Zoltan.
----------------------------------------
Restore the clipping of instmap deltas to the nonlocals set, undoing most of
a recent change of mine. (The general cleanup parts of that change, e.g.
added field names, stay.) The reason is that the previous diff changed the
clipping algorithm only where the instmap deltas were being originally
computed, whereas for completeness you also need to do this in places where
they are recomputed after optimizations such as deforestation, and doing so
would have required changes in several more parts of the compiler, which
would have been tedious to maintain.
Instead, I now use a different technique to solve the original problem.
This technique is to consider that the first occurrence of any type(class)info
variable to be a value giving occurrence even if the variable is not
referred to by the instmap delta of the goal. This assumption is true
in the current polymorphism design and in any extension of it that
I can foresee. Type(class)info variables will therefore be born in the first
goal that refers to them, even if they are not in the nonlocal set of that
goal. If there are any later references to variables whose type is described
in whole or in part by that typeinfo, the typeinfo will die at the last such
reference, otherwise it will die in the goal in which it is born.
compiler/quantification.m:
compiler/mode_info.m:
compiler/mode_util.m:
Reset the interfaces of quantification and mode checking to the old
ones, which do not require knowing typeinfo_liveness and typeinfo
varmaps.
compiler/modes.m:
compiler/unique_modes.m:
Clip instmap deltas to the nonlocals, not the completed nonlocals.
compiler/hlds_goal.m:
Add a utility pred which gets the nonlocals from a goal, not a
goal_info.
compiler/liveness.m:
Add special handling for type(class)info vars as described above.
compiler/accumulator.m:
compiler/cse_detection.m:
compiler/deforest.m:
compiler/follow_code.m:
compiler/higher_order.m:
compiler/lambda.m:
compiler/magic.m:
compiler/make_hlds.m:
compiler/pd_util.m:
compiler/polymorphism.m:
compiler/saved_vars.m:
compiler/simplify.m:
compiler/unify_proc.m:
compiler/unify_proc.m:
compiler/unneeded_code.m:
compiler/unused_args.m:
Use the reset interfaces of quantification and mode checking,
and eliminate redundant local copies of goal_get_nonlocals.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/accumulator.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/accumulator.m,v
retrieving revision 1.16
diff -u -r1.16 accumulator.m
--- compiler/accumulator.m 2000/08/08 04:44:32 1.16
+++ compiler/accumulator.m 2000/08/15 15:08:27
@@ -1554,10 +1554,7 @@
proc_info_set_varset(OrigProcInfo1, VarSet, OrigProcInfo2),
proc_info_set_vartypes(OrigProcInfo2, VarTypes, OrigProcInfo3),
- module_info_globals(ModuleInfo1, Globals),
- body_should_use_typeinfo_liveness(OrigPredInfo, Globals,
- TypeInfoLiveness),
- OrigProcInfo = requantify_procedure(TypeInfoLiveness, OrigProcInfo3),
+ requantify_proc(OrigProcInfo3, OrigProcInfo),
update_accumulator_pred(AccPredId, AccProcId, AccGoal,
ModuleInfo1, ModuleInfo).
@@ -1962,21 +1959,11 @@
module_info_pred_proc_info(ModuleInfo0, NewPredId, NewProcId,
PredInfo, ProcInfo0),
- proc_info_set_goal(ProcInfo0, AccGoal, ProcInfo),
+ proc_info_set_goal(ProcInfo0, AccGoal, ProcInfo1),
- module_info_globals(ModuleInfo0, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals, TypeInfoLiveness),
+ requantify_proc(ProcInfo1, ProcInfo),
module_info_set_pred_proc_info(ModuleInfo0, NewPredId, NewProcId,
- PredInfo, requantify_procedure(TypeInfoLiveness, ProcInfo),
- ModuleInfo).
-
- %
- % Recalculate the non-locals of a procedure.
- %
-:- func requantify_procedure(bool, proc_info) = proc_info.
-
-requantify_procedure(TypeInfoLiveness, ProcInfo0) = ProcInfo :-
- requantify_proc(TypeInfoLiveness, ProcInfo0, ProcInfo).
+ PredInfo, ProcInfo, ModuleInfo).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.62
diff -u -r1.62 cse_detection.m
--- compiler/cse_detection.m 2000/08/09 07:46:21 1.62
+++ compiler/cse_detection.m 2000/08/15 15:08:27
@@ -152,14 +152,9 @@
% ModuleInfo should not be changed by detect_cse_in_goal
CseInfo = cse_info(Varset1, VarTypes1, _),
proc_info_headvars(ProcInfo0, HeadVars),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
- module_info_globals(ModuleInfo0, Globals),
- body_should_use_typeinfo_liveness(PredInfo0, Globals,
- TypeInfoLiveness),
implicitly_quantify_clause_body(HeadVars, Goal1, Varset1,
- VarTypes1, TVarMap, TypeInfoLiveness,
- Goal, Varset, VarTypes, _Warnings),
+ VarTypes1, Goal, Varset, VarTypes, _Warnings),
proc_info_set_goal(ProcInfo0, Goal, ProcInfo1),
proc_info_set_varset(ProcInfo1, Varset, ProcInfo2),
Index: compiler/deforest.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/deforest.m,v
retrieving revision 1.15
diff -u -r1.15 deforest.m
--- compiler/deforest.m 2000/08/09 07:46:23 1.15
+++ compiler/deforest.m 2000/08/15 15:08:27
@@ -117,18 +117,13 @@
( { Changed = yes } ->
pd_info_get_module_info(ModuleInfo2),
- { module_info_globals(ModuleInfo2, Globals0) },
- { body_should_use_typeinfo_liveness(PredInfo0, Globals0,
- TypeInfoLiveness) },
- { requantify_proc(TypeInfoLiveness, ProcInfo2, ProcInfo3) },
+ { requantify_proc(ProcInfo2, ProcInfo3) },
{ proc_info_goal(ProcInfo3, Goal3) },
{ proc_info_get_initial_instmap(ProcInfo3,
ModuleInfo2, InstMap0) },
{ proc_info_vartypes(ProcInfo3, VarTypes) },
- { proc_info_typeinfo_varmap(ProcInfo3, TVarMap) },
- { recompute_instmap_delta(yes, PredInfo0, Goal3, Goal,
- VarTypes, TVarMap, InstMap0,
- ModuleInfo2, ModuleInfo3) },
+ { recompute_instmap_delta(yes, Goal3, Goal,
+ VarTypes, InstMap0, ModuleInfo2, ModuleInfo3) },
pd_info_set_module_info(ModuleInfo3),
pd_info_get_pred_info(PredInfo),
Index: compiler/follow_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/follow_code.m,v
retrieving revision 1.57
diff -u -r1.57 follow_code.m
--- compiler/follow_code.m 2000/08/09 07:46:30 1.57
+++ compiler/follow_code.m 2000/08/15 15:08:27
@@ -34,7 +34,7 @@
%-----------------------------------------------------------------------------%
-move_follow_code_in_proc(PredInfo, ProcInfo0, ProcInfo,
+move_follow_code_in_proc(_PredInfo, ProcInfo0, ProcInfo,
ModuleInfo0, ModuleInfo) :-
module_info_globals(ModuleInfo0, Globals),
globals__lookup_bool_option(Globals, follow_code, FollowCode),
@@ -51,16 +51,13 @@
% we need to fix up the goal_info by recalculating
% the nonlocal vars and the non-atomic instmap deltas.
proc_info_headvars(ProcInfo0, HeadVars),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
- body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness),
- implicitly_quantify_clause_body(HeadVars, Goal1,
- Varset0, VarTypes0, TVarMap, TypeInfoLiveness,
+ implicitly_quantify_clause_body(HeadVars,
+ Goal1, Varset0, VarTypes0,
Goal2, Varset, VarTypes, _Warnings),
proc_info_get_initial_instmap(ProcInfo0,
ModuleInfo0, InstMap0),
- recompute_instmap_delta(no, PredInfo, Goal2, Goal,
- VarTypes, TVarMap, InstMap0, ModuleInfo0, ModuleInfo)
+ recompute_instmap_delta(no, Goal2, Goal, VarTypes, InstMap0,
+ ModuleInfo0, ModuleInfo)
;
Goal = Goal0,
Varset = Varset0,
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.68
diff -u -r1.68 higher_order.m
--- compiler/higher_order.m 2000/08/10 05:10:54 1.68
+++ compiler/higher_order.m 2000/08/15 15:08:27
@@ -384,23 +384,19 @@
higher_order_info::in, higher_order_info::out) is det.
fixup_proc_info(MustRecompute, Goal0, Info0, Info) :-
- Info0 = info(A, B, C, D, PredInfo, ProcInfo0, ModuleInfo0, H, Changed),
+ Info0 = info(A, B, C, D, E, ProcInfo0, ModuleInfo0, H, Changed),
( (Changed = changed ; MustRecompute = yes) ->
proc_info_set_goal(ProcInfo0, Goal0, ProcInfo1),
- module_info_globals(ModuleInfo0, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness),
- requantify_proc(TypeInfoLiveness, ProcInfo1, ProcInfo2),
+ requantify_proc(ProcInfo1, ProcInfo2),
proc_info_goal(ProcInfo2, Goal2),
RecomputeAtomic = no,
proc_info_get_initial_instmap(ProcInfo2, ModuleInfo0, InstMap),
proc_info_vartypes(ProcInfo2, VarTypes),
- proc_info_typeinfo_varmap(ProcInfo2, TVarMap),
- recompute_instmap_delta(RecomputeAtomic, PredInfo,
- Goal2, Goal3, VarTypes, TVarMap, InstMap,
+ recompute_instmap_delta(RecomputeAtomic,
+ Goal2, Goal3, VarTypes, InstMap,
ModuleInfo0, ModuleInfo),
proc_info_set_goal(ProcInfo2, Goal3, ProcInfo),
- Info = info(A, B, C, D, PredInfo, ProcInfo, ModuleInfo,
+ Info = info(A, B, C, D, E, ProcInfo, ModuleInfo,
H, Changed)
;
Info = Info0
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.74
diff -u -r1.74 hlds_goal.m
--- compiler/hlds_goal.m 2000/08/09 07:46:35 1.74
+++ compiler/hlds_goal.m 2000/08/15 15:08:27
@@ -725,11 +725,7 @@
% says a goal is unreachable then it is.
%
% Normally the instmap_delta will list only
- % the nonlocal variables of the goal. However,
- % with typeinfo liveness, it may also list
- % typeinfo or typeclass info variables that
- % describe (part of) the type of a nonlocal
- % variable.
+ % the nonlocal variables of the goal.
context :: prog_context,
@@ -946,6 +942,9 @@
:- pred goal_info_set_goal_path(hlds_goal_info, goal_path, hlds_goal_info).
:- mode goal_info_set_goal_path(in, in, out) is det.
+:- pred goal_get_nonlocals(hlds_goal, set(prog_var)).
+:- mode goal_get_nonlocals(in, out) is det.
+
:- pred goal_set_follow_vars(hlds_goal, maybe(follow_vars), hlds_goal).
:- mode goal_set_follow_vars(in, in, out) is det.
@@ -1249,6 +1248,9 @@
goal_info_has_feature(GoalInfo, Feature) :-
goal_info_get_features(GoalInfo, Features),
set__member(Feature, Features).
+
+goal_get_nonlocals(_Goal - GoalInfo, NonLocals) :-
+ goal_info_get_nonlocals(GoalInfo, NonLocals).
goal_set_follow_vars(Goal - GoalInfo0, FollowVars, Goal - GoalInfo) :-
goal_info_set_follow_vars(GoalInfo0, FollowVars, GoalInfo).
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.65
diff -u -r1.65 lambda.m
--- compiler/lambda.m 2000/08/09 07:46:48 1.65
+++ compiler/lambda.m 2000/08/15 15:08:27
@@ -191,11 +191,8 @@
% check if we need to requantify
( MustRecomputeNonLocals = yes ->
- module_info_globals(ModuleInfo, Globals),
- body_should_use_typeinfo_liveness(PredInfo0, Globals,
- TypeInfoLiveness),
implicitly_quantify_clause_body(HeadVars,
- Goal1, VarSet1, VarTypes1, TVarMap, TypeInfoLiveness,
+ Goal1, VarSet1, VarTypes1,
Goal, VarSet, VarTypes, _Warnings)
;
Goal = Goal1,
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.108
diff -u -r1.108 liveness.m
--- compiler/liveness.m 2000/08/09 07:46:51 1.108
+++ compiler/liveness.m 2000/08/15 15:08:27
@@ -56,7 +56,10 @@
%
% When using accurate gc or execution tracing, liveness is computed
% slightly differently. The runtime system needs access to the
-% typeinfo variables of any variable that is live at a continuation.
+% typeinfo variables of any variable that is live at a continuation or event.
+% (This includes typeclass info variables that hold typeinfos;
+% in the following "typeinfo variables" also includes typeclass info
+% variables.)
%
% Hence, the invariant needed for alternate liveness calculation:
% a variable holding a typeinfo must be live at any continuation
@@ -82,12 +85,26 @@
% variable.
%
% (1) happens without any changes to the liveness computation (it is
-% the normal condition for variables becoming dead). This more
+% the normal condition for variables becoming dead). This is more
% conservative than what is required for the invariant, but is
% required for code generation, so we should keep it ;-)
% (2) is implemented by adding the typeinfo variables for the types of the
% nonlocals to the nonlocals for the purposes of computing liveness.
%
+% In some circumstances, one of which is tests/debugger/resume_typeinfos.m,
+% it is possible for a typeinfo variable to be born in a goal without that
+% typeinfo variable appearing anywhere else in the procedure body.
+% Nevertheless, with typeinfo liveness, we must consider such variables
+% to be born in such goals even though they do not appear in the nonlocals set
+% or in the instmap delta. (If they were not born, it would be an error for
+% them to die, and die they will, at the last occurrence of a variable whose
+% type they (partially) describe.) The special case solution we adopt for
+% such situations is that we consider the first appearance of a typeinfo
+% variable in the typeinfo-completed nonlocals set of a goal to be a value
+% giving occurrence, even if the typeinfo does not appear in the instmap delta.
+% This is safe, since with our current scheme for handling polymorphism,
+% the first appearance will in fact always ground the typeinfo.
+%
% So typeinfo variables will always be born before they are needed, and
% die only when no other variable needing them will be live, so the
% invariant holds.
@@ -152,15 +169,15 @@
:- import_module string.
detect_liveness_proc(ProcInfo0, PredId, ModuleInfo, ProcInfo) :-
- module_info_globals(ModuleInfo, Globals),
- module_info_pred_info(ModuleInfo, PredId, PredInfo),
- body_should_use_typeinfo_liveness(PredInfo, Globals, TypeInfoLiveness),
- requantify_proc(TypeInfoLiveness, ProcInfo0, ProcInfo1),
+ requantify_proc(ProcInfo0, ProcInfo1),
proc_info_goal(ProcInfo1, Goal0),
proc_info_varset(ProcInfo1, Varset),
proc_info_vartypes(ProcInfo1, VarTypes),
proc_info_typeinfo_varmap(ProcInfo1, TVarMap),
+ module_info_globals(ModuleInfo, Globals),
+ module_info_pred_info(ModuleInfo, PredId, PredInfo),
+ body_should_use_typeinfo_liveness(PredInfo, Globals, TypeInfoLiveness),
live_info_init(ModuleInfo, TypeInfoLiveness, VarTypes, TVarMap, Varset,
LiveInfo),
@@ -194,8 +211,9 @@
Liveness, Goal - GoalInfo) :-
% work out which variables get born in this goal
- liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo0, NonLocals),
- set__difference(NonLocals, Liveness0, NewVarsSet),
+ liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo0,
+ BaseNonLocals, CompletedNonLocals),
+ set__difference(CompletedNonLocals, Liveness0, NewVarsSet),
set__to_sorted_list(NewVarsSet, NewVarsList),
goal_info_get_instmap_delta(GoalInfo0, InstMapDelta),
set__init(Empty),
@@ -204,12 +222,14 @@
;
set__init(Births0),
find_value_giving_occurrences(NewVarsList, LiveInfo,
- InstMapDelta, Births0, Births)
+ InstMapDelta, Births0, Births1),
+ set__difference(CompletedNonLocals, BaseNonLocals,
+ TypeInfos),
+ set__difference(TypeInfos, Liveness0, NewTypeInfos),
+ set__union(Births1, NewTypeInfos, Births)
),
set__union(Liveness0, Births, Liveness),
- (
- goal_is_atomic(Goal0)
- ->
+ ( goal_is_atomic(Goal0) ->
PreDeaths = Empty,
PreBirths = Births,
PostDeaths = Empty,
@@ -218,9 +238,10 @@
;
PreDeaths = Empty,
PreBirths = Empty,
- detect_liveness_in_goal_2(Goal0, Liveness0, NonLocals,
+ detect_liveness_in_goal_2(Goal0, Liveness0, CompletedNonLocals,
LiveInfo, ActualLiveness, Goal),
- set__intersect(NonLocals, ActualLiveness, NonLocalLiveness),
+ set__intersect(CompletedNonLocals, ActualLiveness,
+ NonLocalLiveness),
set__union(NonLocalLiveness, Liveness0, FinalLiveness),
set__difference(FinalLiveness, Liveness, PostDeaths),
set__difference(Liveness, FinalLiveness, PostBirths)
@@ -414,11 +435,10 @@
set__difference(Deadness0, PostBirths0, Deadness1),
set__union(Deadness1, PostDeaths0, Deadness2),
- liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo0, NonLocals),
+ liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo0,
+ _BaseNonLocals, CompletedNonLocals),
set__init(Empty),
- (
- goal_is_atomic(Goal0)
- ->
+ ( goal_is_atomic(Goal0) ->
%
% The code below is slightly dodgy: the new postdeaths really
% ought to be computed as the difference between the liveness
@@ -436,7 +456,7 @@
% some extra code in the third pass (detect_resume_points)
% to delete any such untimely deaths.]
%
- set__difference(NonLocals, Deadness2, NewPostDeaths),
+ set__difference(CompletedNonLocals, Deadness2, NewPostDeaths),
set__union(Deadness2, NewPostDeaths, Deadness3),
Goal = Goal0
;
@@ -472,15 +492,17 @@
detect_deadness_in_goal_2(disj(Goals0, SM), GoalInfo, Deadness0,
LiveInfo, Deadness, disj(Goals, SM)) :-
set__init(Union0),
- liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo, NonLocals),
- detect_deadness_in_disj(Goals0, Deadness0, NonLocals,
+ liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo,
+ _, CompletedNonLocals),
+ detect_deadness_in_disj(Goals0, Deadness0, CompletedNonLocals,
LiveInfo, Union0, Deadness, Goals).
detect_deadness_in_goal_2(switch(Var, Det, Cases0, SM), GoalInfo, Deadness0,
LiveInfo, Deadness, switch(Var, Det, Cases, SM)) :-
set__init(Union0),
- liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo, NonLocals),
- detect_deadness_in_cases(Var, Cases0, Deadness0, NonLocals,
+ liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo,
+ _, CompletedNonLocals),
+ detect_deadness_in_cases(Var, Cases0, Deadness0, CompletedNonLocals,
LiveInfo, Union0, Deadness, Cases).
detect_deadness_in_goal_2(not(Goal0), _, Deadness0, LiveInfo,
@@ -497,9 +519,10 @@
detect_deadness_in_goal(Cond0, DeadnessThen, LiveInfo,
DeadnessCond, Cond1),
- liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo, NonLocals),
+ liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo,
+ _, CompletedNonLocals),
set__union(DeadnessCond, DeadnessElse, Deadness),
- set__intersect(Deadness, NonLocals, NonLocalDeadness),
+ set__intersect(Deadness, CompletedNonLocals, NonLocalDeadness),
set__difference(NonLocalDeadness, DeadnessCond, ResidueCond),
set__difference(NonLocalDeadness, DeadnessElse, ResidueElse),
@@ -1113,14 +1136,14 @@
% Get the nonlocals, and, if doing alternate liveness, add the
% typeinfo vars for the nonlocals.
-:- pred liveness__get_nonlocals_and_typeinfos(live_info::in, hlds_goal_info::in,
- set(prog_var)::out) is det.
+:- pred liveness__get_nonlocals_and_typeinfos(live_info::in,
+ hlds_goal_info::in, set(prog_var)::out, set(prog_var)::out) is det.
liveness__get_nonlocals_and_typeinfos(LiveInfo, GoalInfo,
- NonLocals) :-
- goal_info_get_code_gen_nonlocals(GoalInfo, NonLocals0),
+ NonLocals, CompletedNonLocals) :-
+ goal_info_get_code_gen_nonlocals(GoalInfo, NonLocals),
liveness__maybe_complete_with_typeinfos(LiveInfo,
- NonLocals0, NonLocals).
+ NonLocals, CompletedNonLocals).
:- pred liveness__maybe_complete_with_typeinfos(live_info::in,
set(prog_var)::in, set(prog_var)::out) is det.
Index: compiler/magic.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic.m,v
retrieving revision 1.22
diff -u -r1.22 magic.m
--- compiler/magic.m 2000/08/09 07:46:59 1.22
+++ compiler/magic.m 2000/08/15 15:08:27
@@ -276,11 +276,7 @@
% Requantify the goal to rename apart the variables
% in the copies of the condition.
- module_info_pred_info(ModuleInfo0, PredId, PredInfo),
- module_info_globals(ModuleInfo0, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness),
- requantify_proc(TypeInfoLiveness, ProcInfo1, ProcInfo3),
+ requantify_proc(ProcInfo1, ProcInfo3),
ModuleInfo1 = ModuleInfo0
; Goal0 = switch(Var, _Canfail, Cases, _SM) - GoalInfo ->
proc_info_varset(ProcInfo0, VarSet0),
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.343
diff -u -r1.343 make_hlds.m
--- compiler/make_hlds.m 2000/08/19 12:31:47 1.343
+++ compiler/make_hlds.m 2000/08/21 00:52:27
@@ -5104,15 +5104,8 @@
transform_info(ModuleInfo, Info)),
{
map__init(EmptyVarTypes),
- % Since the we haven't done mode analysis yet, the
- % instmap_delta fields in goal_infos are not yet
- % meaningful. Therefore there no point in clipping
- % them to the set of typeinfo-liveness-completed
- % nonlocals.
- map__init(EmptyTVarMap),
- TypeInfoLiveness = no,
- implicitly_quantify_clause_body(HeadVars, HldsGoal1,
- VarSet2, EmptyVarTypes, EmptyTVarMap, TypeInfoLiveness,
+ implicitly_quantify_clause_body(HeadVars,
+ HldsGoal1, VarSet2, EmptyVarTypes,
HldsGoal, VarSet, _, _Warnings),
NewClause = clause([ModeId], HldsGoal, Context),
ClausesInfo = clauses_info(VarSet, VarTypes, VarTypes1,
@@ -5166,16 +5159,8 @@
no, Goal1, VarSet1, Goal2, VarSet2, Info1, Info)
),
{ map__init(EmptyVarTypes) },
- % Since the we haven't done mode analysis yet, the
- % instmap_delta fields in goal_infos are not yet
- % meaningful. Therefore there no point in clipping
- % them to the set of typeinfo-liveness-completed
- % nonlocals.
- { map__init(EmptyTVarMap) },
- { TypeInfoLiveness = no },
- { implicitly_quantify_clause_body(HeadVars, Goal2, VarSet2,
- EmptyVarTypes, EmptyTVarMap, TypeInfoLiveness,
- Goal, VarSet, _, Warnings) }.
+ { implicitly_quantify_clause_body(HeadVars,
+ Goal2, VarSet2, EmptyVarTypes, Goal, VarSet, _, Warnings) }.
%-----------------------------------------------------------------------------%
Index: compiler/mode_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_info.m,v
retrieving revision 1.55
diff -u -r1.55 mode_info.m
--- compiler/mode_info.m 2000/08/08 04:44:44 1.55
+++ compiler/mode_info.m 2000/08/15 15:08:27
@@ -275,23 +275,6 @@
:- mode mode_info_set_checking_extra_goals(in,
mode_info_di, mode_info_uo) is det.
-:- pred mode_info_get_typeinfo_liveness(mode_info, bool).
-:- mode mode_info_get_typeinfo_liveness(mode_info_no_io, out) is det.
-
-:- pred mode_info_get_completed_nonlocals_base(hlds_goal_info,
- vartypes, type_info_varmap, bool, set(prog_var)).
-:- mode mode_info_get_completed_nonlocals_base(in, in, in, in, out) is det.
-
-:- pred mode_info_get_completed_nonlocals(hlds_goal_info, set(prog_var),
- mode_info, mode_info).
-:- mode mode_info_get_completed_nonlocals(in, out,
- mode_info_di, mode_info_uo) is det.
-
-:- pred mode_info_get_goal_completed_nonlocals(hlds_goal, set(prog_var),
- mode_info, mode_info).
-:- mode mode_info_get_goal_completed_nonlocals(in, out,
- mode_info_di, mode_info_uo) is det.
-
% Find the simple_call_id to use in error messages
% for the given pred_id.
:- pred mode_info_get_call_id(mode_info, pred_id, simple_call_id).
@@ -350,7 +333,7 @@
:- implementation.
-:- import_module delay_info, mode_errors, mode_util, globals, prog_util.
+:- import_module delay_info, mode_errors, mode_util.
:- import_module term, varset.
:- import_module require, std_util, queue.
@@ -431,7 +414,7 @@
% to change which procedure
% is called?
- checking_extra_goals :: bool,
+ checking_extra_goals :: bool
% Are we rechecking a goal after
% introducing unifications for
% complicated sub-unifications
@@ -439,9 +422,6 @@
% If so, redoing the mode check
% should not introduce more
% extra unifications.
-
- typeinfo_liveness :: bool,
- type_info_varmap :: type_info_varmap
).
% The normal inst of a mode_info struct: ground, with
@@ -465,7 +445,6 @@
map__lookup(Procs, ProcId, ProcInfo),
proc_info_varset(ProcInfo, VarSet),
proc_info_vartypes(ProcInfo, VarTypes),
- proc_info_typeinfo_varmap(ProcInfo, TVarMap),
LiveVarsList = [LiveVars],
NondetLiveVarsList = [LiveVars],
@@ -473,14 +452,11 @@
Changed = no,
CheckingExtraGoals = no,
- module_info_globals(ModuleInfo, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals, TypeInfoLiveness),
ModeInfo = mode_info(
IOState, ModuleInfo, PredId, ProcId, VarSet, VarTypes,
Context, ModeContext, InstMapping0, LockedVars, DelayInfo,
ErrorList, LiveVarsList, NondetLiveVarsList, [], [],
- Changed, HowToCheck, MayChangeProc, CheckingExtraGoals,
- TypeInfoLiveness, TVarMap
+ Changed, HowToCheck, MayChangeProc, CheckingExtraGoals
).
%-----------------------------------------------------------------------------%
@@ -522,7 +498,6 @@
mode_info_get_changed_flag(MI, MI^changed_flag).
mode_info_get_how_to_check(MI, MI^how_to_check).
mode_info_get_may_change_called_proc(MI, MI^may_change_called_proc).
-mode_info_get_typeinfo_liveness(MI, MI^typeinfo_liveness).
mode_info_set_module_info(MI, ModuleInfo, MI^module_info := ModuleInfo).
mode_info_set_varset(VarSet) --> ^varset := VarSet.
@@ -760,29 +735,5 @@
mode_info_get_errors(ModeInfo0, Errors0),
list__append(Errors0, [ModeErrorInfo], Errors),
mode_info_set_errors(Errors, ModeInfo0, ModeInfo).
-
-%-----------------------------------------------------------------------------%
-
-mode_info_get_completed_nonlocals_base(GoalInfo, VarTypes, TVarMap,
- TypeinfoLiveness, CompletedNonlocals) :-
- goal_info_get_nonlocals(GoalInfo, NonLocals),
- (
- TypeinfoLiveness = yes,
- proc_info_get_typeinfo_vars(NonLocals, VarTypes, TVarMap,
- TypeInfoVars),
- set__union(NonLocals, TypeInfoVars, CompletedNonlocals)
- ;
- TypeinfoLiveness = no,
- CompletedNonlocals = NonLocals
- ).
-
-mode_info_get_completed_nonlocals(GoalInfo, CompletedNonlocals,
- ModeInfo, ModeInfo) :-
- mode_info_get_completed_nonlocals_base(GoalInfo,
- ModeInfo^var_types, ModeInfo^type_info_varmap,
- ModeInfo^typeinfo_liveness, CompletedNonlocals).
-
-mode_info_get_goal_completed_nonlocals(_ - GoalInfo, CompletedNonlocals) -->
- mode_info_get_completed_nonlocals(GoalInfo, CompletedNonlocals).
%-----------------------------------------------------------------------------%
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.127
diff -u -r1.127 mode_util.m
--- compiler/mode_util.m 2000/08/10 05:10:58 1.127
+++ compiler/mode_util.m 2000/08/15 15:08:27
@@ -112,13 +112,11 @@
% may need to insert new merge_insts into the merge_inst table.
% If the first argument is yes, the instmap_deltas for calls
% and deconstruction unifications are also recomputed.
-:- pred recompute_instmap_delta_proc(bool::in, pred_info::in,
- proc_info::in, proc_info::out, module_info::in, module_info::out)
- is det.
+:- pred recompute_instmap_delta_proc(bool::in, proc_info::in, proc_info::out,
+ module_info::in, module_info::out) is det.
-:- pred recompute_instmap_delta(bool::in, pred_info::in,
- hlds_goal::in, hlds_goal::out, vartypes::in, type_info_varmap::in,
- instmap::in, module_info::in, module_info::out) is det.
+:- pred recompute_instmap_delta(bool::in, hlds_goal::in, hlds_goal::out,
+ vartypes::in, instmap::in, module_info::in, module_info::out) is det.
% Given corresponding lists of types and modes, produce a new
% list of modes which includes the information provided by the
@@ -197,7 +195,7 @@
%-----------------------------------------------------------------------------%
:- implementation.
-:- import_module prog_util, prog_io, type_util, globals.
+:- import_module prog_util, prog_io, type_util.
:- import_module inst_match, inst_util, mode_info.
:- import_module require, int, map, set, term, std_util, assoc_list.
@@ -1103,38 +1101,25 @@
% and deconstructions may become non-local (XXX does this require
% rerunning mode analysis rather than just recompute_instmap_delta?).
-recompute_instmap_delta_proc(RecomputeAtomic, PredInfo, ProcInfo0, ProcInfo)
- -->
+recompute_instmap_delta_proc(RecomputeAtomic, ProcInfo0, ProcInfo) -->
=(ModuleInfo0),
{ proc_info_get_initial_instmap(ProcInfo0, ModuleInfo0, InstMap0) },
{ proc_info_vartypes(ProcInfo0, VarTypes) },
- { proc_info_typeinfo_varmap(ProcInfo0, TVarMap) },
{ proc_info_goal(ProcInfo0, Goal0) },
- { module_info_globals(ModuleInfo0, Globals) },
- { body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness) },
recompute_instmap_delta(RecomputeAtomic, Goal0, Goal,
- VarTypes, TVarMap, InstMap0, TypeInfoLiveness, _),
+ VarTypes, InstMap0, _),
{ proc_info_set_goal(ProcInfo0, Goal, ProcInfo) }.
-recompute_instmap_delta(RecomputeAtomic, PredInfo, Goal0, Goal,
- VarTypes, TVarMap, InstMap0) -->
- =(ModuleInfo0),
- { module_info_globals(ModuleInfo0, Globals) },
- { body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness) },
+recompute_instmap_delta(RecomputeAtomic, Goal0, Goal, VarTypes, InstMap0) -->
recompute_instmap_delta(RecomputeAtomic, Goal0, Goal, VarTypes,
- TVarMap, InstMap0, TypeInfoLiveness, _).
+ InstMap0, _).
-:- pred recompute_instmap_delta(bool, hlds_goal, hlds_goal, vartypes,
- type_info_varmap, instmap, bool, instmap_delta,
- module_info, module_info).
-:- mode recompute_instmap_delta(in, in, out, in, in, in, in, out, in, out)
- is det.
+:- pred recompute_instmap_delta(bool::in, hlds_goal::in, hlds_goal::out,
+ vartypes::in, instmap::in, instmap_delta::out,
+ module_info::in, module_info::out) is det.
recompute_instmap_delta(RecomputeAtomic, Goal0 - GoalInfo0, Goal - GoalInfo,
- VarTypes, TVarMap, InstMap0, TypeInfoLiveness, InstMapDelta)
- -->
+ VarTypes, InstMap0, InstMapDelta) -->
(
{ RecomputeAtomic = no },
(
@@ -1149,14 +1134,12 @@
{ GoalInfo1 = GoalInfo0 }
;
recompute_instmap_delta_2(RecomputeAtomic, Goal0,
- GoalInfo0, Goal, VarTypes, TVarMap, InstMap0,
- TypeInfoLiveness, InstMapDelta0),
- { mode_info_get_completed_nonlocals_base(GoalInfo0,
- VarTypes, TVarMap, TypeInfoLiveness, NonLocals) },
- { instmap_delta_restrict(InstMapDelta0,
- NonLocals, InstMapDelta1) },
- { goal_info_set_instmap_delta(GoalInfo0,
- InstMapDelta1, GoalInfo1) }
+ GoalInfo0, Goal, VarTypes, InstMap0, InstMapDelta0),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
+ { instmap_delta_restrict(InstMapDelta0, NonLocals,
+ InstMapDelta1) },
+ { goal_info_set_instmap_delta(GoalInfo0, InstMapDelta1,
+ GoalInfo1) }
),
% If the initial instmap is unreachable so is the final instmap.
@@ -1169,89 +1152,77 @@
),
{ goal_info_get_instmap_delta(GoalInfo, InstMapDelta) }.
-:- pred recompute_instmap_delta_2(bool, hlds_goal_expr, hlds_goal_info,
- hlds_goal_expr, vartypes, type_info_varmap, instmap, bool,
- instmap_delta, module_info, module_info).
-:- mode recompute_instmap_delta_2(in, in, in, out, in, in, in, in, out,
- in, out) is det.
+:- pred recompute_instmap_delta_2(bool::in, hlds_goal_expr::in,
+ hlds_goal_info::in, hlds_goal_expr::out, vartypes::in, instmap::in,
+ instmap_delta::out, module_info::in, module_info::out) is det.
recompute_instmap_delta_2(Atomic, switch(Var, Det, Cases0, SM), GoalInfo,
- switch(Var, Det, Cases, SM), VarTypes, TVarMap, InstMap,
- TypeInfoLiveness, InstMapDelta) -->
- { mode_info_get_completed_nonlocals_base(GoalInfo,
- VarTypes, TVarMap, TypeInfoLiveness, NonLocals) },
+ switch(Var, Det, Cases, SM), VarTypes, InstMap, InstMapDelta)
+ -->
+ { goal_info_get_nonlocals(GoalInfo, NonLocals) },
recompute_instmap_delta_cases(Atomic, Var, Cases0, Cases,
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta).
+ VarTypes, InstMap, NonLocals, InstMapDelta).
recompute_instmap_delta_2(Atomic, conj(Goals0), _, conj(Goals),
- VarTypes, TVarMap, InstMap, TypeInfoLiveness, InstMapDelta) -->
+ VarTypes, InstMap, InstMapDelta) -->
recompute_instmap_delta_conj(Atomic, Goals0, Goals,
- VarTypes, TVarMap, InstMap, TypeInfoLiveness, InstMapDelta).
+ VarTypes, InstMap, InstMapDelta).
recompute_instmap_delta_2(Atomic, par_conj(Goals0, SM), GoalInfo,
- par_conj(Goals, SM), VarTypes, TVarMap, InstMap,
- TypeInfoLiveness, InstMapDelta) -->
- { mode_info_get_completed_nonlocals_base(GoalInfo,
- VarTypes, TVarMap, TypeInfoLiveness, NonLocals) },
+ par_conj(Goals, SM), VarTypes, InstMap, InstMapDelta) -->
+ { goal_info_get_nonlocals(GoalInfo, NonLocals) },
recompute_instmap_delta_par_conj(Atomic, Goals0, Goals,
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta).
+ VarTypes, InstMap, NonLocals, InstMapDelta).
recompute_instmap_delta_2(Atomic, disj(Goals0, SM), GoalInfo, disj(Goals, SM),
- VarTypes, TVarMap, InstMap, TypeInfoLiveness, InstMapDelta)
- -->
- { mode_info_get_completed_nonlocals_base(GoalInfo,
- VarTypes, TVarMap, TypeInfoLiveness, NonLocals) },
+ VarTypes, InstMap, InstMapDelta) -->
+ { goal_info_get_nonlocals(GoalInfo, NonLocals) },
recompute_instmap_delta_disj(Atomic, Goals0, Goals,
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta).
+ VarTypes, InstMap, NonLocals, InstMapDelta).
recompute_instmap_delta_2(Atomic, not(Goal0), _, not(Goal),
- VarTypes, TVarMap, InstMap, TypeInfoLiveness, InstMapDelta) -->
+ VarTypes, InstMap, InstMapDelta) -->
{ instmap_delta_init_reachable(InstMapDelta) },
- recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, TVarMap,
- InstMap, TypeInfoLiveness, _).
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, InstMap, _).
recompute_instmap_delta_2(Atomic, if_then_else(Vars, A0, B0, C0, SM), GoalInfo,
- if_then_else(Vars, A, B, C, SM), VarTypes, TVarMap, InstMap0,
- TypeInfoLiveness, InstMapDelta) -->
- recompute_instmap_delta(Atomic, A0, A, VarTypes, TVarMap, InstMap0,
- TypeInfoLiveness, InstMapDelta1),
+ if_then_else(Vars, A, B, C, SM), VarTypes, InstMap0,
+ InstMapDelta) -->
+ recompute_instmap_delta(Atomic, A0, A, VarTypes, InstMap0,
+ InstMapDelta1),
{ instmap__apply_instmap_delta(InstMap0, InstMapDelta1, InstMap1) },
- recompute_instmap_delta(Atomic, B0, B, VarTypes, TVarMap, InstMap1,
- TypeInfoLiveness, InstMapDelta2),
- recompute_instmap_delta(Atomic, C0, C, VarTypes, TVarMap, InstMap0,
- TypeInfoLiveness, InstMapDelta3),
+ recompute_instmap_delta(Atomic, B0, B, VarTypes, InstMap1,
+ InstMapDelta2),
+ recompute_instmap_delta(Atomic, C0, C, VarTypes, InstMap0,
+ InstMapDelta3),
{ instmap_delta_apply_instmap_delta(InstMapDelta1, InstMapDelta2,
InstMapDelta4) },
- { mode_info_get_completed_nonlocals_base(GoalInfo,
- VarTypes, TVarMap, TypeInfoLiveness, NonLocals) },
+ { goal_info_get_nonlocals(GoalInfo, NonLocals) },
merge_instmap_delta(InstMap0, NonLocals, InstMapDelta3,
InstMapDelta4, InstMapDelta).
recompute_instmap_delta_2(Atomic, some(Vars, CanRemove, Goal0), _,
- some(Vars, CanRemove, Goal), VarTypes, TVarMap, InstMap,
- TypeInfoLiveness, InstMapDelta) -->
- recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, TVarMap,
- InstMap, TypeInfoLiveness, InstMapDelta).
+ some(Vars, CanRemove, Goal), VarTypes, InstMap, InstMapDelta)
+ -->
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes,
+ InstMap, InstMapDelta).
recompute_instmap_delta_2(_, generic_call(A, Vars, Modes, D), _,
- generic_call(A, Vars, Modes, D), _VarTypes, _TVarMap, _InstMap,
- _TypeInfoLiveness, InstMapDelta) -->
+ generic_call(A, Vars, Modes, D), _VarTypes, _InstMap,
+ InstMapDelta) -->
=(ModuleInfo),
{ instmap_delta_from_mode_list(Vars, Modes,
ModuleInfo, InstMapDelta) }.
recompute_instmap_delta_2(_, call(PredId, ProcId, Args, D, E, F), _,
- call(PredId, ProcId, Args, D, E, F), _VarTypes, _TVarMap,
- InstMap, _TypeInfoLiveness, InstMapDelta) -->
+ call(PredId, ProcId, Args, D, E, F), _VarTypes,
+ InstMap, InstMapDelta) -->
recompute_instmap_delta_call(PredId, ProcId,
Args, InstMap, InstMapDelta).
recompute_instmap_delta_2(Atomic, unify(A, Rhs0, UniMode0, Uni, E), GoalInfo,
- unify(A, Rhs, UniMode, Uni, E), VarTypes, TVarMap, InstMap0,
- TypeInfoLiveness, InstMapDelta) -->
+ unify(A, Rhs, UniMode, Uni, E), VarTypes, InstMap0,
+ InstMapDelta) -->
(
{ Rhs0 = lambda_goal(PorF, EvalMethod, FixModes, NonLocals,
LambdaVars, Modes, Det, Goal0) }
@@ -1260,7 +1231,7 @@
{ instmap__pre_lambda_update(ModuleInfo0, LambdaVars, Modes,
InstMap0, InstMap) },
recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes,
- TVarMap, InstMap, TypeInfoLiveness, _),
+ InstMap, _),
{ Rhs = lambda_goal(PorF, EvalMethod, FixModes, NonLocals,
LambdaVars, Modes, Det, Goal) }
;
@@ -1277,119 +1248,102 @@
recompute_instmap_delta_2(_,
pragma_foreign_code(A, B, PredId, ProcId, Args, F, G, H), _,
pragma_foreign_code(A, B, PredId, ProcId, Args, F, G, H),
- _VarTypes, _TVarMap, InstMap, _TypeInfoLiveness, InstMapDelta)
- -->
+ _VarTypes, InstMap, InstMapDelta) -->
recompute_instmap_delta_call(PredId, ProcId,
Args, InstMap, InstMapDelta).
-recompute_instmap_delta_2(_, bi_implication(_, _), _, _, _, _, _, _, _) -->
+recompute_instmap_delta_2(_, bi_implication(_, _), _, _, _, _, _) -->
% these should have been expanded out by now
{ error("recompute_instmap_delta_2: unexpected bi_implication") }.
%-----------------------------------------------------------------------------%
-:- pred recompute_instmap_delta_conj(bool, list(hlds_goal), list(hlds_goal),
- vartypes, type_info_varmap, instmap, bool, instmap_delta,
- module_info, module_info).
-:- mode recompute_instmap_delta_conj(in, in, out, in, in, in, in, out,
- in, out) is det.
+:- pred recompute_instmap_delta_conj(bool::in, list(hlds_goal)::in,
+ list(hlds_goal)::out, vartypes::in, instmap::in, instmap_delta::out,
+ module_info::in, module_info::out) is det.
-recompute_instmap_delta_conj(_, [], [], _, _, _, _, InstMapDelta) -->
+recompute_instmap_delta_conj(_, [], [], _, _, InstMapDelta) -->
{ instmap_delta_init_reachable(InstMapDelta) }.
recompute_instmap_delta_conj(Atomic, [Goal0 | Goals0], [Goal | Goals],
- VarTypes, TVarMap, InstMap0, TypeInfoLiveness, InstMapDelta)
- -->
- recompute_instmap_delta(Atomic, Goal0, Goal,
- VarTypes, TVarMap, InstMap0, TypeInfoLiveness, InstMapDelta0),
+ VarTypes, InstMap0, InstMapDelta) -->
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, InstMap0,
+ InstMapDelta0),
{ instmap__apply_instmap_delta(InstMap0, InstMapDelta0, InstMap1) },
- recompute_instmap_delta_conj(Atomic, Goals0, Goals,
- VarTypes, TVarMap, InstMap1, TypeInfoLiveness, InstMapDelta1),
+ recompute_instmap_delta_conj(Atomic, Goals0, Goals, VarTypes, InstMap1,
+ InstMapDelta1),
{ instmap_delta_apply_instmap_delta(InstMapDelta0, InstMapDelta1,
InstMapDelta) }.
%-----------------------------------------------------------------------------%
-:- pred recompute_instmap_delta_disj(bool, list(hlds_goal), list(hlds_goal),
- vartypes, type_info_varmap, instmap, set(prog_var), bool,
- instmap_delta, module_info, module_info).
-:- mode recompute_instmap_delta_disj(in, in, out, in, in, in, in, in, out,
- in, out) is det.
+:- pred recompute_instmap_delta_disj(bool::in, list(hlds_goal)::in,
+ list(hlds_goal)::out, vartypes::in, instmap::in, set(prog_var)::in,
+ instmap_delta::out, module_info::in, module_info::out) is det.
-recompute_instmap_delta_disj(_, [], [], _, _, _, _, _, InstMapDelta) -->
+recompute_instmap_delta_disj(_, [], [], _, _, _, InstMapDelta) -->
{ instmap_delta_init_unreachable(InstMapDelta) }.
-recompute_instmap_delta_disj(Atomic, [Goal0], [Goal], VarTypes, TVarMap,
- InstMap, _, TypeInfoLiveness, InstMapDelta) -->
- recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, TVarMap,
- InstMap, TypeInfoLiveness, InstMapDelta).
+recompute_instmap_delta_disj(Atomic, [Goal0], [Goal], VarTypes, InstMap,
+ _, InstMapDelta) -->
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, InstMap,
+ InstMapDelta).
recompute_instmap_delta_disj(Atomic, [Goal0 | Goals0], [Goal | Goals],
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta) -->
+ VarTypes, InstMap, NonLocals, InstMapDelta) -->
{ Goals0 = [_|_] },
- recompute_instmap_delta(Atomic, Goal0, Goal,
- VarTypes, TVarMap, InstMap, TypeInfoLiveness, InstMapDelta0),
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, InstMap,
+ InstMapDelta0),
recompute_instmap_delta_disj(Atomic, Goals0, Goals,
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta1),
+ VarTypes, InstMap, NonLocals, InstMapDelta1),
merge_instmap_delta(InstMap, NonLocals, InstMapDelta0,
InstMapDelta1, InstMapDelta).
-:- pred recompute_instmap_delta_par_conj(bool, list(hlds_goal),
- list(hlds_goal), vartypes, type_info_varmap, instmap,
- set(prog_var), bool, instmap_delta, module_info, module_info).
-:- mode recompute_instmap_delta_par_conj(in, in, out, in, in, in, in, in, out,
- in, out) is det.
+:- pred recompute_instmap_delta_par_conj(bool::in, list(hlds_goal)::in,
+ list(hlds_goal)::out, vartypes::in, instmap::in, set(prog_var)::in,
+ instmap_delta::out, module_info::in, module_info::out) is det.
-recompute_instmap_delta_par_conj(_, [], [], _, _, _, _, _, InstMapDelta) -->
+recompute_instmap_delta_par_conj(_, [], [], _, _, _, InstMapDelta) -->
{ instmap_delta_init_unreachable(InstMapDelta) }.
-recompute_instmap_delta_par_conj(Atomic, [Goal0], [Goal], VarTypes, TVarMap,
- InstMap, _, TypeInfoLiveness, InstMapDelta) -->
- recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, TVarMap,
- InstMap, TypeInfoLiveness, InstMapDelta).
+recompute_instmap_delta_par_conj(Atomic, [Goal0], [Goal], VarTypes, InstMap,
+ _, InstMapDelta) -->
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, InstMap,
+ InstMapDelta).
recompute_instmap_delta_par_conj(Atomic, [Goal0 | Goals0], [Goal | Goals],
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta) -->
+ VarTypes, InstMap, NonLocals, InstMapDelta) -->
{ Goals0 = [_|_] },
- recompute_instmap_delta(Atomic, Goal0, Goal,
- VarTypes, TVarMap, InstMap, TypeInfoLiveness, InstMapDelta0),
- recompute_instmap_delta_par_conj(Atomic, Goals0, Goals,
- VarTypes, TVarMap, InstMap, NonLocals, TypeInfoLiveness,
- InstMapDelta1),
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, InstMap,
+ InstMapDelta0),
+ recompute_instmap_delta_par_conj(Atomic, Goals0, Goals, VarTypes,
+ InstMap, NonLocals, InstMapDelta1),
unify_instmap_delta(InstMap, NonLocals, InstMapDelta0,
InstMapDelta1, InstMapDelta).
%-----------------------------------------------------------------------------%
-:- pred recompute_instmap_delta_cases(bool, prog_var, list(case), list(case),
- vartypes, type_info_varmap, instmap, set(prog_var), bool,
- instmap_delta, module_info, module_info).
-:- mode recompute_instmap_delta_cases(in, in, in, out,
- in, in, in, in, in, out, in, out) is det.
+:- pred recompute_instmap_delta_cases(bool::in, prog_var::in, list(case)::in,
+ list(case)::out, vartypes::in, instmap::in, set(prog_var)::in,
+ instmap_delta::out, module_info::in, module_info::out) is det.
-recompute_instmap_delta_cases(_, _, [], [], _, _, _, _, _, InstMapDelta) -->
+recompute_instmap_delta_cases(_, _, [], [], _, _, _, InstMapDelta) -->
{ instmap_delta_init_unreachable(InstMapDelta) }.
recompute_instmap_delta_cases(Atomic, Var, [Case0 | Cases0], [Case | Cases],
- VarTypes, TVarMap, InstMap0, NonLocals, TypeInfoLiveness,
- InstMapDelta) -->
+ VarTypes, InstMap0, NonLocals, InstMapDelta) -->
{ Case0 = case(Functor, Goal0) },
{ map__lookup(VarTypes, Var, Type) },
instmap__bind_var_to_functor(Var, Type, Functor, InstMap0, InstMap),
- recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes, TVarMap,
- InstMap, TypeInfoLiveness, InstMapDelta0),
+ recompute_instmap_delta(Atomic, Goal0, Goal, VarTypes,
+ InstMap, InstMapDelta0),
instmap_delta_bind_var_to_functor(Var, Type, Functor,
InstMap0, InstMapDelta0, InstMapDelta1),
{ Case = case(Functor, Goal) },
recompute_instmap_delta_cases(Atomic, Var, Cases0, Cases,
- VarTypes, TVarMap, InstMap0, NonLocals, TypeInfoLiveness,
- InstMapDelta2),
+ VarTypes, InstMap0, NonLocals, InstMapDelta2),
merge_instmap_delta(InstMap0, NonLocals, InstMapDelta1,
InstMapDelta2, InstMapDelta).
%-----------------------------------------------------------------------------%
-:- pred recompute_instmap_delta_call(pred_id, proc_id,
- list(prog_var), instmap, instmap_delta,
- module_info, module_info).
-:- mode recompute_instmap_delta_call(in, in, in, in, out, in, out) is det.
+:- pred recompute_instmap_delta_call(pred_id::in, proc_id::in,
+ list(prog_var)::in, instmap::in, instmap_delta::out,
+ module_info::in, module_info::out) is det.
recompute_instmap_delta_call(PredId, ProcId, Args, InstMap,
InstMapDelta, ModuleInfo0, ModuleInfo) :-
@@ -1406,9 +1360,9 @@
ModuleInfo, InstMapDelta)
).
-:- pred recompute_instmap_delta_call_2(list(prog_var), instmap, list(mode),
- list(mode), module_info, module_info).
-:- mode recompute_instmap_delta_call_2(in, in, in, out, in, out) is det.
+:- pred recompute_instmap_delta_call_2(list(prog_var)::in, instmap::in,
+ list(mode)::in, list(mode)::out, module_info::in, module_info::out)
+ is det.
recompute_instmap_delta_call_2([], _, [], [], ModuleInfo, ModuleInfo).
recompute_instmap_delta_call_2([_|_], _, [], _, _, _) :-
@@ -1438,10 +1392,9 @@
recompute_instmap_delta_call_2(Args, InstMap,
Modes0, Modes, ModuleInfo2, ModuleInfo).
-:- pred recompute_instmap_delta_unify(unification, unify_mode, unify_mode,
- hlds_goal_info, instmap, instmap_delta, module_info, module_info).
-:- mode recompute_instmap_delta_unify(in, in, out,
- in, in, out, in, out) is det.
+:- pred recompute_instmap_delta_unify(unification::in, unify_mode::in,
+ unify_mode::out, hlds_goal_info::in, instmap::in, instmap_delta::out,
+ module_info::in, module_info::out) is det.
recompute_instmap_delta_unify(Uni, UniMode0, UniMode, GoalInfo,
InstMap, InstMapDelta, ModuleInfo, ModuleInfo) :-
@@ -1523,8 +1476,8 @@
ConsId = ConsId0
).
-:- pred strip_builtin_qualifier_from_sym_name(sym_name::in,
- sym_name::out) is det.
+:- pred strip_builtin_qualifier_from_sym_name(sym_name::in, sym_name::out)
+ is det.
strip_builtin_qualifier_from_sym_name(SymName0, SymName) :-
(
@@ -1560,7 +1513,8 @@
strip_builtin_qualifiers_from_inst_list(Args0, Args).
:- pred strip_builtin_qualifiers_from_bound_inst_list(list(bound_inst)::in,
- list(bound_inst)::out) is det.
+ list(bound_inst)::out) is det.
+
strip_builtin_qualifiers_from_bound_inst_list(Insts0, Insts) :-
list__map(strip_builtin_qualifiers_from_bound_inst, Insts0, Insts).
@@ -1592,7 +1546,7 @@
).
:- pred strip_builtin_qualifiers_from_pred_inst(maybe(pred_inst_info)::in,
- maybe(pred_inst_info)::out) is det.
+ maybe(pred_inst_info)::out) is det.
strip_builtin_qualifiers_from_pred_inst(no, no).
strip_builtin_qualifiers_from_pred_inst(yes(Pred0), yes(Pred)) :-
@@ -1684,8 +1638,7 @@
aditi_uo_mode = Mode :- out_mode(Mode).
-:- pred make_std_mode(string, list(inst), mode).
-:- mode make_std_mode(in, in, out) is det.
+:- pred make_std_mode(string::in, list(inst)::in, (mode)::out) is det.
make_std_mode(Name, Args, Mode) :-
mercury_public_builtin_module(MercuryBuiltin),
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.244
diff -u -r1.244 modes.m
--- compiler/modes.m 2000/08/09 07:47:22 1.244
+++ compiler/modes.m 2000/08/15 15:08:27
@@ -971,11 +971,10 @@
%
mode_info_get_instmap(ModeInfo1, InstMap0),
- modecheck_goal_expr(Goal0, GoalInfo0, Goal, ModeInfo1, ModeInfo2),
+ modecheck_goal_expr(Goal0, GoalInfo0, Goal, ModeInfo1, ModeInfo),
mode_info_get_instmap(ModeInfo, InstMap),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals,
- ModeInfo2, ModeInfo),
+ goal_info_get_nonlocals(GoalInfo0, NonLocals),
compute_instmap_delta(InstMap0, InstMap, NonLocals, DeltaInstMap),
goal_info_set_instmap_delta(GoalInfo0, DeltaInstMap, GoalInfo).
@@ -1011,7 +1010,7 @@
% conjunctions properly.
modecheck_goal_expr(par_conj(List0, SM), GoalInfo0, par_conj(List, SM)) -->
mode_checkpoint(enter, "par_conj"),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
modecheck_par_conj_list(List0, List, NonLocals, InstMapNonlocalList),
instmap__unify(NonLocals, InstMapNonlocalList),
mode_checkpoint(exit, "par_conj").
@@ -1023,7 +1022,7 @@
{ instmap__init_unreachable(InstMap) },
mode_info_set_instmap(InstMap)
;
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
modecheck_disj_list(List0, List, InstMapList),
instmap__merge(NonLocals, InstMapList, disj),
{ disj_list_to_goal(List, GoalInfo0, Goal - _GoalInfo) }
@@ -1032,8 +1031,8 @@
modecheck_goal_expr(if_then_else(Vs, A0, B0, C0, SM), GoalInfo0, Goal) -->
mode_checkpoint(enter, "if-then-else"),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
- mode_info_get_goal_completed_nonlocals(B0, B_Vars),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
+ { goal_get_nonlocals(B0, B_Vars) },
mode_info_dcg_get_instmap(InstMap0),
%
% We need to lock the non-local variables, to ensure
@@ -1065,7 +1064,7 @@
modecheck_goal_expr(not(A0), GoalInfo0, not(A)) -->
mode_checkpoint(enter, "not"),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
mode_info_dcg_get_instmap(InstMap0),
%
% when analyzing a negated goal, nothing is forward-live
@@ -1173,7 +1172,7 @@
{ instmap__init_unreachable(InstMap) },
mode_info_set_instmap(InstMap)
;
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
modecheck_case_list(Cases0, Var, Cases, InstMapList),
instmap__merge(NonLocals, InstMapList, disj)
),
@@ -1246,8 +1245,7 @@
%
% recompute the new set of non-local variables for the main goal
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals0,
- ModeInfo0, ModeInfo1),
+ goal_info_get_nonlocals(GoalInfo0, NonLocals0),
set__list_to_set(Args0, OldArgVars),
set__list_to_set(Args, NewArgVars),
set__difference(NewArgVars, OldArgVars, IntroducedVars),
@@ -1262,19 +1260,19 @@
handle_extra_goals_contexts(AfterGoals0, Context, AfterGoals),
list__append(BeforeGoals, [Goal0 | AfterGoals], GoalList0),
- mode_info_get_may_change_called_proc(ModeInfo1,
+ mode_info_get_may_change_called_proc(ModeInfo0,
MayChangeCalledProc0),
% Make sure we don't go into an infinite loop if
% there is a bug in the code to add extra goals.
- mode_info_set_checking_extra_goals(yes, ModeInfo1, ModeInfo2),
+ mode_info_set_checking_extra_goals(yes, ModeInfo0, ModeInfo1),
% We've already worked out which procedure should be called,
% we don't need to do it again.
mode_info_set_may_change_called_proc(
- may_not_change_called_proc, ModeInfo2, ModeInfo3),
+ may_not_change_called_proc, ModeInfo1, ModeInfo2),
- mode_info_set_instmap(InstMap0, ModeInfo3, ModeInfo4),
+ mode_info_set_instmap(InstMap0, ModeInfo2, ModeInfo3),
% Recheck the goals to compute the instmap_deltas.
%
@@ -1288,13 +1286,13 @@
% is not, the main unification will be delayed until after the
% argument unifications, which turns them into assignments,
% and we end up repeating the process forever.
- mode_info_add_goals_live_vars(GoalList0, ModeInfo4, ModeInfo5),
+ mode_info_add_goals_live_vars(GoalList0, ModeInfo3, ModeInfo4),
modecheck_conj_list_no_delay(GoalList0, GoalList,
- ModeInfo5, ModeInfo6),
+ ModeInfo4, ModeInfo5),
Goal = conj(GoalList),
- mode_info_set_checking_extra_goals(no, ModeInfo6, ModeInfo7),
+ mode_info_set_checking_extra_goals(no, ModeInfo5, ModeInfo6),
mode_info_set_may_change_called_proc(MayChangeCalledProc0,
- ModeInfo7, ModeInfo)
+ ModeInfo6, ModeInfo)
;
Goal = MainGoal,
ModeInfo = ModeInfo0
@@ -1322,7 +1320,7 @@
modecheck_conj_list_no_delay([], []) --> [].
modecheck_conj_list_no_delay([Goal0 | Goals0], [Goal | Goals]) -->
- mode_info_get_goal_completed_nonlocals(Goal0, NonLocals),
+ { goal_get_nonlocals(Goal0, NonLocals) },
mode_info_remove_live_vars(NonLocals),
modecheck_goal(Goal0, Goal),
mode_info_dcg_get_instmap(InstMap),
@@ -1404,13 +1402,13 @@
% at the start of the list of live vars sets, which
% makes them cheaper to remove.
mode_info_add_goals_live_vars(Goals),
- mode_info_get_goal_completed_nonlocals(Goal, Vars),
- mode_info_add_live_vars(Vars).
+ { goal_get_nonlocals(Goal, NonLocals) },
+ mode_info_add_live_vars(NonLocals).
mode_info_remove_goals_live_vars([]) --> [].
mode_info_remove_goals_live_vars([Goal | Goals]) -->
- mode_info_get_goal_completed_nonlocals(Goal, Vars),
- mode_info_remove_live_vars(Vars),
+ { goal_get_nonlocals(Goal, NonLocals) },
+ mode_info_remove_live_vars(NonLocals),
mode_info_remove_goals_live_vars(Goals).
:- type impurity_errors == list(mode_error_info).
@@ -1449,7 +1447,7 @@
% Modecheck the goal, noting first that the non-locals
% which occur in the goal might not be live anymore.
- mode_info_get_goal_completed_nonlocals(Goal0, NonLocalVars),
+ { goal_get_nonlocals(Goal0, NonLocalVars) },
mode_info_remove_live_vars(NonLocalVars),
modecheck_goal(Goal0, Goal),
@@ -1683,7 +1681,7 @@
[InstMap - GoalNonLocals | InstMaps]) -->
mode_info_dcg_get_instmap(InstMap0),
{ Goal0 = _ - GoalInfo },
- mode_info_get_completed_nonlocals(GoalInfo, GoalNonLocals),
+ { goal_info_get_nonlocals(GoalInfo, GoalNonLocals) },
mode_info_get_parallel_vars(PVars0),
{ set__init(Bound0) },
mode_info_set_parallel_vars([NonLocals - Bound0|PVars0]),
Index: compiler/pd_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pd_util.m,v
retrieving revision 1.10
diff -u -r1.10 pd_util.m
--- compiler/pd_util.m 2000/08/08 04:44:47 1.10
+++ compiler/pd_util.m 2000/08/15 15:08:27
@@ -664,17 +664,10 @@
%-----------------------------------------------------------------------------%
pd_util__requantify_goal(Goal0, NonLocals, Goal) -->
- pd_info_get_pred_info(PredInfo),
pd_info_get_proc_info(ProcInfo0),
{ proc_info_varset(ProcInfo0, VarSet0) },
{ proc_info_vartypes(ProcInfo0, VarTypes0) },
- { proc_info_typeinfo_varmap(ProcInfo0, TVarMap) },
- pd_info_get_module_info(ModuleInfo0),
- { module_info_globals(ModuleInfo0, Globals) },
- { body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness) },
- { implicitly_quantify_goal(Goal0, VarSet0, VarTypes0,
- TVarMap, TypeInfoLiveness, NonLocals,
+ { implicitly_quantify_goal(Goal0, VarSet0, VarTypes0, NonLocals,
Goal, VarSet, VarTypes, _) },
{ proc_info_set_varset(ProcInfo0, VarSet, ProcInfo1) },
{ proc_info_set_vartypes(ProcInfo1, VarTypes, ProcInfo) },
@@ -683,12 +676,10 @@
pd_util__recompute_instmap_delta(Goal0, Goal) -->
pd_info_get_module_info(ModuleInfo0),
pd_info_get_instmap(InstMap),
- pd_info_get_pred_info(PredInfo),
pd_info_get_proc_info(ProcInfo),
{ proc_info_vartypes(ProcInfo, VarTypes) },
- { proc_info_typeinfo_varmap(ProcInfo, TVarMap) },
- { recompute_instmap_delta(yes, PredInfo, Goal0, Goal,
- VarTypes, TVarMap, InstMap, ModuleInfo0, ModuleInfo) },
+ { recompute_instmap_delta(yes, Goal0, Goal,
+ VarTypes, InstMap, ModuleInfo0, ModuleInfo) },
pd_info_set_module_info(ModuleInfo).
%-----------------------------------------------------------------------------%
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.194
diff -u -r1.194 polymorphism.m
--- compiler/polymorphism.m 2000/08/24 05:59:28 1.194
+++ compiler/polymorphism.m 2000/08/25 01:01:06
@@ -1783,15 +1783,8 @@
poly_info_get_varset(Info0, VarSet0),
poly_info_get_var_types(Info0, VarTypes0),
set__list_to_set(HeadVars, OutsideVars),
- poly_info_get_type_info_map(Info0, TVarMap),
- poly_info_get_pred_info(Info0, PredInfo),
- poly_info_get_module_info(Info0, ModuleInfo),
- module_info_globals(ModuleInfo, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness),
implicitly_quantify_goal(Goal0, VarSet0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
- Goal, VarSet, VarTypes, _Warnings),
+ OutsideVars, Goal, VarSet, VarTypes, _Warnings),
poly_info_set_varset_and_types(VarSet, VarTypes, Info0, Info)
).
@@ -1834,15 +1827,8 @@
TypeClassVarMap, VarTypes0, ExistQVars,
NonLocalsPlusArgs, NewOutsideVars),
set__union(NonLocals, NewOutsideVars, OutsideVars),
- poly_info_get_type_info_map(Info0, TVarMap),
- poly_info_get_pred_info(Info0, PredInfo),
- poly_info_get_module_info(Info0, ModuleInfo),
- module_info_globals(ModuleInfo, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness),
implicitly_quantify_goal(Goal0, VarSet0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
- Goal, VarSet, VarTypes, _Warnings),
+ OutsideVars, Goal, VarSet, VarTypes, _Warnings),
poly_info_set_varset_and_types(VarSet, VarTypes, Info0, Info)
).
Index: compiler/quantification.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/quantification.m,v
retrieving revision 1.75
diff -u -r1.75 quantification.m
--- compiler/quantification.m 2000/08/09 07:47:45 1.75
+++ compiler/quantification.m 2000/08/15 15:08:27
@@ -39,7 +39,7 @@
:- interface.
:- import_module hlds_goal, hlds_pred, prog_data.
-:- import_module bool, list, set.
+:- import_module list, set.
%
% When the compiler performs structure reuse, using
@@ -74,35 +74,31 @@
:- pred implicitly_quantify_clause_body(
nonlocals_to_recompute::in, list(prog_var)::in,
hlds_goal::in, prog_varset::in, vartypes::in,
- type_info_varmap::in, bool::in,
hlds_goal::out, prog_varset::out, vartypes::out,
list(quant_warning)::out) is det.
% As above, with `ordinary_nonlocals' passed as the first argument.
:- pred implicitly_quantify_clause_body(list(prog_var)::in,
hlds_goal::in, prog_varset::in, vartypes::in,
- type_info_varmap::in, bool::in,
hlds_goal::out, prog_varset::out, vartypes::out,
list(quant_warning)::out) is det.
:- pred implicitly_quantify_goal(nonlocals_to_recompute::in,
- hlds_goal::in, prog_varset::in, vartypes::in,
- type_info_varmap::in, bool::in, set(prog_var)::in,
+ hlds_goal::in, prog_varset::in, vartypes::in, set(prog_var)::in,
hlds_goal::out, prog_varset::out, vartypes::out,
list(quant_warning)::out) is det.
% As above, with `ordinary_nonlocals' passed as the first argument.
:- pred implicitly_quantify_goal(
- hlds_goal::in, prog_varset::in, vartypes::in,
- type_info_varmap::in, bool::in, set(prog_var)::in,
+ hlds_goal::in, prog_varset::in, vartypes::in, set(prog_var)::in,
hlds_goal::out, prog_varset::out, vartypes::out,
list(quant_warning)::out) is det.
-:- pred requantify_proc(nonlocals_to_recompute::in, bool::in,
+:- pred requantify_proc(nonlocals_to_recompute::in,
proc_info::in, proc_info::out) is det.
% As above, with `ordinary_nonlocals' passed as the first argument.
-:- pred requantify_proc(bool::in, proc_info::in, proc_info::out) is det.
+:- pred requantify_proc(proc_info::in, proc_info::out) is det.
% We return a list of warnings back to make_hlds.m.
% Currently the only thing we warn about is variables with
@@ -146,8 +142,6 @@
seen :: set(prog_var),
varset :: prog_varset,
vartypes :: vartypes,
- type_info_varmap :: type_info_varmap,
- typeinfo_liveness :: bool,
warnings :: list(quant_warning)
).
@@ -181,48 +175,40 @@
%-----------------------------------------------------------------------------%
implicitly_quantify_clause_body(HeadVars, Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, Goal, Varset, VarTypes, Warnings) :-
+ Goal, Varset, VarTypes, Warnings) :-
implicitly_quantify_clause_body(ordinary_nonlocals,
- HeadVars, Goal0, Varset0, VarTypes0, TVarMap, TypeInfoLiveness,
+ HeadVars, Goal0, Varset0, VarTypes0,
Goal, Varset, VarTypes, Warnings).
implicitly_quantify_clause_body(RecomputeNonLocals, HeadVars, Goal0,
- Varset0, VarTypes0, TVarMap, TypeInfoLiveness,
- Goal, Varset, VarTypes, Warnings) :-
+ Varset0, VarTypes0, Goal, Varset, VarTypes, Warnings) :-
set__list_to_set(HeadVars, OutsideVars),
implicitly_quantify_goal(RecomputeNonLocals, Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
- Goal, Varset, VarTypes, Warnings).
+ OutsideVars, Goal, Varset, VarTypes, Warnings).
-requantify_proc(TypeInfoLiveness, ProcInfo0, ProcInfo) :-
- requantify_proc(ordinary_nonlocals, TypeInfoLiveness,
- ProcInfo0, ProcInfo).
+requantify_proc(ProcInfo0, ProcInfo) :-
+ requantify_proc(ordinary_nonlocals, ProcInfo0, ProcInfo).
-requantify_proc(RecomputeNonLocals, TypeInfoLiveness, ProcInfo0, ProcInfo) :-
+requantify_proc(RecomputeNonLocals, ProcInfo0, ProcInfo) :-
proc_info_varset(ProcInfo0, Varset0),
proc_info_vartypes(ProcInfo0, VarTypes0),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
proc_info_headvars(ProcInfo0, HeadVars),
proc_info_goal(ProcInfo0, Goal0),
implicitly_quantify_clause_body(RecomputeNonLocals, HeadVars,
- Goal0, Varset0, VarTypes0, TVarMap, TypeInfoLiveness,
- Goal, Varset, VarTypes, _),
+ Goal0, Varset0, VarTypes0, Goal, Varset, VarTypes, _),
proc_info_set_varset(ProcInfo0, Varset, ProcInfo1),
proc_info_set_vartypes(ProcInfo1, VarTypes, ProcInfo2),
proc_info_set_goal(ProcInfo2, Goal, ProcInfo).
-implicitly_quantify_goal(Goal0, Varset0, VarTypes0, TVarMap, TypeInfoLiveness,
- OutsideVars, Goal, Varset, VarTypes, Warnings) :-
+implicitly_quantify_goal(Goal0, Varset0, VarTypes0, OutsideVars,
+ Goal, Varset, VarTypes, Warnings) :-
implicitly_quantify_goal(ordinary_nonlocals, Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
- Goal, Varset, VarTypes, Warnings).
+ OutsideVars, Goal, Varset, VarTypes, Warnings).
implicitly_quantify_goal(RecomputeNonLocals, Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
- Goal, Varset, VarTypes, Warnings) :-
+ OutsideVars, Goal, Varset, VarTypes, Warnings) :-
implicitly_quantify_goal_2(ordinary_nonlocals,
- Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
+ Goal0, Varset0, VarTypes0, OutsideVars,
Goal1, Varset1, VarTypes1, Warnings),
(
RecomputeNonLocals = code_gen_nonlocals,
@@ -233,8 +219,7 @@
goal_contains_reconstruction(Goal1)
->
implicitly_quantify_goal_2(code_gen_nonlocals,
- Goal1, Varset1, VarTypes1,
- TVarMap, TypeInfoLiveness, OutsideVars,
+ Goal1, Varset1, VarTypes1, OutsideVars,
Goal, Varset, VarTypes, _)
;
Goal = Goal1,
@@ -243,17 +228,15 @@
).
:- pred implicitly_quantify_goal_2(nonlocals_to_recompute::in,
- hlds_goal::in, prog_varset::in, vartypes::in,
- type_info_varmap::in, bool::in, set(prog_var)::in,
+ hlds_goal::in, prog_varset::in, vartypes::in, set(prog_var)::in,
hlds_goal::out, prog_varset::out, vartypes::out,
list(quant_warning)::out) is det.
implicitly_quantify_goal_2(RecomputeNonLocals,
- Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, OutsideVars,
+ Goal0, Varset0, VarTypes0, OutsideVars,
Goal, Varset, VarTypes, Warnings) :-
quantification__init(RecomputeNonLocals, OutsideVars,
- Varset0, VarTypes0, TVarMap, TypeInfoLiveness, QuantInfo0),
+ Varset0, VarTypes0, QuantInfo0),
implicitly_quantify_goal(Goal0, Goal, QuantInfo0, QuantInfo),
quantification__get_varset(Varset, QuantInfo, _),
quantification__get_vartypes(VarTypes, QuantInfo, _),
@@ -292,14 +275,8 @@
% to become local when previously it was non-local),
% then we may need to likewise shrink the instmap delta.
%
- quantification__get_typeinfo_liveness(TypeInfoLiveness),
- quantification__get_vartypes(VarTypes),
- quantification__get_type_info_varmap(TVarMap),
- { proc_info_maybe_complete_with_typeinfo_vars(NonLocalVars,
- TypeInfoLiveness, VarTypes, TVarMap, CompletedNonLocalVars) },
{ goal_info_get_instmap_delta(GoalInfo2, InstMapDelta0) },
- { instmap_delta_restrict(InstMapDelta0, CompletedNonLocalVars,
- InstMapDelta) },
+ { instmap_delta_restrict(InstMapDelta0, NonLocalVars, InstMapDelta) },
{ goal_info_set_instmap_delta(GoalInfo2, InstMapDelta, GoalInfo) }.
:- pred implicitly_quantify_goal_2(hlds_goal_expr::in, prog_context::in,
@@ -1161,11 +1138,10 @@
%-----------------------------------------------------------------------------%
:- pred quantification__init(nonlocals_to_recompute::in, set(prog_var)::in,
- prog_varset::in, vartypes::in, type_info_varmap::in, bool::in,
- quant_info::out) is det.
+ prog_varset::in, vartypes::in, quant_info::out) is det.
quantification__init(RecomputeNonLocals, OutsideVars,
- Varset, VarTypes, TVarMap, TypeInfoLiveness, QuantInfo) :-
+ Varset, VarTypes, QuantInfo) :-
set__init(QuantVars),
set__init(NonLocals),
set__init(LambdaOutsideVars),
@@ -1173,102 +1149,77 @@
OverlapWarnings = [],
QuantInfo = quant_info(RecomputeNonLocals, OutsideVars, QuantVars,
LambdaOutsideVars, NonLocals, Seen, Varset, VarTypes,
- TVarMap, TypeInfoLiveness, OverlapWarnings).
+ OverlapWarnings).
:- pred quantification__get_nonlocals_to_recompute(nonlocals_to_recompute::out,
quant_info::in, quant_info::out) is det.
-quantification__get_nonlocals_to_recompute(Q ^ nonlocals_to_recompute, Q, Q).
-
:- pred quantification__get_outside(set(prog_var)::out,
quant_info::in, quant_info::out) is det.
-quantification__get_outside(Q ^ outside, Q, Q).
-
-:- pred quantification__set_outside(set(prog_var)::in,
- quant_info::in, quant_info::out) is det.
-
-quantification__set_outside(Outside, Q0, Q0 ^ outside := Outside).
-
:- pred quantification__get_quant_vars(set(prog_var)::out,
quant_info::in, quant_info::out) is det.
-quantification__get_quant_vars(Q ^ quant_vars, Q, Q).
-
-:- pred quantification__set_quant_vars(set(prog_var)::in,
- quant_info::in, quant_info::out) is det.
-
-quantification__set_quant_vars(QuantVars, Q0, Q0 ^ quant_vars := QuantVars).
-
:- pred quantification__get_lambda_outside(set(prog_var)::out,
quant_info::in, quant_info::out) is det.
-quantification__get_lambda_outside(Q ^ lambda_outside, Q, Q).
-
-:- pred quantification__set_lambda_outside(set(prog_var)::in,
- quant_info::in, quant_info::out) is det.
-
-quantification__set_lambda_outside(LambdaOutsideVars, Q0,
- Q0 ^ lambda_outside := LambdaOutsideVars).
-
:- pred quantification__get_nonlocals(set(prog_var)::out,
quant_info::in, quant_info::out) is det.
-quantification__get_nonlocals(Q ^ nonlocals, Q, Q).
-
-:- pred quantification__set_nonlocals(set(prog_var)::in,
- quant_info::in, quant_info::out) is det.
-
-quantification__set_nonlocals(NonLocals, Q0, Q0 ^ nonlocals := NonLocals).
-
:- pred quantification__get_seen(set(prog_var)::out,
quant_info::in, quant_info::out) is det.
-quantification__get_seen(Q ^ seen, Q, Q).
-
-:- pred quantification__set_seen(set(prog_var)::in,
- quant_info::in, quant_info::out) is det.
-
-quantification__set_seen(Seen, Q0, Q0 ^ seen := Seen).
-
:- pred quantification__get_varset(prog_varset::out,
quant_info::in, quant_info::out) is det.
-quantification__get_varset(Q ^ varset, Q, Q).
-
-:- pred quantification__set_varset(prog_varset::in,
- quant_info::in, quant_info::out) is det.
-
-quantification__set_varset(Varset, Q0, Q0 ^ varset := Varset).
-
:- pred quantification__get_vartypes(vartypes::out,
quant_info::in, quant_info::out) is det.
-
-quantification__get_vartypes(Q ^ vartypes, Q, Q).
-:- pred quantification__set_vartypes(vartypes::in,
+:- pred quantification__get_warnings(list(quant_warning)::out,
quant_info::in, quant_info::out) is det.
-quantification__set_vartypes(VarTypes, Q0, Q0 ^ vartypes := VarTypes).
+:- pred quantification__set_outside(set(prog_var)::in,
+ quant_info::in, quant_info::out) is det.
-:- pred quantification__get_type_info_varmap(type_info_varmap::out,
+:- pred quantification__set_quant_vars(set(prog_var)::in,
quant_info::in, quant_info::out) is det.
-quantification__get_type_info_varmap(Q ^ type_info_varmap, Q, Q).
+:- pred quantification__set_lambda_outside(set(prog_var)::in,
+ quant_info::in, quant_info::out) is det.
-:- pred quantification__get_typeinfo_liveness(bool::out,
+:- pred quantification__set_nonlocals(set(prog_var)::in,
quant_info::in, quant_info::out) is det.
-quantification__get_typeinfo_liveness(Q ^ typeinfo_liveness, Q, Q).
+:- pred quantification__set_seen(set(prog_var)::in,
+ quant_info::in, quant_info::out) is det.
-:- pred quantification__get_warnings(list(quant_warning)::out,
+:- pred quantification__set_varset(prog_varset::in,
quant_info::in, quant_info::out) is det.
-quantification__get_warnings(Q ^ warnings, Q, Q).
+:- pred quantification__set_vartypes(vartypes::in,
+ quant_info::in, quant_info::out) is det.
:- pred quantification__set_warnings(list(quant_warning)::in,
quant_info::in, quant_info::out) is det.
+quantification__get_nonlocals_to_recompute(Q ^ nonlocals_to_recompute, Q, Q).
+quantification__get_outside(Q ^ outside, Q, Q).
+quantification__get_quant_vars(Q ^ quant_vars, Q, Q).
+quantification__get_lambda_outside(Q ^ lambda_outside, Q, Q).
+quantification__get_nonlocals(Q ^ nonlocals, Q, Q).
+quantification__get_seen(Q ^ seen, Q, Q).
+quantification__get_varset(Q ^ varset, Q, Q).
+quantification__get_vartypes(Q ^ vartypes, Q, Q).
+quantification__get_warnings(Q ^ warnings, Q, Q).
+
+quantification__set_outside(Outside, Q0, Q0 ^ outside := Outside).
+quantification__set_quant_vars(QuantVars, Q0, Q0 ^ quant_vars := QuantVars).
+quantification__set_lambda_outside(LambdaOutsideVars, Q0,
+ Q0 ^ lambda_outside := LambdaOutsideVars).
+quantification__set_nonlocals(NonLocals, Q0, Q0 ^ nonlocals := NonLocals).
+quantification__set_seen(Seen, Q0, Q0 ^ seen := Seen).
+quantification__set_varset(Varset, Q0, Q0 ^ varset := Varset).
+quantification__set_vartypes(VarTypes, Q0, Q0 ^ vartypes := VarTypes).
quantification__set_warnings(Warnings, Q0, Q0 ^ warnings := Warnings).
%-----------------------------------------------------------------------------%
Index: compiler/saved_vars.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/saved_vars.m,v
retrieving revision 1.26
diff -u -r1.26 saved_vars.m
--- compiler/saved_vars.m 2000/08/09 07:47:48 1.26
+++ compiler/saved_vars.m 2000/08/15 15:08:27
@@ -28,14 +28,13 @@
:- import_module hlds_module, hlds_pred.
:- import_module io.
-:- pred saved_vars_proc(pred_id, proc_id, proc_info, proc_info,
- module_info, module_info, io__state, io__state).
-:- mode saved_vars_proc(in, in, in, out, in, out, di, uo) is det.
-
-:- pred saved_vars_proc_no_io(pred_id, proc_id, proc_info, proc_info,
- module_info, module_info).
-:- mode saved_vars_proc_no_io(in, in, in, out, in, out) is det.
+:- pred saved_vars_proc(pred_id::in, proc_id::in,
+ proc_info::in, proc_info::out, module_info::in, module_info::out,
+ io__state::di, io__state::uo) is det.
+:- pred saved_vars_proc_no_io(proc_info::in, proc_info::out,
+ module_info::in, module_info::out) is det.
+
%-----------------------------------------------------------------------------%
:- implementation.
@@ -50,15 +49,13 @@
ModuleInfo0, ModuleInfo) -->
write_proc_progress_message("% Minimizing saved vars in ",
PredId, ProcId, ModuleInfo0),
- { saved_vars_proc_no_io(PredId, ProcId, ProcInfo0, ProcInfo,
+ { saved_vars_proc_no_io(ProcInfo0, ProcInfo,
ModuleInfo0, ModuleInfo) }.
-saved_vars_proc_no_io(PredId, _ProcId, ProcInfo0, ProcInfo,
- ModuleInfo0, ModuleInfo) :-
+saved_vars_proc_no_io(ProcInfo0, ProcInfo, ModuleInfo0, ModuleInfo) :-
proc_info_goal(ProcInfo0, Goal0),
proc_info_varset(ProcInfo0, Varset0),
proc_info_vartypes(ProcInfo0, VarTypes0),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
init_slot_info(Varset0, VarTypes0, SlotInfo0),
saved_vars_in_goal(Goal0, SlotInfo0, Goal1, SlotInfo),
@@ -69,15 +66,11 @@
% hlds_out__write_goal(Goal1, ModuleInfo, Varset1, 0, "\n"),
% recompute the nonlocals for each goal
- module_info_pred_info(ModuleInfo0, PredId, PredInfo),
- module_info_globals(ModuleInfo0, Globals),
- body_should_use_typeinfo_liveness(PredInfo, Globals, TypeInfoLiveness),
implicitly_quantify_clause_body(HeadVars, Goal1, Varset1,
- VarTypes1, TVarMap, TypeInfoLiveness,
- Goal2, Varset, VarTypes, _Warnings),
+ VarTypes1, Goal2, Varset, VarTypes, _Warnings),
proc_info_get_initial_instmap(ProcInfo0, ModuleInfo0, InstMap0),
- recompute_instmap_delta(no, PredInfo, Goal2, Goal, VarTypes, TVarMap,
- InstMap0, ModuleInfo0, ModuleInfo),
+ recompute_instmap_delta(no, Goal2, Goal, VarTypes, InstMap0,
+ ModuleInfo0, ModuleInfo),
% hlds_out__write_goal(Goal, ModuleInfo, Varset, 0, "\n"),
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.80
diff -u -r1.80 simplify.m
--- compiler/simplify.m 2000/08/09 07:47:48 1.80
+++ compiler/simplify.m 2000/08/15 15:08:27
@@ -208,15 +208,8 @@
( simplify_info_requantify(Info1) ->
Goal1 = _ - GoalInfo1,
goal_info_get_nonlocals(GoalInfo1, NonLocals),
- simplify_info_get_type_info_varmap(Info1, TVarMap),
- simplify_info_get_pred_info(Info1, PredInfo0),
- simplify_info_get_module_info(Info1, ModuleInfo1),
- module_info_globals(ModuleInfo1, Globals),
- body_should_use_typeinfo_liveness(PredInfo0, Globals,
- TypeInfoLiveness),
implicitly_quantify_goal(Goal1, VarSet0, VarTypes0,
- TVarMap, TypeInfoLiveness, NonLocals,
- Goal2, VarSet, VarTypes, _),
+ NonLocals, Goal2, VarSet, VarTypes, _),
simplify_info_set_varset(Info1, VarSet, Info2),
simplify_info_set_var_types(Info2, VarTypes, Info3),
@@ -228,9 +221,8 @@
RecomputeAtomic = yes,
simplify_info_get_module_info(Info3, ModuleInfo3),
- recompute_instmap_delta(RecomputeAtomic, PredInfo0,
- Goal2, Goal3, VarTypes, TVarMap, InstMap0,
- ModuleInfo3, ModuleInfo4),
+ recompute_instmap_delta(RecomputeAtomic, Goal2, Goal3,
+ VarTypes, InstMap0, ModuleInfo3, ModuleInfo4),
simplify_info_set_module_info(Info3, ModuleInfo4, Info4)
;
Goal3 = Goal1,
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.20
diff -u -r1.20 table_gen.m
--- compiler/table_gen.m 2000/08/08 04:44:53 1.20
+++ compiler/table_gen.m 2000/08/15 15:08:27
@@ -281,8 +281,8 @@
% are pretty dodgy (especially those for if-then-elses), so
% recompute them here.
RecomputeAtomic = no,
- recompute_instmap_delta_proc(RecomputeAtomic, PredInfo1,
- ProcInfo4, ProcInfo, Module1, Module2),
+ recompute_instmap_delta_proc(RecomputeAtomic, ProcInfo4, ProcInfo,
+ Module1, Module2),
pred_info_procedures(PredInfo1, ProcTable1),
map__det_update(ProcTable1, ProcId, ProcInfo, ProcTable),
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.85
diff -u -r1.85 unify_proc.m
--- compiler/unify_proc.m 2000/08/06 03:40:22 1.85
+++ compiler/unify_proc.m 2000/08/15 15:08:27
@@ -708,15 +708,8 @@
unify_proc__quantify_clause_body(HeadVars, Goal, Context, Clause) -->
unify_proc__info_get_varset(Varset0),
unify_proc__info_get_types(Types0),
- unify_proc__info_get_type_info_varmap(TVarMap),
- % Since the we haven't done mode analysis yet, the
- % instmap_delta fields in goal_infos are not yet
- % meaningful. Therefore there no point in clipping
- % them to the set of typeinfo-liveness-completed
- % nonlocals.
- { TypeInfoLiveness = no },
{ implicitly_quantify_clause_body(HeadVars, Goal, Varset0, Types0,
- TVarMap, TypeInfoLiveness, Body, Varset, Types, _Warnings) },
+ Body, Varset, Types, _Warnings) },
unify_proc__info_set_varset(Varset),
unify_proc__info_set_types(Types),
{ Clause = clause([], Body, Context) }.
Index: compiler/unique_modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unique_modes.m,v
retrieving revision 1.63
diff -u -r1.63 unique_modes.m
--- compiler/unique_modes.m 2000/08/09 07:48:03 1.63
+++ compiler/unique_modes.m 2000/08/15 15:08:27
@@ -128,15 +128,14 @@
%
% Restore the original bag of nondet-live vars
%
- mode_info_set_nondet_live_vars(NondetLiveVars0, ModeInfo3, ModeInfo4),
+ mode_info_set_nondet_live_vars(NondetLiveVars0, ModeInfo3, ModeInfo),
%
% Grab the final instmap, compute the change in insts
% over this goal, and save that instmap_delta in the goal_info.
%
mode_info_get_instmap(ModeInfo, InstMap),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals,
- ModeInfo4, ModeInfo),
+ goal_info_get_nonlocals(GoalInfo0, NonLocals),
compute_instmap_delta(InstMap0, InstMap, NonLocals, DeltaInstMap),
goal_info_set_instmap_delta(GoalInfo0, DeltaInstMap, GoalInfo),
@@ -264,12 +263,12 @@
unique_modes__check_goal_2(par_conj(List0, SM), GoalInfo0,
par_conj(List, SM)) -->
mode_checkpoint(enter, "par_conj"),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
mode_info_add_live_vars(NonLocals),
% Build a multiset of the nonlocals of the conjuncts
% so that we can figure out which variables must be
% made shared at the start of the parallel conjunction.
- make_par_conj_nonlocal_multiset(List0, NonLocalsBag),
+ { make_par_conj_nonlocal_multiset(List0, NonLocalsBag) },
unique_modes__check_par_conj(List0, NonLocalsBag, List, InstMapList),
instmap__unify(NonLocals, InstMapList),
mode_info_remove_live_vars(NonLocals),
@@ -295,7 +294,7 @@
% disjuncts. But we handle that seperately for each
% disjunct, in unique_modes__check_disj.
%
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
{ goal_info_get_code_model(GoalInfo0, CodeModel) },
% does this disjunction create a choice point?
( { CodeModel = model_non } ->
@@ -316,13 +315,13 @@
),
mode_checkpoint(exit, "disj").
-unique_modes__check_goal_2(if_then_else(Vs, A0, B0, C0, SM), GoalInfo0, Goal)
- -->
+unique_modes__check_goal_2(if_then_else(Vs, Cond0, Then0, Else0, SM),
+ GoalInfo0, Goal) -->
mode_checkpoint(enter, "if-then-else"),
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
- mode_info_get_goal_completed_nonlocals(A0, A_Vars),
- mode_info_get_goal_completed_nonlocals(B0, B_Vars),
- mode_info_get_goal_completed_nonlocals(C0, C_Vars),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
+ { goal_get_nonlocals(Cond0, Cond_Vars) },
+ { goal_get_nonlocals(Then0, Then_Vars) },
+ { goal_get_nonlocals(Else0, Else_Vars) },
mode_info_dcg_get_instmap(InstMap0),
mode_info_lock_vars(if_then_else, NonLocals),
@@ -353,38 +352,38 @@
% use(Var)
% ).
%
- mode_info_add_live_vars(C_Vars),
+ mode_info_add_live_vars(Else_Vars),
=(ModeInfo),
- { set__to_sorted_list(A_Vars, A_Vars_List) },
- { select_live_vars(A_Vars_List, ModeInfo, A_Live_Vars) },
- { A0 = _ - A0_GoalInfo },
- { goal_info_get_instmap_delta(A0_GoalInfo, A0_DeltaInstMap) },
- { select_changed_inst_vars(A_Live_Vars, A0_DeltaInstMap, ModeInfo,
- ChangedVars) },
+ { set__to_sorted_list(Cond_Vars, Cond_Vars_List) },
+ { select_live_vars(Cond_Vars_List, ModeInfo, Cond_Live_Vars) },
+ { Cond0 = _ - Cond0_GoalInfo },
+ { goal_info_get_instmap_delta(Cond0_GoalInfo, Cond0_DeltaInstMap) },
+ { select_changed_inst_vars(Cond_Live_Vars, Cond0_DeltaInstMap,
+ ModeInfo, ChangedVars) },
make_var_list_mostly_uniq(ChangedVars),
- mode_info_remove_live_vars(C_Vars),
+ mode_info_remove_live_vars(Else_Vars),
- mode_info_add_live_vars(B_Vars),
- unique_modes__check_goal(A0, A),
- mode_info_remove_live_vars(B_Vars),
+ mode_info_add_live_vars(Then_Vars),
+ unique_modes__check_goal(Cond0, Cond),
+ mode_info_remove_live_vars(Then_Vars),
mode_info_unlock_vars(if_then_else, NonLocals),
- mode_info_dcg_get_instmap(InstMapA),
- ( { instmap__is_reachable(InstMapA) } ->
- unique_modes__check_goal(B0, B),
- mode_info_dcg_get_instmap(InstMapB)
+ mode_info_dcg_get_instmap(InstMapCond),
+ ( { instmap__is_reachable(InstMapCond) } ->
+ unique_modes__check_goal(Then0, Then),
+ mode_info_dcg_get_instmap(InstMapThen)
;
% We should not mode-analyse the goal, since it is unreachable.
% Instead we optimize the goal away, so that later passes
% won't complain about it not having unique mode information.
- { true_goal(B) },
- { InstMapB = InstMapA }
+ { true_goal(Then) },
+ { InstMapThen = InstMapCond }
),
mode_info_set_instmap(InstMap0),
- unique_modes__check_goal(C0, C),
- mode_info_dcg_get_instmap(InstMapC),
+ unique_modes__check_goal(Else0, Else),
+ mode_info_dcg_get_instmap(InstMapElse),
mode_info_set_instmap(InstMap0),
- instmap__merge(NonLocals, [InstMapB, InstMapC], if_then_else),
- { Goal = if_then_else(Vs, A, B, C, SM) },
+ instmap__merge(NonLocals, [InstMapThen, InstMapElse], if_then_else),
+ { Goal = if_then_else(Vs, Cond, Then, Else, SM) },
mode_checkpoint(exit, "if-then-else").
unique_modes__check_goal_2(not(A0), GoalInfo0, not(A)) -->
@@ -397,7 +396,7 @@
% negation will succeed, and so these variables
% can be accessed again after backtracking.
%
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
{ set__to_sorted_list(NonLocals, NonLocalsList) },
=(ModeInfo),
{ select_live_vars(NonLocalsList, ModeInfo, LiveNonLocals) },
@@ -501,7 +500,7 @@
{ instmap__init_unreachable(InstMap) },
mode_info_set_instmap(InstMap)
;
- mode_info_get_completed_nonlocals(GoalInfo0, NonLocals),
+ { goal_info_get_nonlocals(GoalInfo0, NonLocals) },
unique_modes__check_case_list(Cases0, Var, Cases, InstMapList),
instmap__merge(NonLocals, InstMapList, disj)
),
@@ -657,7 +656,7 @@
unique_modes__check_conj([], []) --> [].
unique_modes__check_conj([Goal0 | Goals0], [Goal | Goals]) -->
- mode_info_get_goal_completed_nonlocals(Goal0, NonLocals),
+ { goal_get_nonlocals(Goal0, NonLocals) },
mode_info_remove_live_vars(NonLocals),
unique_modes__check_goal(Goal0, Goal),
mode_info_dcg_get_instmap(InstMap),
@@ -676,20 +675,18 @@
% make_par_conj_nonlocal_multiset builds a multiset (bag) of all
% the nonlocals of the conjuncts.
-:- pred make_par_conj_nonlocal_multiset(list(hlds_goal), bag(prog_var),
- mode_info, mode_info).
-:- mode make_par_conj_nonlocal_multiset(in, out, mode_info_di, mode_info_uo)
- is det.
+:- pred make_par_conj_nonlocal_multiset(list(hlds_goal)::in,
+ bag(prog_var)::out) is det.
-make_par_conj_nonlocal_multiset([], Empty) -->
- { bag__init(Empty) }.
-make_par_conj_nonlocal_multiset([Goal | Goals], NonLocalsMultiSet) -->
+make_par_conj_nonlocal_multiset([], Empty) :-
+ bag__init(Empty).
+make_par_conj_nonlocal_multiset([Goal | Goals], NonLocalsMultiSet) :-
make_par_conj_nonlocal_multiset(Goals, NonLocalsMultiSet0),
- mode_info_get_goal_completed_nonlocals(Goal, NonLocals),
- { set__to_sorted_list(NonLocals, NonLocalsList) },
- { bag__from_list(NonLocalsList, NonLocalsMultiSet1) },
- { bag__union(NonLocalsMultiSet0, NonLocalsMultiSet1,
- NonLocalsMultiSet) }.
+ goal_get_nonlocals(Goal, NonLocals),
+ set__to_sorted_list(NonLocals, NonLocalsList),
+ bag__from_list(NonLocalsList, NonLocalsMultiSet1),
+ bag__union(NonLocalsMultiSet0, NonLocalsMultiSet1,
+ NonLocalsMultiSet).
% To unique-modecheck a parallel conjunction, we find the variables
% that are nonlocal to more than one conjunct and make them shared,
@@ -742,7 +739,7 @@
unique_modes__check_par_conj_1([], [], []) --> [].
unique_modes__check_par_conj_1([Goal0 | Goals0], [Goal | Goals],
[InstMap - NonLocals|InstMaps]) -->
- mode_info_get_goal_completed_nonlocals(Goal0, NonLocals),
+ { goal_get_nonlocals(Goal0, NonLocals) },
mode_info_dcg_get_instmap(InstMap0),
unique_modes__check_goal(Goal0, Goal),
mode_info_dcg_get_instmap(InstMap),
Index: compiler/unneeded_code.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unneeded_code.m,v
retrieving revision 1.4
diff -u -r1.4 unneeded_code.m
--- compiler/unneeded_code.m 2000/08/09 07:48:04 1.4
+++ compiler/unneeded_code.m 2000/08/15 15:08:27
@@ -195,20 +195,14 @@
unneeded_code__process_proc_msg(PredId, ProcId, ProcInfo0, ProcInfo,
ModuleInfo0, ModuleInfo) -->
- { module_info_pred_info(ModuleInfo0, PredId, PredInfo) },
- { module_info_globals(ModuleInfo0, Globals) },
- { body_should_use_typeinfo_liveness(PredInfo, Globals,
- TypeInfoLiveness) },
globals__io_lookup_bool_option(very_verbose, VeryVerbose),
( { VeryVerbose = yes } ->
io__write_string("% Removing dead code in "),
hlds_out__write_pred_proc_id(ModuleInfo0, PredId, ProcId),
io__write_string(": "),
- { unneeded_code__pre_process_proc(TypeInfoLiveness,
- ProcInfo0, ProcInfo1) },
- { unneeded_code__process_proc(PredInfo, ProcInfo1, ProcInfo,
- ModuleInfo0, ModuleInfo, TypeInfoLiveness,
- Successful) },
+ { unneeded_code__pre_process_proc(ProcInfo0, ProcInfo1) },
+ { unneeded_code__process_proc(ProcInfo1, ProcInfo,
+ ModuleInfo0, ModuleInfo, Successful) },
(
{ Successful = yes },
io__write_string("done.\n")
@@ -217,23 +211,20 @@
io__write_string("none found.\n")
)
;
- { unneeded_code__pre_process_proc(TypeInfoLiveness,
- ProcInfo0, ProcInfo1) },
- { unneeded_code__process_proc(PredInfo, ProcInfo1, ProcInfo,
- ModuleInfo0, ModuleInfo, TypeInfoLiveness, _) }
+ { unneeded_code__pre_process_proc(ProcInfo0, ProcInfo1) },
+ { unneeded_code__process_proc(ProcInfo1, ProcInfo,
+ ModuleInfo0, ModuleInfo, _) }
).
-:- pred unneeded_code__pre_process_proc(bool::in, proc_info::in,
- proc_info::out) is det.
+:- pred unneeded_code__pre_process_proc(proc_info::in, proc_info::out) is det.
-unneeded_code__pre_process_proc(TypeInfoLiveness, ProcInfo0, ProcInfo) :-
+unneeded_code__pre_process_proc(ProcInfo0, ProcInfo) :-
proc_info_headvars(ProcInfo0, HeadVars),
proc_info_goal(ProcInfo0, Goal0),
proc_info_varset(ProcInfo0, Varset0),
proc_info_vartypes(ProcInfo0, VarTypes0),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
implicitly_quantify_clause_body(HeadVars, Goal0, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, Goal, Varset, VarTypes, _Warnings),
+ Goal, Varset, VarTypes, _Warnings),
proc_info_set_goal(ProcInfo0, Goal, ProcInfo1),
proc_info_set_varset(ProcInfo1, Varset, ProcInfo2),
proc_info_set_vartypes(ProcInfo2, VarTypes, ProcInfo).
@@ -271,12 +262,11 @@
copy_limit :: int
).
-:- pred unneeded_code__process_proc(pred_info::in,
- proc_info::in, proc_info::out, module_info::in, module_info::out,
- bool::in, bool::out) is det.
+:- pred unneeded_code__process_proc(proc_info::in, proc_info::out,
+ module_info::in, module_info::out, bool::out) is det.
-unneeded_code__process_proc(PredInfo, ProcInfo0, ProcInfo,
- ModuleInfo0, ModuleInfo, TypeInfoLiveness, Successful) :-
+unneeded_code__process_proc(ProcInfo0, ProcInfo, ModuleInfo0, ModuleInfo,
+ Successful) :-
goal_path__fill_slots(ProcInfo0, ModuleInfo0, ProcInfo1),
proc_info_goal(ProcInfo1, Goal0),
proc_info_varset(ProcInfo1, Varset0),
@@ -311,18 +301,16 @@
% We need to fix up the goal_info by recalculating
% the nonlocal vars and the non-atomic instmap deltas.
proc_info_headvars(ProcInfo0, HeadVars),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
implicitly_quantify_clause_body(HeadVars,
Goal2, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness,
Goal3, Varset, VarTypes, _Warnings),
- recompute_instmap_delta(no, PredInfo, Goal3, Goal,
- VarTypes, TVarMap, InstMap0, ModuleInfo0, ModuleInfo1),
+ recompute_instmap_delta(no, Goal3, Goal,
+ VarTypes, InstMap0, ModuleInfo0, ModuleInfo1),
proc_info_set_goal(ProcInfo1, Goal, ProcInfo2),
proc_info_set_varset(ProcInfo2, Varset, ProcInfo3),
proc_info_set_vartypes(ProcInfo3, VarTypes, ProcInfo4),
- unneeded_code__process_proc(PredInfo, ProcInfo4, ProcInfo,
- ModuleInfo1, ModuleInfo, TypeInfoLiveness, _),
+ unneeded_code__process_proc(ProcInfo4, ProcInfo,
+ ModuleInfo1, ModuleInfo, _),
Successful = yes
;
ProcInfo = ProcInfo0,
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.66
diff -u -r1.66 unused_args.m
--- compiler/unused_args.m 2000/08/09 07:48:04 1.66
+++ compiler/unused_args.m 2000/08/15 15:08:27
@@ -823,9 +823,6 @@
map__det_insert(ProcCallInfo0, proc(PredId, ProcId),
call_info(NewPredId, NewProcId, PredSymName, UnusedArgs),
ProcCallInfo),
- module_info_globals(ModuleInfo0, Globals),
- body_should_use_typeinfo_liveness(NewPredInfo, Globals,
- TypeInfoLiveness),
(
Status0 = exported,
IntermodUnusedArgs = yes(UnusedArgs2)
@@ -837,8 +834,7 @@
UnusedArgs2, "__ua", exported,
proc(PredId, ProcId), ExtraPredInfo0),
create_call_goal(UnusedArgs, NewPredId, NewProcId,
- PredModule, PredName, TypeInfoLiveness,
- OldProc0, ExtraProc0),
+ PredModule, PredName, OldProc0, ExtraProc0),
proc_info_headvars(OldProc0, HeadVars0),
remove_listof_elements(HeadVars0, 1, UnusedArgs2,
IntermodHeadVars),
@@ -864,8 +860,7 @@
predicate_table_get_preds(PredTable2, Preds0),
pred_info_procedures(PredInfo0, Procs0),
create_call_goal(UnusedArgs, NewPredId, NewProcId,
- PredModule, PredName, TypeInfoLiveness,
- OldProc0, OldProc),
+ PredModule, PredName, OldProc0, OldProc),
map__set(Procs0, ProcId, OldProc, Procs),
pred_info_set_procedures(PredInfo0, Procs, PredInfo),
map__det_update(Preds0, PredId, PredInfo, Preds1),
@@ -964,11 +959,10 @@
% Replace the goal in the procedure with one to call the given
% pred_id and proc_id.
:- pred create_call_goal(list(int)::in, pred_id::in, proc_id::in,
- module_name::in, string::in, bool::in, proc_info::in,
- proc_info::out) is det.
+ module_name::in, string::in, proc_info::in, proc_info::out) is det.
create_call_goal(UnusedArgs, NewPredId, NewProcId, PredModule,
- PredName, TypeInfoLiveness, OldProc0, OldProc) :-
+ PredName, OldProc0, OldProc) :-
proc_info_headvars(OldProc0, HeadVars),
proc_info_goal(OldProc0, Goal0),
Goal0 = _GoalExpr - GoalInfo0,
@@ -983,10 +977,8 @@
GoalExpr = call(NewPredId, NewProcId, NewHeadVars,
not_builtin, no, qualified(PredModule, PredName)),
Goal1 = GoalExpr - GoalInfo0,
- proc_info_typeinfo_varmap(OldProc0, TVarMap),
implicitly_quantify_goal(Goal1, Varset0, VarTypes1,
- TVarMap, TypeInfoLiveness, NonLocals,
- Goal, Varset, VarTypes, _),
+ NonLocals, Goal, Varset, VarTypes, _),
proc_info_set_goal(OldProc0, Goal, OldProc1),
proc_info_set_varset(OldProc1, Varset, OldProc2),
proc_info_set_vartypes(OldProc2, VarTypes, OldProc).
@@ -1151,13 +1143,8 @@
Changed = yes,
% if anything has changed, rerun quantification
set__list_to_set(HeadVars, NonLocals),
- proc_info_typeinfo_varmap(ProcInfo0, TVarMap),
- module_info_globals(Mod0, Globals),
- body_should_use_typeinfo_liveness(PredInfo0, Globals,
- TypeInfoLiveness),
implicitly_quantify_goal(Goal1, Varset0, VarTypes0,
- TVarMap, TypeInfoLiveness, NonLocals,
- Goal, Varset, VarTypes, _),
+ NonLocals, Goal, Varset, VarTypes, _),
proc_info_set_goal(FixedProc2, Goal, FixedProc3),
proc_info_set_varset(FixedProc3, Varset, FixedProc4),
proc_info_set_vartypes(FixedProc4, VarTypes, FixedProc5)
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing trax
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list