[m-rev.] diff: part 2 of the fix for the trace_goal_* test case failures

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Aug 14 13:53:39 AEST 2006


I intend to commit the parts of this diff for the compiler directory soon,
since only the change to the library needs to wait for part 1 to be installed.
When I commit the diff to the library, I will also modify configure.in
to require the installed compiler to support the option added in part 1.

Zoltan.

This diff implements step 2 of the fix for a bug I introduced when turning
the primitives involved in implementing trace goals into builtins. The bug
is that that builtin primitives have to be declared, but if they don't have
definitions, then add_pred *creates* a definition for them which assumes
them to be pure. The primitives involved in trace goal implementations
are semipure and impure respectively.

library/private_builtin.m:
	Add declarations for trace_get_io_state and trace_set_io_state.

The rest of the diff is for fixing the problems that cropped up with
termination analysis of these primitives.

compiler/type_util.m:
	Fix the predicate for classifying type constructors to make it
	recognize dummy types. Also, factor out some code to ensure
	that data structures are not tested repeatedly against the same
	pattern.

	Without this fix, termination analysis was complaining about
	builtins with non-zero-sized outputs.

compiler/term_norm.m:
	Change the argument order of zero_size_type to conform to our
	conventions.

compiler/term_util.m:
compiler/term_constr_util.m:
compiler/termination.m:
	The predicate all_args_input_or_zero_size used to be defined in
	both term_constr_util and termination.m (with identical code).
	Replace both with a single definition in term_util.

	In term_util.m, rename a predicate whose name clashed with a Mercury
	keyword.

compiler/complexity.m:
compiler/size_prof.m:
compiler/term_constr_build.m:
compiler/term_constr_initial.m:
	Conform to the changes above.

cvs diff: Diffing .
cvs diff: Diffing analysis
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/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/complexity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/complexity.m,v
retrieving revision 1.20
diff -u -r1.20 complexity.m
--- compiler/complexity.m	31 Jul 2006 08:31:32 -0000	1.20
+++ compiler/complexity.m	13 Aug 2006 00:28:43 -0000
@@ -516,7 +516,7 @@
     ),
     ( mode_is_fully_input(ModuleInfo, Mode) ->
         map.lookup(VarTypes, Var, VarType),
-        ( zero_size_type(VarType, ModuleInfo) ->
+        ( zero_size_type(ModuleInfo, VarType) ->
             Kind = complexity_input_fixed_size
         ;
             Kind = complexity_input_variable_size
Index: compiler/size_prof.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/size_prof.m,v
retrieving revision 1.44
diff -u -r1.44 size_prof.m
--- compiler/size_prof.m	11 Aug 2006 04:17:16 -0000	1.44
+++ compiler/size_prof.m	13 Aug 2006 00:28:53 -0000
@@ -789,7 +789,7 @@
     ( map.search(!.Info ^ known_size_map, Arg, ArgSize) ->
         !:KnownSize = !.KnownSize + ArgSize,
         ArgGoals = []
-    ; zero_size_type(Type, !.Info ^ module_info) ->
+    ; zero_size_type(!.Info ^ module_info, Type) ->
         ArgGoals = []
     ;
         make_type_info(Context, Type, TypeInfoVar, TypeInfoGoals, !Info),
Index: compiler/term_constr_build.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_build.m,v
retrieving revision 1.9
diff -u -r1.9 term_constr_build.m
--- compiler/term_constr_build.m	31 Jul 2006 08:32:04 -0000	1.9
+++ compiler/term_constr_build.m	13 Aug 2006 00:29:29 -0000
@@ -230,7 +230,7 @@
     ChooseArg = (func(Var, Mode) = UseArg :-
         Type = VarTypes ^ det_elem(Var),
         ( 
-            not zero_size_type(Type, Module),
+            not zero_size_type(Module, Type),
             mode_util.mode_is_input(Module, Mode)
         ->  
             UseArg = yes
@@ -1180,7 +1180,7 @@
     %
     FindUpperBound = (pred(Ctor::in, !.B::in, !:B::out) is semidet :-
         Ctor = ctor(_, _, SymName, Args),
-        all [Arg] (list.member(Arg, Args) => zero_size_type(snd(Arg), Module)),
+        all [Arg] (list.member(Arg, Args) => zero_size_type(Module, snd(Arg))),
         Arity = list.length(Args),
         ConsId = cons(SymName, Arity),
         Bound = functor_lower_bound(Norm, TypeCtor, ConsId, Module),
Index: compiler/term_constr_initial.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_initial.m,v
retrieving revision 1.12
diff -u -r1.12 term_constr_initial.m
--- compiler/term_constr_initial.m	31 Jul 2006 08:32:04 -0000	1.12
+++ compiler/term_constr_initial.m	13 Aug 2006 00:30:07 -0000
@@ -83,6 +83,7 @@
 :- import_module transform_hlds.term_constr_main.
 :- import_module transform_hlds.term_constr_util.
 :- import_module transform_hlds.term_norm.
+:- import_module transform_hlds.term_util.
 
 :- import_module bool.
 :- import_module bag.
@@ -526,7 +527,7 @@
     ;   
         all_args_input_or_zero_size(ModuleInfo, PredInfo, ProcInfo0)
     ->
-            Constrs = []
+        Constrs = []
     ;
         unexpected(this_file, "builtin with non-zero size args.")
     ),
Index: compiler/term_constr_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_util.m,v
retrieving revision 1.9
diff -u -r1.9 term_constr_util.m
--- compiler/term_constr_util.m	31 Jul 2006 08:32:05 -0000	1.9
+++ compiler/term_constr_util.m	13 Aug 2006 00:30:32 -0000
@@ -5,18 +5,18 @@
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %------------------------------------------------------------------------------%
-% 
+%
 % File: term_constr_util.m
 % Main author: juliensf
-% 
+%
 % This module defines some utility predicates used by the termination analyser.
-% 
+%
 %------------------------------------------------------------------------------%
 
 :- module transform_hlds.term_constr_util.
 :- interface.
 
-:- import_module hlds.hlds_pred. 
+:- import_module hlds.hlds_pred.
 :- import_module hlds.hlds_module.
 :- import_module libs.lp_rational.
 :- import_module libs.polyhedron.
@@ -41,7 +41,7 @@
 :- pred set_pred_proc_ids_constr_arg_size_info(list(pred_proc_id)::in,
     constr_arg_size_info::in, module_info::in, module_info::out) is det.
 
-:- func lookup_proc_constr_arg_size_info(module_info, pred_proc_id) = 
+:- func lookup_proc_constr_arg_size_info(module_info, pred_proc_id) =
     maybe(constr_arg_size_info).
 
     % Retrieve the abstraction representation from the module_info.
@@ -52,7 +52,7 @@
 
 %------------------------------------------------------------------------------%
 %
-% Predicates for size_vars. 
+% Predicates for size_vars.
 %
 
     % Given a list of prog_vars, allocate one size_var per prog_var.
@@ -78,7 +78,7 @@
     % Returns a set containing all the size_vars corresponding to prog_vars
     % that have a type that is always of zero size. i.e. all those for which
     % the functor norm returns zero for all values of the type.
-    % 
+    %
 :- func find_zero_size_vars(module_info, size_var_map, vartypes) = zero_vars.
 
     % create_nonneg_constraints(SizeVarMap, Zeros) = Constraints.
@@ -112,7 +112,7 @@
 %-----------------------------------------------------------------------------%
 
 :- pred add_context_to_constr_termination_info(
-    maybe(pragma_termination_info)::in, prog_context::in,   
+    maybe(pragma_termination_info)::in, prog_context::in,
     maybe(constr_termination_info)::out) is det.
 
 %------------------------------------------------------------------------------%
@@ -121,7 +121,7 @@
     % var_substitution.  Returns the constraints with the specified
     % substitutions made.
     %
-:- func substitute_size_vars(constraints, map(size_var, size_var)) 
+:- func substitute_size_vars(constraints, map(size_var, size_var))
     = constraints.
 
 %------------------------------------------------------------------------------%
@@ -131,22 +131,22 @@
 % In order to use these the option `--debug-term' must be set.
 
     % Call the specified predicate.
-    % 
+    %
 :- pred maybe_write_trace(pred(io, io), io, io).
 :- mode maybe_write_trace(pred(di, uo) is det, di, uo) is det.
 
     % As above but if the boolean argument is `yes', print a newline
     % to stdout before flushing the output.
-    % 
+    %
 :- pred maybe_write_trace(pred(io, io), bool, io, io).
 :- mode maybe_write_trace(pred(di, uo) is det, in, di, uo) is det.
 
     % Write the given string to stdout.
-    % 
+    %
 :- pred maybe_write_string(string::in, io::di, io::uo) is det.
 
     % Write a newline to stdout.
-    % 
+    %
 :- pred maybe_write_nl(io::di, io::uo) is det.
 
 :- pred maybe_write_scc_procs(list(pred_proc_id)::in, module_info::in,
@@ -191,9 +191,6 @@
 :- pred change_procs_constr_arg_size_info(list(proc_id)::in, bool::in,
     constr_arg_size_info::in, proc_table::in, proc_table::out) is det.
 
-:- pred all_args_input_or_zero_size(module_info::in, pred_info::in,
-    proc_info::in) is semidet.
-
 %------------------------------------------------------------------------------%
 %------------------------------------------------------------------------------%
 
@@ -201,17 +198,17 @@
 
 :- import_module check_hlds.mode_util.
 :- import_module check_hlds.type_util.
-:- import_module hlds.hlds_goal. 
-:- import_module hlds.hlds_module. 
+:- import_module hlds.hlds_goal.
+:- import_module hlds.hlds_module.
 :- import_module hlds.hlds_out.
-:- import_module hlds.hlds_pred. 
-:- import_module hlds.quantification. 
+:- import_module hlds.hlds_pred.
+:- import_module hlds.quantification.
 :- import_module libs.compiler_util.
 :- import_module libs.globals.
 :- import_module libs.options.
 :- import_module libs.rat.
 :- import_module parse_tree.mercury_to_mercury.
-:- import_module parse_tree.prog_type. 
+:- import_module parse_tree.prog_type.
 :- import_module transform_hlds.term_constr_errors.
 :- import_module transform_hlds.term_norm.
 
@@ -255,7 +252,7 @@
     make_size_var_map(ProgVars, varset.init, SizeVarset, SizeVarMap).
 
 make_size_var_map(ProgVars, !SizeVarset, SizeVarMap) :-
-    list.foldl2(make_size_var_map_2, ProgVars, 
+    list.foldl2(make_size_var_map_2, ProgVars,
         map.init, SizeVarMap, !SizeVarset).
 
 :- pred make_size_var_map_2(prog_var::in, size_var_map::in, size_var_map::out,
@@ -269,7 +266,7 @@
     = list.map(prog_var_to_size_var(SizeVarMap), Vars).
 
 prog_var_to_size_var(SizeVarMap, Var) = SizeVar :-
-    ( if    map.search(SizeVarMap, Var, SizeVar0) 
+    ( if    map.search(SizeVarMap, Var, SizeVar0)
       then  SizeVar = SizeVar0
       else  unexpected(this_file,
             "prog_var_to_size_var/2: prog_var not in size_var_map.")
@@ -281,7 +278,7 @@
         ProgVars),
     %
     % Build zeros from corresponding size_vars.
-    %   
+    %
     ZerosList = prog_vars_to_size_vars(SizeVarMap, ZeroProgVars),
     Zeros = set.from_list(ZerosList).
 
@@ -291,7 +288,7 @@
 is_zero_size_prog_var(ModuleInfo, VarTypes, Var) :-
     Type = VarTypes ^ det_elem(Var),
     (
-        term_norm.zero_size_type(Type, ModuleInfo)
+        term_norm.zero_size_type(ModuleInfo, Type)
     ;
         % We don't include dummy types in the constraints - they won't tell us
         % anything useful.
@@ -299,7 +296,7 @@
     ).
 
 add_context_to_constr_termination_info(no, _, no).
-add_context_to_constr_termination_info(yes(cannot_loop(_)), _, 
+add_context_to_constr_termination_info(yes(cannot_loop(_)), _,
         yes(cannot_loop(import_supplied))).
 add_context_to_constr_termination_info(yes(can_loop(_)), Context,
         yes(can_loop([Context - imported_pred]))).
@@ -335,17 +332,17 @@
 create_var_substitution(Args, HeadVars) = SubstMap :-
     create_var_substitution_2(Args, HeadVars, map.init, SubstMap).
 
-:- pred create_var_substitution_2(size_vars::in, size_vars::in, 
+:- pred create_var_substitution_2(size_vars::in, size_vars::in,
     var_substitution::in, var_substitution::out) is det.
 
 create_var_substitution_2([], [], !Subst).
-create_var_substitution_2([_|_], [], _, _) :- 
+create_var_substitution_2([_|_], [], _, _) :-
+    unexpected(this_file, "compose_bijections/5: unmatched lists.").
+create_var_substitution_2([], [_|_], _, _) :-
     unexpected(this_file, "compose_bijections/5: unmatched lists.").
-create_var_substitution_2([], [_|_], _, _) :- 
-    unexpected(this_file, "compose_bijections/5: unmatched lists."). 
 create_var_substitution_2([Arg | Args], [HeadVar | HeadVars],  !Subst) :-
     svmap.det_insert(HeadVar, Arg, !Subst),
-    create_var_substitution_2(Args, HeadVars, !Subst). 
+    create_var_substitution_2(Args, HeadVars, !Subst).
 
 make_arg_constraints([], _) = [].
 make_arg_constraints([Var | Vars], Zeros) = Constraints :-
@@ -389,7 +386,7 @@
         Debug = no
     ).
 
-maybe_write_scc_procs(SCC, ModuleInfo, _, !IO) :- 
+maybe_write_scc_procs(SCC, ModuleInfo, _, !IO) :-
     write_scc_procs_2(SCC, ModuleInfo, !IO),
     io.nl(!IO).
 
@@ -397,13 +394,13 @@
     io::di, io::uo) is det.
 
 write_scc_procs_2([], _, !IO).
-write_scc_procs_2([PPId | PPIds], ModuleInfo, !IO) :- 
+write_scc_procs_2([PPId | PPIds], ModuleInfo, !IO) :-
     io.write_char('\t', !IO),
     hlds_out.write_pred_proc_id(ModuleInfo, PPId, !IO),
     io.nl(!IO),
     write_scc_procs_2(PPIds, ModuleInfo, !IO).
 
-maybe_write_proc_name(PPId, String, ModuleInfo, _, !IO) :- 
+maybe_write_proc_name(PPId, String, ModuleInfo, _, !IO) :-
     io.write_string(String, !IO),
     hlds_out.write_pred_proc_id(ModuleInfo, PPId, !IO),
     io.nl(!IO).
@@ -422,11 +419,11 @@
 dump_size_vars(Vars, Varset, !IO) :-
     dump_size_varset_2(Vars, Varset, !IO).
 
-dump_size_varset(Varset, !IO) :- 
+dump_size_varset(Varset, !IO) :-
     Vars = varset.vars(Varset),
     dump_size_varset_2(Vars, Varset, !IO).
 
-:- pred dump_size_varset_2(size_vars::in, size_varset::in, io::di, io::uo) 
+:- pred dump_size_varset_2(size_vars::in, size_varset::in, io::di, io::uo)
     is det.
 
 dump_size_varset_2([], _, !IO).
@@ -439,8 +436,7 @@
 %------------------------------------------------------------------------------%
 
 update_arg_size_info(PPID, Polyhedron, !ModuleInfo) :-
-    set_pred_proc_ids_constr_arg_size_info([PPID], Polyhedron,
-        !ModuleInfo). 
+    set_pred_proc_ids_constr_arg_size_info([PPID], Polyhedron, !ModuleInfo).
 
 %------------------------------------------------------------------------------%
 
@@ -449,7 +445,11 @@
         !ProcTable) :-
     ProcInfo0 = !.ProcTable ^ det_elem(ProcId),
     proc_info_get_termination2_info(ProcInfo0, TermInfo0),
-    ( (Override = yes ; TermInfo0 ^ term_status = no) ->
+    (
+        ( Override = yes
+        ; TermInfo0 ^ term_status = no
+        )
+    ->
         TermInfo = TermInfo0 ^ term_status := yes(Termination),
         proc_info_set_termination2_info(TermInfo, ProcInfo0, ProcInfo),
         svmap.det_update(ProcId, ProcInfo, !ProcTable)
@@ -464,38 +464,18 @@
         !ProcTable) :-
     ProcInfo0 = !.ProcTable ^ det_elem(ProcId),
     proc_info_get_termination2_info(ProcInfo0, TermInfo0),
-    ( (Override = yes ; TermInfo0 ^ success_constrs = no) ->
+    (
+        ( Override = yes
+        ; TermInfo0 ^ success_constrs = no
+        )
+    ->
         TermInfo = TermInfo0 ^ success_constrs := yes(ArgSize),
         proc_info_set_termination2_info(TermInfo, ProcInfo0, ProcInfo),
         svmap.det_update(ProcId, ProcInfo, !ProcTable)
     ;
         true
     ),
-    change_procs_constr_arg_size_info(ProcIds, Override, ArgSize, 
-        !ProcTable).
-
-all_args_input_or_zero_size(ModuleInfo, PredInfo, ProcInfo) :-
-    pred_info_get_arg_types(PredInfo, TypeList),
-    proc_info_get_argmodes(ProcInfo, ModeList),
-    all_args_input_or_zero_size_2(TypeList, ModeList, ModuleInfo). 
-
-:- pred all_args_input_or_zero_size_2(list(mer_type)::in, list(mer_mode)::in,
-    module_info::in) is semidet.
-
-all_args_input_or_zero_size_2([], [], _).
-all_args_input_or_zero_size_2([], [_|_], _) :- 
-    unexpected(this_file, 
-        "all_args_input_or_zero_size_2/3: unmatched lists.").
-all_args_input_or_zero_size_2([_|_], [], _) :- 
-    unexpected(this_file, 
-        "all_args_input_or_zero_size_2/3: unmatched lists.").
-all_args_input_or_zero_size_2([Type | Types], [Mode | Modes], ModuleInfo) :-
-    ( mode_util.mode_is_input(ModuleInfo, Mode) ->
-        all_args_input_or_zero_size_2(Types, Modes, ModuleInfo)
-    ;
-        term_norm.zero_size_type(Type, ModuleInfo),
-        all_args_input_or_zero_size_2(Types, Modes, ModuleInfo)
-    ).
+    change_procs_constr_arg_size_info(ProcIds, Override, ArgSize, !ProcTable).
 
 %----------------------------------------------------------------------------%
 
Index: compiler/term_norm.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_norm.m,v
retrieving revision 1.19
diff -u -r1.19 term_norm.m
--- compiler/term_norm.m	20 Apr 2006 05:37:02 -0000	1.19
+++ compiler/term_norm.m	13 Aug 2006 00:02:45 -0000
@@ -64,7 +64,7 @@
     
     % Succeeds if all values of the given type are zero size (for all norms).
     %
-:- pred zero_size_type(mer_type::in, module_info::in) is semidet.
+:- pred zero_size_type(module_info::in, mer_type::in) is semidet.
 
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
@@ -331,7 +331,7 @@
 
 %-----------------------------------------------------------------------------%
 
-zero_size_type(Type, Module) :-
+zero_size_type(Module, Type) :-
     type_util.classify_type(Module, Type) = TypeCategory,
     zero_size_type_category(TypeCategory, yes).
 
Index: compiler/term_traversal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.49
diff -u -r1.49 term_traversal.m
--- compiler/term_traversal.m	31 Jul 2006 08:32:05 -0000	1.49
+++ compiler/term_traversal.m	13 Aug 2006 00:30:43 -0000
@@ -245,7 +245,7 @@
         ( ClosureValues0 = ClosureValueMap ^ elem(Var) ->
             ClosureValues = set.to_sorted_list(ClosureValues0),
             % XXX intermod
-            list.filter(terminates(!.ModuleInfo), ClosureValues,
+            list.filter(pred_proc_id_terminates(!.ModuleInfo), ClosureValues,
                 Terminating, NonTerminating),
             ( 
                 NonTerminating = [],
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.50
diff -u -r1.50 term_util.m
--- compiler/term_util.m	31 Jul 2006 08:32:06 -0000	1.50
+++ compiler/term_util.m	13 Aug 2006 00:02:51 -0000
@@ -5,15 +5,15 @@
 % This file may only be copied under the terms of the GNU General
 % Public License - see the file COPYING in the Mercury distribution.
 %-----------------------------------------------------------------------------%
-% 
+%
 % File: term_util.m.
 % Main author: crs.
-% 
+%
 % This module:
 %
 % - defines the types used by termination analysis
 % - defines some utility predicates
-% 
+%
 %-----------------------------------------------------------------------------%
 
 :- module transform_hlds.term_util.
@@ -37,7 +37,7 @@
 %-----------------------------------------------------------------------------%
 %
 % The `arg_size_info' and `termination_info' structures
-% 
+%
 
 % The types `arg_size_info' and `termination_info' hold information about
 % procedures which is used for termination analysis.  These types are stored
@@ -141,10 +141,17 @@
 :- pred attributes_imply_termination(pragma_foreign_proc_attributes::in)
     is semidet.
 
-    % terminates(ModuleInfo, PPId).
+    % pred_proc_id_terminates(ModuleInfo, PPId):
+    %
     % Succeeds iff the procedure given by 'PPId' has been proven to terminate.
     %
-:- pred terminates(module_info::in, pred_proc_id::in) is semidet.
+:- pred pred_proc_id_terminates(module_info::in, pred_proc_id::in) is semidet.
+
+    % Succeed if all arguments of the given procedure of the given predicate
+    % are either input or zero size.
+    %
+:- pred all_args_input_or_zero_size(module_info::in, pred_info::in,
+    proc_info::in) is semidet.
 
 %-----------------------------------------------------------------------------%
 
@@ -227,7 +234,7 @@
     %
 split_unification_vars([], Modes, _, Vars, Vars) :-
     bag.init(Vars),
-    ( 
+    (
         Modes = []
     ;
         Modes = [_|_],
@@ -349,7 +356,7 @@
 %-----------------------------------------------------------------------------%
 
 get_context_from_scc(SCC, ModuleInfo, Context) :-
-    ( 
+    (
         SCC = [proc(PredId, _) | _],
         module_info_pred_info(ModuleInfo, PredId, PredInfo),
         pred_info_context(PredInfo, Context)
@@ -387,13 +394,37 @@
 
 %-----------------------------------------------------------------------------%
 
-terminates(ModuleInfo, PPId) :-
+pred_proc_id_terminates(ModuleInfo, PPId) :-
     module_info_pred_proc_info(ModuleInfo, PPId, _, ProcInfo),
     proc_info_get_maybe_termination_info(ProcInfo, TerminationInfo),
     TerminationInfo = yes(cannot_loop(_)).
 
 %-----------------------------------------------------------------------------%
 
+all_args_input_or_zero_size(ModuleInfo, PredInfo, ProcInfo) :-
+    pred_info_get_arg_types(PredInfo, TypeList),
+    proc_info_get_argmodes(ProcInfo, ModeList),
+    all_args_input_or_zero_size_2(TypeList, ModeList, ModuleInfo).
+
+:- pred all_args_input_or_zero_size_2(list(mer_type)::in, list(mer_mode)::in,
+    module_info::in) is semidet.
+
+all_args_input_or_zero_size_2([], [], _).
+all_args_input_or_zero_size_2([], [_|_], _) :-
+    unexpected(this_file, "all_args_input_or_size_2/3 - unmatched lists.").
+all_args_input_or_zero_size_2([_|_], [], _) :-
+    unexpected(this_file, "all_args_input_or_size_2/3 - unmatched lists.").
+all_args_input_or_zero_size_2([Type | Types], [Mode | Modes], ModuleInfo) :-
+    ( mode_is_input(ModuleInfo, Mode) ->
+        % The variable is an input variables, so its size is irrelevant.
+        all_args_input_or_zero_size_2(Types, Modes, ModuleInfo)
+    ;
+        term_norm.zero_size_type(ModuleInfo, Type),
+        all_args_input_or_zero_size_2(Types, Modes, ModuleInfo)
+    ).
+
+%-----------------------------------------------------------------------------%
+
 :- func this_file = string.
 
 this_file = "term_util.m".
Index: compiler/termination.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/termination.m,v
retrieving revision 1.66
diff -u -r1.66 termination.m
--- compiler/termination.m	31 Jul 2006 08:32:06 -0000	1.66
+++ compiler/termination.m	13 Aug 2006 00:01:42 -0000
@@ -786,31 +786,6 @@
     map.det_update(!.ProcTable, ProcId, ProcInfo, !:ProcTable),
     set_builtin_terminates(ProcIds, PredId, PredInfo, ModuleInfo, !ProcTable).
 
-:- pred all_args_input_or_zero_size(module_info::in, pred_info::in,
-    proc_info::in) is semidet.
-
-all_args_input_or_zero_size(ModuleInfo, PredInfo, ProcInfo) :-
-    pred_info_get_arg_types(PredInfo, TypeList),
-    proc_info_get_argmodes(ProcInfo, ModeList),
-    all_args_input_or_zero_size_2(TypeList, ModeList, ModuleInfo).
-
-:- pred all_args_input_or_zero_size_2(list(mer_type)::in, list(mer_mode)::in,
-    module_info::in) is semidet.
-
-all_args_input_or_zero_size_2([], [], _).
-all_args_input_or_zero_size_2([], [_|_], _) :-
-    unexpected(this_file, "all_args_input_or_size_2/3 - unmatched lists.").
-all_args_input_or_zero_size_2([_|_], [], _) :-
-    unexpected(this_file, "all_args_input_or_size_2/3 - unmatched lists.").
-all_args_input_or_zero_size_2([Type | Types], [Mode | Modes], ModuleInfo) :-
-    ( mode_is_input(ModuleInfo, Mode) ->
-        % The variable is an input variables, so its size is irrelevant.
-        all_args_input_or_zero_size_2(Types, Modes, ModuleInfo)
-    ;
-        zero_size_type(Type, ModuleInfo),
-        all_args_input_or_zero_size_2(Types, Modes, ModuleInfo)
-    ).
-
 %----------------------------------------------------------------------------%
 
     % This predicate sets the arg_size_info property of the given list of
Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.165
diff -u -r1.165 type_util.m
--- compiler/type_util.m	31 Jul 2006 08:32:08 -0000	1.165
+++ compiler/type_util.m	13 Aug 2006 00:58:46 -0000
@@ -364,33 +364,62 @@
     ).
 
 classify_type_ctor(ModuleInfo, TypeCtor) = TypeCategory :-
-    PB = mercury_private_builtin_module,
-    ( TypeCtor = type_ctor(unqualified("character"), 0) ->
-        TypeCategory = type_cat_char
-    ; TypeCtor = type_ctor(unqualified("int"), 0) ->
-        TypeCategory = type_cat_int
-    ; TypeCtor = type_ctor(unqualified("float"), 0) ->
-        TypeCategory = type_cat_float
-    ; TypeCtor = type_ctor(unqualified("string"), 0) ->
-        TypeCategory = type_cat_string
-    ; TypeCtor = type_ctor(unqualified("void"), 0) ->
-        TypeCategory = type_cat_void
-    ; TypeCtor = type_ctor(qualified(PB, "type_info"), 0) ->
-        TypeCategory = type_cat_type_info
-    ; TypeCtor = type_ctor(qualified(PB, "type_ctor_info"), 0) ->
-        TypeCategory = type_cat_type_ctor_info
-    ; TypeCtor = type_ctor(qualified(PB, "typeclass_info"), 0) ->
-        TypeCategory = type_cat_typeclass_info
-    ; TypeCtor = type_ctor(qualified(PB, "base_typeclass_info"), 0) ->
-        TypeCategory = type_cat_base_typeclass_info
-    ; type_ctor_is_higher_order(TypeCtor, _, _, _) ->
-        TypeCategory = type_cat_higher_order
-    ; type_ctor_is_tuple(TypeCtor) ->
-        TypeCategory = type_cat_tuple
-    ; type_ctor_is_enumeration(TypeCtor, ModuleInfo) ->
-        TypeCategory = type_cat_enum
+    TypeCtor = type_ctor(TypeSymName, Arity),
+    (
+        TypeSymName = unqualified(TypeName),
+        Arity = 0,
+        (
+            TypeName = "character",
+            TypeCategoryPrime = type_cat_char
+        ;
+            TypeName = "int",
+            TypeCategoryPrime = type_cat_int
+        ;
+            TypeName = "float",
+            TypeCategoryPrime = type_cat_float
+        ;
+            TypeName = "string",
+            TypeCategoryPrime = type_cat_string
+        ;
+            TypeName = "void",
+            TypeCategoryPrime = type_cat_void
+        )
+    ->
+        TypeCategory = TypeCategoryPrime
     ;
-        TypeCategory = type_cat_user_ctor
+        TypeSymName = qualified(ModuleSymName, TypeName),
+        ModuleSymName = mercury_private_builtin_module,
+        Arity = 0,
+        (
+            TypeName = "type_info",
+            TypeCategoryPrime = type_cat_type_info
+        ;
+            TypeName = "type_ctor_info",
+            TypeCategoryPrime = type_cat_type_ctor_info
+        ;
+            TypeName = "typeclass_info",
+            TypeCategoryPrime = type_cat_typeclass_info
+        ;
+            TypeName = "base_typeclass_info",
+            TypeCategoryPrime = type_cat_base_typeclass_info
+        )
+    ->
+        TypeCategory = TypeCategoryPrime
+    ;
+        TypeSymName = qualified(unqualified(ModuleName), TypeName),
+        is_builtin_dummy_argument_type(ModuleName, TypeName, Arity)
+    ->
+        TypeCategory = type_cat_dummy
+    ;
+        ( type_ctor_is_higher_order(TypeCtor, _, _, _) ->
+            TypeCategory = type_cat_higher_order
+        ; type_ctor_is_tuple(TypeCtor) ->
+            TypeCategory = type_cat_tuple
+        ; type_ctor_is_enumeration(TypeCtor, ModuleInfo) ->
+            TypeCategory = type_cat_enum
+        ;
+            TypeCategory = type_cat_user_ctor
+        )
     ).
 
 type_has_user_defined_equality_pred(ModuleInfo, Type, UserEqComp) :-
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
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/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/gator
cvs diff: Diffing extras/gator/generations
cvs diff: Diffing extras/gator/generations/1
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
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/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
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/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.160
diff -u -r1.160 private_builtin.m
--- library/private_builtin.m	1 Aug 2006 00:45:59 -0000	1.160
+++ library/private_builtin.m	11 Aug 2006 16:35:27 -0000
@@ -1539,8 +1539,14 @@
 
 :- interface.
 
+:- import_module io.
+
 :- semipure pred trace_evaluate_runtime_condition is semidet.
 
+:- semipure pred trace_get_io_state(io::uo) is det.
+
+:- impure pred trace_set_io_state(io::di) is det.
+
 :- implementation.
 
 :- pragma foreign_proc("C",
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.163
diff -u -r1.163 mercury_wrapper.c
--- runtime/mercury_wrapper.c	7 Aug 2006 06:21:31 -0000	1.163
+++ runtime/mercury_wrapper.c	13 Aug 2006 06:03:35 -0000
@@ -91,7 +91,7 @@
 #else
   size_t    MR_heap_size =              8192 * sizeof(MR_Word);
 #endif
-size_t      MR_detstack_size =          1024 * sizeof(MR_Word);
+size_t      MR_detstack_size =          2024 * sizeof(MR_Word);
 size_t      MR_nondstack_size =           64 * sizeof(MR_Word);
 size_t      MR_solutions_heap_size =     256 * sizeof(MR_Word);
 size_t      MR_global_heap_size =        256 * sizeof(MR_Word);
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 slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/par_conj
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list