[m-rev.] for review: fix --optimize-constructor-last-call
Zoltan Somogyi
zs at csse.unimelb.edu.au
Fri Jan 19 16:05:23 AEDT 2007
For review by anyone.
I speed tested the now fixed --optimize-constructor-last-call, with and
without the null option. The results were quite weird:
EXTRA_MCFLAGS = -n- -O2
GRADE = asm_fast.gc
mercury_compile.01 average of 6 with ignore=1 19.68
EXTRA_MCFLAGS = -n- -O2 --optimize-constructor-last-call
GRADE = asm_fast.gc
mercury_compile.02 average of 6 with ignore=1 21.25
EXTRA_MCFLAGS = -n- -O2 --optimize-constructor-last-call --optimize-constructor-last-call-null
GRADE = asm_fast.gc
mercury_compile.03 average of 6 with ignore=1 21.27
EXTRA_MCFLAGS = -n- -O3
GRADE = asm_fast.gc
mercury_compile.04 average of 6 with ignore=1 20.39
EXTRA_MCFLAGS = -n- -O3 --optimize-constructor-last-call
GRADE = asm_fast.gc
mercury_compile.05 average of 6 with ignore=1 19.48
EXTRA_MCFLAGS = -n- -O3 --optimize-constructor-last-call --optimize-constructor-last-call-null
GRADE = asm_fast.gc
mercury_compile.06 average of 6 with ignore=1 20.13
EXTRA_MCFLAGS = -n- -O4
GRADE = asm_fast.gc
mercury_compile.07 average of 6 with ignore=1 19.61
EXTRA_MCFLAGS = -n- -O4 --optimize-constructor-last-call
GRADE = asm_fast.gc
mercury_compile.08 average of 6 with ignore=1 19.75
EXTRA_MCFLAGS = -n- -O4 --optimize-constructor-last-call --optimize-constructor-last-call-null
GRADE = asm_fast.gc
mercury_compile.09 average of 6 with ignore=1 19.14
It seems that at --optimize-constructor-last-call is a slowdown at -O2,
a speedup at -O3, and either a slowdown or a speedup, depending on nulling,
at -O4. Without --optimize-constructor-last-call, -O3 is slower than -O2.
I'll look at all this weirdness later; the fix is first.
Zoltan.
Fix a bug that caused bootchecks with --optimize-constructor-last-call to fail.
The problem was not in lco.m, but in follow_code.m. In some cases,
(specifically, the LCMC version of insert_2 in sparse_bitset.m),
follow_code.m moved an impure goal (store_at_ref) into the arms of an
if-then-else without marking those arms, or the if-then-else, as impure.
The next pass, simplify, then deleted the entire if-then-else, since it
had no outputs. (The store_at_ref that originally appeared after the
if-then-else was the only consumer of its only output.)
The fix is to get follow_code.m to make branched control structures such as
if-then-elses, as well as their arms, semipure or impure if a goal being moved
into them is semipure or impure, or if they came from an semipure or impure
conjunction.
Improve the optimization of the LCMC version of sparse_bitset.insert_2, which
had a foreign_proc invocation of bits_per_int in it: replace such invocations
with a unification of the bits_per_int constant if not cross compiling.
Add a new option, --optimize-constructor-last-call-null. When set, LCMC will
assign NULLs to the fields not yet filled in, to avoid any junk happens to be
there from being followed by the garbage collector's mark phase.
This diff also makes several other changes that helped me to track down
the bug above.
compiler/follow_code.m:
Make the fix described above.
Delete all the provisions for --prev-code; it won't be implemented.
Don't export a predicate that is not now used anywhere else.
compiler/simplify.m:
Make the optimization described above.
compiler/lco.m:
Make sure that the LCMC specialized procedure is a predicate, not a
function: having a function with the mode LCMC_insert_2(in, in) = in
looks wrong.
To avoid name collisions when a function and a predicate with the same
name and arity have LCMC applied to them, include the predicate vs
function status of the original procedure included in the name of the
new procedure.
Update the sym_name of calls to LCMC variants, not just the pred_id,
because without that, the HLDS dump looks misleading.
compiler/pred_table.m:
Don't have optimizations like LCMC insert new predicates at the front
of the list of predicates. Maintain the list of predicates in the
module as a two part list, to allow efficient addition of new pred_ids
at the (logical) end without using O(N^2) algorithms. Having predicates
in chronological order makes it easier to look at HLDS dumps and
.c files.
compiler/hlds_module.m:
Make module_info_predids return a module_info that is physically
updated though logically unchanged.
compiler/options.m:
Add --optimize-constructor-last-call-null.
Make the options --dump-hlds-pred-id, --debug-opt-pred-id and
--debug-opt-pred-name into accumulating options, to allow the user
to specify more than one predicate to be dumped (e.g. insert_2 and
its LCMC variant).
Delete --prev-code.
doc/user_guide.texi:
Document the changes in options.m.
compiler/code_info.m:
Record the value of --optimize-constructor-last-call-null in the
code_info, to avoid lookup at every cell construction.
compiler/unify_gen.m:
compiler/var_locn.m:
When deciding whether a cell can be static or not, make sure that
we never make static a cell that has some fields initialized with
dummy zeros, to be filled in for real later.
compiler/hlds_out.m:
For goals that are semipure or impure, note this fact. This info was
lost when I changed the representation of impurity from markers to a
field.
mdbcomp/prim_data.m:
Rename some ambiguous function symbols.
compiler/intermod.m:
compiler/trans_opt.m:
Rename the main predicates (and some function symbols) of these modules
to avoid ambiguity and to make them more expressive.
compiler/llds.m:
Don't print line numbers for foreign_code fragments if the user has
specified --no-line-numbers.
compiler/make.dependencies.m:
compiler/mercury_to_mercury.m:
compiler/recompilation.usage.m:
Don't use io.write to write out information to files we may need to
parse again, because this is vulnerable to changes to the names of
function symbols (e.g. the one to mdbcomp/prim_data.m).
The compiler still contains some uses of io.write, but they are
for debugging. I added an item to the todo list of the one exception,
ilasm.m.
compiler/recompilation.m:
Rename a misleading function symbol name.
compiler/parse_tree.m:
Don't import recompilation.m here. It is not needed (all the components
of parse_tree that need recompilation.m already import it themselves),
and deleting the import avoids recompiling almost everything when
recompilation.m changes.
compiler/*.m:
Conform to the changes above.
compiler/*.m:
browser/*.m:
slice/*.m:
Conform to the change to mdbcomp.
library/sparse_bitset.m:
Use some better variable names.
doc/user_guide.texi:
Document 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
Index: browser/declarative_analyser.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_analyser.m,v
retrieving revision 1.36
diff -u -b -r1.36 declarative_analyser.m
--- browser/declarative_analyser.m 1 Dec 2006 15:03:43 -0000 1.36
+++ browser/declarative_analyser.m 17 Jan 2007 06:47:36 -0000
@@ -1208,10 +1208,10 @@
LineNoStr = int_to_string(LineNo),
get_pred_attributes(ProcLabel, SymModule, Name, Arity, PredOrFunc),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
PredOrFuncStr = "function"
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
PredOrFuncStr = "predicate"
),
Module = sym_name_to_string(SymModule),
Index: browser/declarative_execution.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_execution.m,v
retrieving revision 1.56
diff -u -b -r1.56 declarative_execution.m
--- browser/declarative_execution.m 1 Dec 2006 15:03:43 -0000 1.56
+++ browser/declarative_execution.m 17 Jan 2007 06:47:41 -0000
@@ -483,7 +483,7 @@
ProcId = ordinary_proc_label(Module, PredOrFunc, _, Name, Arity, _)
;
ProcId = special_proc_label(Module, SpecialId, _, _, _, _),
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Arity = get_special_pred_id_arity(SpecialId),
Name = get_special_pred_id_target_name(SpecialId)
).
Index: browser/declarative_oracle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_oracle.m,v
retrieving revision 1.56
diff -u -b -r1.56 declarative_oracle.m
--- browser/declarative_oracle.m 1 Dec 2006 15:03:44 -0000 1.56
+++ browser/declarative_oracle.m 17 Jan 2007 06:48:01 -0000
@@ -348,15 +348,15 @@
Name, Arity, _)
;
ProcLabel = special_proc_label(ModuleName, _, _, Name, Arity, _),
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
),
(
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
bimap.insert(!.Oracle ^ trusted,
trusted_predicate(ModuleName, Name, Arity), Id, Trusted)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
bimap.insert(!.Oracle ^ trusted,
trusted_function(ModuleName, Name, Arity), Id, Trusted)
)
@@ -539,10 +539,10 @@
;
bimap.search(Trusted, trusted_module(Module), _)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
bimap.search(Trusted, trusted_predicate(Module, Name, Arity), _)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
bimap.search(Trusted, trusted_function(Module, Name, Arity), _)
)
;
Index: browser/declarative_tree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_tree.m,v
retrieving revision 1.49
diff -u -b -r1.49 declarative_tree.m
--- browser/declarative_tree.m 6 Jan 2007 10:56:07 -0000 1.49
+++ browser/declarative_tree.m 17 Jan 2007 06:48:08 -0000
@@ -453,8 +453,8 @@
missing_answer_special_case(Atom) :-
ProcLabel = get_proc_label_from_layout(Atom ^ proc_layout),
- ProcLabel = ordinary_proc_label(StdUtilModule1, predicate, StdUtilModule2,
- "builtin_aggregate", 4, _),
+ ProcLabel = ordinary_proc_label(StdUtilModule1, pf_predicate,
+ StdUtilModule2, "builtin_aggregate", 4, _),
possible_sym_library_module_name("solutions", StdUtilModule1),
possible_sym_library_module_name("solutions", StdUtilModule2).
Index: browser/declarative_user.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/declarative_user.m,v
retrieving revision 1.66
diff -u -b -r1.66 declarative_user.m
--- browser/declarative_user.m 2 Oct 2006 05:21:03 -0000 1.66
+++ browser/declarative_user.m 17 Jan 2007 06:48:20 -0000
@@ -688,7 +688,7 @@
ProcLabel = get_proc_label_from_layout(ProcLayout),
get_user_arg_values(Args, ArgValues),
get_pred_attributes(ProcLabel, Module, Name, _, PredOrFunc),
- IsFunction = pred_to_bool(unify(PredOrFunc, function)),
+ IsFunction = pred_to_bool(unify(PredOrFunc, pf_function)),
ModuleStr = sym_name_to_string(Module),
BrowserTerm = synthetic_term_to_browser_term(ModuleStr ++ "." ++ Name,
ArgValues, IsFunction),
@@ -707,7 +707,7 @@
ProcLabel = get_proc_label_from_layout(ProcLayout),
get_user_arg_values(Args, ArgValues),
get_pred_attributes(ProcLabel, Module, Name, _, PredOrFunc),
- IsFunction = pred_to_bool(unify(PredOrFunc, function)),
+ IsFunction = pred_to_bool(unify(PredOrFunc, pf_function)),
ModuleStr = sym_name_to_string(Module),
BrowserTerm = synthetic_term_to_browser_term(ModuleStr ++ "." ++ Name,
ArgValues, IsFunction),
Index: browser/io_action.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/io_action.m,v
retrieving revision 1.15
diff -u -b -r1.15 io_action.m
--- browser/io_action.m 1 Dec 2006 15:03:44 -0000 1.15
+++ browser/io_action.m 17 Jan 2007 06:48:32 -0000
@@ -74,10 +74,10 @@
io_action_to_browser_term(IoAction) = Term :-
IoAction = io_action(ProcName, PredFunc, Args),
(
- PredFunc = predicate,
+ PredFunc = pf_predicate,
IsFunc = no
;
- PredFunc = function,
+ PredFunc = pf_function,
IsFunc = yes
),
Term = synthetic_term_to_browser_term(ProcName, Args, IsFunc).
@@ -124,9 +124,9 @@
"MR_IO_ACTION_make_yes_io_action").
make_yes_io_action(ProcName, yes, Args) =
- yes(io_action(ProcName, function, Args)).
+ yes(io_action(ProcName, pf_function, Args)).
make_yes_io_action(ProcName, no, Args) =
- yes(io_action(ProcName, predicate, Args)).
+ yes(io_action(ProcName, pf_predicate, Args)).
pickup_io_action(_, _, _, _) :-
private_builtin.sorry("pickup_io_action").
Index: browser/util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/browser/util.m,v
retrieving revision 1.33
diff -u -b -r1.33 util.m
--- browser/util.m 1 Dec 2006 15:03:44 -0000 1.33
+++ browser/util.m 17 Jan 2007 06:48:44 -0000
@@ -60,11 +60,11 @@
:- import_module require.
-is_predicate(predicate) = yes.
-is_predicate(function) = no.
+is_predicate(pf_predicate) = yes.
+is_predicate(pf_function) = no.
-is_function(predicate) = no.
-is_function(function) = yes.
+is_function(pf_predicate) = no.
+is_function(pf_function) = yes.
trace_getline(Prompt, Result, !IO) :-
io.input_stream(MdbIn, !IO),
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/add_class.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_class.m,v
retrieving revision 1.25
diff -u -b -r1.25 add_class.m
--- compiler/add_class.m 21 Dec 2006 06:33:55 -0000 1.25
+++ compiler/add_class.m 17 Jan 2007 07:08:04 -0000
@@ -422,7 +422,7 @@
->
module_info_pred_info(!.ModuleInfo, PredId, PredInfo0),
(
- PorF = function,
+ PorF = pf_function,
maybe_add_default_func_mode(PredInfo0, PredInfo, MaybeProc),
(
MaybeProc = no
@@ -433,7 +433,7 @@
module_info_set_pred_info(PredId, PredInfo, !ModuleInfo)
)
;
- PorF = predicate,
+ PorF = pf_predicate,
pred_info_get_procedures(PredInfo0, Procs),
( map.is_empty(Procs) ->
pred_method_with_no_modes_error(PredInfo0, !Specs)
Index: compiler/add_clause.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_clause.m,v
retrieving revision 1.41
diff -u -b -r1.41 add_clause.m
--- compiler/add_clause.m 6 Jan 2007 09:23:23 -0000 1.41
+++ compiler/add_clause.m 17 Jan 2007 07:08:04 -0000
@@ -191,8 +191,8 @@
% User-supplied clauses for field access functions are not allowed
% -- the clauses are always generated by the compiler.
%
- PredOrFunc = function,
- adjust_func_arity(function, FuncArity, Arity),
+ PredOrFunc = pf_function,
+ adjust_func_arity(pf_function, FuncArity, Arity),
is_field_access_function_name(!.ModuleInfo, PredName, FuncArity,
_, _),
@@ -850,7 +850,7 @@
Modes = [],
Det = detism_erroneous,
- GenericCall = higher_order(PredVar, Purity, predicate, Arity),
+ GenericCall = higher_order(PredVar, Purity, pf_predicate, Arity),
Call = generic_call(GenericCall, RealHeadVars, Modes, Det),
hlds_goal.generic_call_id(GenericCall, CallId)
@@ -862,13 +862,13 @@
MaybeUnifyContext = no,
Call = plain_call(PredId, ModeId, HeadVars, not_builtin,
MaybeUnifyContext, Name),
- CallId = plain_call_id(simple_call_id(predicate, Name, Arity))
+ CallId = plain_call_id(simple_call_id(pf_predicate, Name, Arity))
),
goal_info_init(Context, GoalInfo0),
goal_info_set_purity(Purity, GoalInfo0, GoalInfo),
Goal0 = hlds_goal(Call, GoalInfo),
- record_called_pred_or_func(predicate, Name, Arity, !QualInfo),
+ record_called_pred_or_func(pf_predicate, Name, Arity, !QualInfo),
insert_arg_unifications(HeadVars, Args, Context, ac_call(CallId),
Goal0, Goal, NumAdded, !VarSet, !ModuleInfo, !QualInfo,
!SInfo, !Specs),
@@ -1107,7 +1107,7 @@
% DCG arguments should always be distinct variables,
% so this context should never be used.
OutputTermArgNumber = 3,
- SimpleCallId = simple_call_id(function, FuncName, FuncArity),
+ SimpleCallId = simple_call_id(pf_function, FuncName, FuncArity),
OutputTermArgContext = ac_call(plain_call_id(SimpleCallId)),
ArgContexts = [
@@ -1135,7 +1135,7 @@
unexpected(this_file, "transform_dcg_record_syntax_2")
),
FieldArgNumber = 2,
- SimpleCallId = simple_call_id(function, FuncName, FuncArity),
+ SimpleCallId = simple_call_id(pf_function, FuncName, FuncArity),
FieldArgContext = ac_call(plain_call_id(SimpleCallId)),
% DCG arguments should always be distinct variables,
Index: compiler/add_heap_ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_heap_ops.m,v
retrieving revision 1.33
diff -u -b -r1.33 add_heap_ops.m
--- compiler/add_heap_ops.m 6 Jan 2007 09:23:23 -0000 1.33
+++ compiler/add_heap_ops.m 17 Jan 2007 07:08:04 -0000
@@ -348,7 +348,7 @@
generate_call(PredName, Detism, Purity, Args, InstMap, ModuleInfo, Context,
CallGoal) :-
BuiltinModule = mercury_private_builtin_module,
- goal_util.generate_simple_call(BuiltinModule, PredName, predicate,
+ goal_util.generate_simple_call(BuiltinModule, PredName, pf_predicate,
only_mode, Detism, Purity, Args, [], InstMap, ModuleInfo,
Context, CallGoal).
Index: compiler/add_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pragma.m,v
retrieving revision 1.59
diff -u -b -r1.59 add_pragma.m
--- compiler/add_pragma.m 6 Jan 2007 09:23:24 -0000 1.59
+++ compiler/add_pragma.m 17 Jan 2007 07:08:04 -0000
@@ -1054,10 +1054,10 @@
!Specs) :-
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Decl = "`:- pred'"
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Decl = "`:- func'"
),
Pieces = pragma_type_spec_to_pieces(PredInfo) ++
@@ -1693,7 +1693,7 @@
module_info_get_name(!.ModuleInfo, ModuleName),
string.format("`:- pragma %s' declaration", [s(EvalMethodStr)],
Message1),
- preds_add_implicit_report_error(ModuleName, predicate, PredName,
+ preds_add_implicit_report_error(ModuleName, pf_predicate, PredName,
Arity, !.Status, no, Context, origin_user(PredName), Message1,
PredId, !ModuleInfo, !Specs),
PredIds = [PredId]
@@ -2045,7 +2045,7 @@
Condition = cond_true,
Origin = compiler(pragma_memo_attribute),
StatsPredDecl = item_pred_or_func(Origin, VarSet0, InstVarSet, ExistQVars,
- predicate, StatsPredSymName, ArgDecls, WithType, WithInst,
+ pf_predicate, StatsPredSymName, ArgDecls, WithType, WithInst,
yes(detism_det), Condition, purity_pure, Constraints),
ItemStatus0 = item_status(!.Status, may_be_unqualified),
add_item_decl_pass_1(StatsPredDecl, Context, ItemStatus0, _,
@@ -2070,7 +2070,7 @@
Global = table_info_global_var_name(!.ModuleInfo, SimpleCallId,
ProcId),
StatsPredClause = item_pragma(compiler(pragma_memo_attribute),
- pragma_foreign_proc(!.Attrs, StatsPredSymName, predicate,
+ pragma_foreign_proc(!.Attrs, StatsPredSymName, pf_predicate,
[Arg1, Arg2, Arg3], !.VarSet, InstVarSet,
fc_impl_ordinary(
"MR_get_tabling_stats(&" ++ Global ++ ", &Stats);",
@@ -2102,7 +2102,7 @@
Condition = cond_true,
Origin = compiler(pragma_memo_attribute),
ResetPredDecl = item_pred_or_func(Origin, VarSet0, InstVarSet, ExistQVars,
- predicate, ResetPredSymName, ArgDecls, WithType, WithInst,
+ pf_predicate, ResetPredSymName, ArgDecls, WithType, WithInst,
yes(detism_det), Condition, purity_pure, Constraints),
ItemStatus0 = item_status(!.Status, may_be_unqualified),
add_item_decl_pass_1(ResetPredDecl, Context, ItemStatus0, _,
@@ -2122,7 +2122,7 @@
Global = table_info_global_var_name(!.ModuleInfo, SimpleCallId,
ProcId),
ResetPredClause = item_pragma(compiler(pragma_memo_attribute),
- pragma_foreign_proc(!.Attrs, ResetPredSymName, predicate,
+ pragma_foreign_proc(!.Attrs, ResetPredSymName, pf_predicate,
[Arg1, Arg2], !.VarSet, InstVarSet,
fc_impl_ordinary(
Global ++ ".MR_pt_tablenode.MR_integer = 0;",
@@ -2147,10 +2147,10 @@
tabling_pred_name(Prefix, SimpleCallId, ProcId, SingleProc) = NewSymName :-
SimpleCallId = simple_call_id(PorF, SymName, Arity0),
(
- PorF = predicate,
+ PorF = pf_predicate,
Arity = Arity0
;
- PorF = function,
+ PorF = pf_function,
Arity = Arity0 - 1
),
(
Index: compiler/add_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_pred.m,v
retrieving revision 1.28
diff -u -b -r1.28 add_pred.m
--- compiler/add_pred.m 6 Jan 2007 09:23:24 -0000 1.28
+++ compiler/add_pred.m 17 Jan 2007 07:17:19 -0000
@@ -99,7 +99,7 @@
add_new_pred(TypeVarSet, ExistQVars, PredName, Types, Purity, ClassContext,
Markers, Context, Status, NeedQual, PredOrFunc, !ModuleInfo, !Specs),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
MaybeModes0 = yes(Modes0),
% For predicates with no arguments, if the determinism is not declared
@@ -112,12 +112,12 @@
;
% Assume that a function with no modes but with a determinism
% declared has the default modes.
- PredOrFunc = function,
+ PredOrFunc = pf_function,
MaybeModes0 = no,
MaybeDet = yes(_)
->
list.length(Types, Arity),
- adjust_func_arity(function, FuncArity, Arity),
+ adjust_func_arity(pf_function, FuncArity, Arity),
in_mode(InMode),
list.duplicate(FuncArity, InMode, InModes),
out_mode(OutMode),
@@ -422,12 +422,12 @@
maybe_undefined_pred_error(Globals, PredName, Arity, PredOrFunc,
Status, IsClassMethod, Context, Description, !Specs),
(
- PredOrFunc = function,
- adjust_func_arity(function, FuncArity, Arity),
+ PredOrFunc = pf_function,
+ adjust_func_arity(pf_function, FuncArity, Arity),
maybe_check_field_access_function(PredName, FuncArity, Status, Context,
!.ModuleInfo, !Specs)
;
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
),
module_info_get_predicate_table(!.ModuleInfo, PredicateTable0),
preds_add_implicit(!.ModuleInfo, ModuleName, PredName, Arity, Status,
Index: compiler/add_solver.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_solver.m,v
retrieving revision 1.19
diff -u -b -r1.19 add_solver.m
--- compiler/add_solver.m 1 Dec 2006 15:03:49 -0000 1.19
+++ compiler/add_solver.m 17 Jan 2007 07:08:04 -0000
@@ -104,7 +104,7 @@
ToGroundRepnArgTypes =
[type_and_mode(SolverType, in_mode ),
type_and_mode(RepnType, OutGroundMode)],
- module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, function,
+ module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, pf_function,
ToGroundRepnSymName, ToGroundRepnArgTypes, yes(detism_det),
purity_impure, constraints([], []), NoMarkers, Context, !.Status, _,
!ModuleInfo, !Specs),
@@ -117,7 +117,7 @@
ToAnyRepnArgTypes =
[type_and_mode(SolverType, in_any_mode ),
type_and_mode(RepnType, OutAnyMode)],
- module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, function,
+ module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, pf_function,
ToAnyRepnSymName, ToAnyRepnArgTypes, yes(detism_det),
purity_impure, constraints([], []), NoMarkers, Context, !.Status, _,
!ModuleInfo, !Specs),
@@ -130,7 +130,7 @@
FromGroundRepnArgTypes =
[type_and_mode(RepnType, InGroundMode ),
type_and_mode(SolverType, out_mode )],
- module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, function,
+ module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, pf_function,
FromGroundRepnSymName, FromGroundRepnArgTypes, yes(detism_det),
purity_impure, constraints([], []), NoMarkers, Context, !.Status, _,
!ModuleInfo, !Specs),
@@ -143,7 +143,7 @@
FromAnyRepnArgTypes =
[type_and_mode(RepnType, InAnyMode ),
type_and_mode(SolverType, out_any_mode)],
- module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, function,
+ module_add_pred_or_func(TVarSet, InstVarSet, ExistQTVars, pf_function,
FromAnyRepnSymName, FromAnyRepnArgTypes, yes(detism_det),
purity_impure, constraints([], []), NoMarkers, Context, !.Status, _,
!ModuleInfo, !Specs).
@@ -220,7 +220,7 @@
pragma_foreign_proc(
Attrs,
ToGroundRepnSymName,
- function,
+ pf_function,
ToGroundRepnArgs,
ProgVarSet,
InstVarSet,
@@ -241,7 +241,7 @@
pragma_foreign_proc(
Attrs,
ToAnyRepnSymName,
- function,
+ pf_function,
ToAnyRepnArgs,
ProgVarSet,
InstVarSet,
@@ -261,7 +261,7 @@
pragma_foreign_proc(
Attrs,
FromGroundRepnSymName,
- function,
+ pf_function,
FromGroundRepnArgs,
ProgVarSet,
InstVarSet,
@@ -282,7 +282,7 @@
pragma_foreign_proc(
Attrs,
FromAnyRepnSymName,
- function,
+ pf_function,
FromAnyRepnArgs,
ProgVarSet,
InstVarSet,
Index: compiler/add_special_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_special_pred.m,v
retrieving revision 1.18
diff -u -b -r1.18 add_special_pred.m
--- compiler/add_special_pred.m 21 Dec 2006 06:33:56 -0000 1.18
+++ compiler/add_special_pred.m 17 Jan 2007 07:08:04 -0000
@@ -363,7 +363,7 @@
% XXX we probably shouldn't hardcode this as predicate but since
% all current special_preds are predicates at the moment it doesn't
% matter.
- clauses_info_init(predicate, Arity, ClausesInfo0),
+ clauses_info_init(pf_predicate, Arity, ClausesInfo0),
Origin = origin_special_pred(SpecialPredId - TypeCtor),
adjust_special_pred_status(SpecialPredId, Status0, Status),
map.init(Proofs),
@@ -373,7 +373,7 @@
% XXX this context might not be empty
ClassContext = constraints([], []),
ExistQVars = [],
- pred_info_init(ModuleName, PredName, Arity, predicate, Context,
+ pred_info_init(ModuleName, PredName, Arity, pf_predicate, Context,
Origin, Status, goal_type_none, Markers, ArgTypes, TVarSet, ExistQVars,
ClassContext, Proofs, ConstraintMap, ClausesInfo0, PredInfo0),
ArgLives = no,
Index: compiler/add_trail_ops.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_trail_ops.m,v
retrieving revision 1.45
diff -u -b -r1.45 add_trail_ops.m
--- compiler/add_trail_ops.m 6 Jan 2007 09:23:24 -0000 1.45
+++ compiler/add_trail_ops.m 17 Jan 2007 07:08:04 -0000
@@ -180,7 +180,7 @@
% `private_builtin.unused' (which will call error/1) rather than
% `fail' for the "then" part.
PrivateBuiltin = mercury_private_builtin_module,
- generate_simple_call(PrivateBuiltin, "unused", predicate, only_mode,
+ generate_simple_call(PrivateBuiltin, "unused", pf_predicate, only_mode,
detism_det, purity_pure, [], [], [], ModuleInfo, Context, ThenGoal)
;
ThenGoal = Fail
@@ -620,7 +620,7 @@
trail_generate_call(PredName, Detism, Purity, Args, InstMap, ModuleInfo,
Context, CallGoal) :-
BuiltinModule = mercury_private_builtin_module,
- goal_util.generate_simple_call(BuiltinModule, PredName, predicate,
+ goal_util.generate_simple_call(BuiltinModule, PredName, pf_predicate,
only_mode, Detism, Purity, Args, [], InstMap, ModuleInfo, Context,
CallGoal).
@@ -644,7 +644,7 @@
ExtraArgs = [],
MaybeTraceRuntimeCond = no,
goal_util.generate_foreign_proc(PrivateBuiltinModule, PredName,
- predicate, only_mode, Detism, Purity, FinalForeignProcAttrs, Args,
+ pf_predicate, only_mode, Detism, Purity, FinalForeignProcAttrs, Args,
ExtraArgs, MaybeTraceRuntimeCond, ForeignCode, [], InstMap,
ModuleInfo, Context, ForeignProcGoal).
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.111
diff -u -b -r1.111 bytecode_gen.m
--- compiler/bytecode_gen.m 6 Jan 2007 09:23:25 -0000 1.111
+++ compiler/bytecode_gen.m 17 Jan 2007 07:16:59 -0000
@@ -26,7 +26,7 @@
%---------------------------------------------------------------------------%
-:- pred gen_module(module_info::in, list(byte_code)::out,
+:- pred gen_module(module_info::in, module_info::out, list(byte_code)::out,
io::di, io::uo) is det.
%---------------------------------------------------------------------------%
@@ -82,9 +82,9 @@
%---------------------------------------------------------------------------%
-gen_module(ModuleInfo, Code, !IO) :-
- module_info_predids(ModuleInfo, PredIds),
- gen_preds(PredIds, ModuleInfo, CodeTree, !IO),
+gen_module(!ModuleInfo, Code, !IO) :-
+ module_info_predids(PredIds, !ModuleInfo),
+ gen_preds(PredIds, !.ModuleInfo, CodeTree, !IO),
tree.flatten(CodeTree, CodeList),
list.condense(CodeList, Code).
@@ -901,9 +901,12 @@
:- pred get_is_func(pred_info::in, byte_is_func::out) is det.
get_is_func(PredInfo, IsFunc) :-
- ( pred_info_is_pred_or_func(PredInfo) = predicate ->
+ PredOrFunc = pred_info_is_pred_or_func(PredInfo),
+ (
+ PredOrFunc = pf_predicate,
IsFunc = 0
;
+ PredOrFunc = pf_function,
IsFunc = 1
).
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.110
diff -u -b -r1.110 check_typeclass.m
--- compiler/check_typeclass.m 10 Jan 2007 16:28:19 -0000 1.110
+++ compiler/check_typeclass.m 17 Jan 2007 07:08:04 -0000
@@ -1226,7 +1226,7 @@
list(error_spec)::in, list(error_spec)::out) is det.
check_typeclass_constraints(!ModuleInfo, !Specs) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl2(check_pred_constraints, PredIds, !ModuleInfo, !Specs),
module_info_get_type_table(!.ModuleInfo, TypeTable),
map.keys(TypeTable, TypeCtors),
@@ -1730,10 +1730,10 @@
words(choose_number(Vars, "is", "are")),
words("not determined by the")],
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Pieces = Pieces0 ++ [words("predicate's argument types."), nl]
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Pieces = Pieces0 ++ [words("function's argument or result types."), nl]
),
Msg = simple_msg(Context,
Index: compiler/clause_to_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/clause_to_proc.m,v
retrieving revision 1.76
diff -u -b -r1.76 clause_to_proc.m
--- compiler/clause_to_proc.m 6 Jan 2007 09:23:25 -0000 1.76
+++ compiler/clause_to_proc.m 17 Jan 2007 07:08:04 -0000
@@ -108,7 +108,7 @@
%
% Is this a function with no modes?
%
- PredOrFunc = function,
+ PredOrFunc = pf_function,
map.is_empty(Procs0)
->
%
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.343
diff -u -b -r1.343 code_info.m
--- compiler/code_info.m 15 Jan 2007 02:23:44 -0000 1.343
+++ compiler/code_info.m 18 Jan 2007 02:01:16 -0000
@@ -216,6 +216,8 @@
:- pred get_auto_comments(code_info::in, bool::out) is det.
+:- pred get_lcmc_null(code_info::in, bool::out) is det.
+
%---------------------------------------------------------------------------%
:- implementation.
@@ -348,8 +350,12 @@
% Should we try to avoid emiting trail
% operations?
- auto_comments :: bool
+ auto_comments :: bool,
% The setting of --auto-comments.
+
+ lcmc_null :: bool
+ % The setting of --optimize-constructor-
+ % last-call-null.
).
:- type code_info_loc_dep
@@ -517,6 +523,8 @@
),
globals.lookup_bool_option(Globals, optimize_trail_usage, OptTrailOps),
globals.lookup_bool_option(Globals, auto_comments, AutoComments),
+ globals.lookup_bool_option(Globals, optimize_constructor_last_call_null,
+ LCMCNull),
CodeInfo0 = code_info(
code_info_static(
Globals,
@@ -531,7 +539,8 @@
OptNoReturnCalls,
EmitTrailOps,
OptTrailOps,
- AutoComments
+ AutoComments,
+ LCMCNull
),
code_info_loc_dep(
Liveness,
@@ -595,6 +604,7 @@
get_emit_trail_ops(CI, CI ^ code_info_static ^ emit_trail_ops).
get_opt_trail_ops(CI, CI ^ code_info_static ^ opt_trail_ops).
get_auto_comments(CI, CI ^ code_info_static ^ auto_comments).
+get_lcmc_null(CI, CI ^ code_info_static ^ lcmc_null).
get_forward_live_vars(CI, CI ^ code_info_loc_dep ^ forward_live_vars).
get_instmap(CI, CI ^ code_info_loc_dep ^ instmap).
get_zombies(CI, CI ^ code_info_loc_dep ^ zombies).
@@ -3150,12 +3160,12 @@
:- pred assign_expr_to_var(prog_var::in, rval::in, code_tree::out,
code_info::in, code_info::out) is det.
- % assign_cell_to_var(Var, ReserveWordAtStart, Ptag, Vector,
- % MaybeSize, TypeMsg, MayUseAtomic, Where, Code, !CI).
+ % assign_cell_to_var(Var, ReserveWordAtStart, Ptag, MaybeRvals, MaybeSize,
+ % FieldAddrs, TypeMsg, MayUseAtomic, Where, Code, !CI).
%
:- pred assign_cell_to_var(prog_var::in, bool::in, tag::in,
- list(maybe(rval))::in, maybe(term_size_value)::in, string::in,
- may_use_atomic_alloc::in, code_tree::out,
+ list(maybe(rval))::in, maybe(term_size_value)::in, list(int)::in,
+ string::in, may_use_atomic_alloc::in, code_tree::out,
code_info::in, code_info::out) is det.
:- pred place_var(prog_var::in, lval::in, code_tree::out,
@@ -3293,13 +3303,13 @@
),
set_var_locn_info(VarLocnInfo, !CI).
-assign_cell_to_var(Var, ReserveWordAtStart, Ptag, Vector, MaybeSize,
- TypeMsg, MayUseAtomic, Code, !CI) :-
+assign_cell_to_var(Var, ReserveWordAtStart, Ptag, MaybeRvals, MaybeSize,
+ FieldAddrs, TypeMsg, MayUseAtomic, Code, !CI) :-
get_var_locn_info(!.CI, VarLocnInfo0),
get_static_cell_info(!.CI, StaticCellInfo0),
get_module_info(!.CI, ModuleInfo),
var_locn_assign_cell_to_var(ModuleInfo, Var, ReserveWordAtStart, Ptag,
- Vector, MaybeSize, TypeMsg, MayUseAtomic, Code,
+ MaybeRvals, MaybeSize, FieldAddrs, TypeMsg, MayUseAtomic, Code,
StaticCellInfo0, StaticCellInfo, VarLocnInfo0, VarLocnInfo),
set_static_cell_info(StaticCellInfo, !CI),
set_var_locn_info(VarLocnInfo, !CI).
Index: compiler/complexity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/complexity.m,v
retrieving revision 1.27
diff -u -b -r1.27 complexity.m
--- compiler/complexity.m 6 Jan 2007 09:23:27 -0000 1.27
+++ compiler/complexity.m 17 Jan 2007 07:27:44 -0000
@@ -494,7 +494,7 @@
Attrs0 = default_attributes(lang_c),
set_may_call_mercury(proc_will_not_call_mercury, Attrs0, Attrs),
MaybeTraceRuntimeCond = no,
- goal_util.generate_foreign_proc(BuiltinModule, PredName, predicate,
+ goal_util.generate_foreign_proc(BuiltinModule, PredName, pf_predicate,
only_mode, Detism, purity_impure, Attrs, Args, ExtraArgs,
MaybeTraceRuntimeCond, Code, [], ground_vars(BoundVars),
ModuleInfo, Context, Goal).
Index: compiler/cse_detection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/cse_detection.m,v
retrieving revision 1.107
diff -u -b -r1.107 cse_detection.m
--- compiler/cse_detection.m 6 Jan 2007 09:23:27 -0000 1.107
+++ compiler/cse_detection.m 17 Jan 2007 07:08:04 -0000
@@ -73,7 +73,7 @@
detect_cse(!ModuleInfo, !IO) :-
% Traverse the module structure, calling `detect_cse_in_goal'
% for each procedure body.
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
detect_cse_in_preds(PredIds, !ModuleInfo, !IO).
:- pred detect_cse_in_preds(list(pred_id)::in,
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.119
diff -u -b -r1.119 dead_proc_elim.m
--- compiler/dead_proc_elim.m 6 Jan 2007 09:23:28 -0000 1.119
+++ compiler/dead_proc_elim.m 17 Jan 2007 07:08:04 -0000
@@ -49,7 +49,8 @@
% needed, record how many times they are referenced (this information
% is used by our inlining heuristics).
%
-:- pred dead_proc_analyze(module_info::in, needed_map::out) is det.
+:- pred dead_proc_analyze(module_info::in, module_info::out, needed_map::out)
+ is det.
% Optimize away any dead predicates. This is performed immediately after
% building the HLDS to avoid doing semantic checking and optimization
@@ -122,35 +123,35 @@
:- type examined_set == set(entity).
dead_proc_elim(Pass, !ModuleInfo, Specs) :-
- dead_proc_analyze(!.ModuleInfo, Needed),
+ dead_proc_analyze(!ModuleInfo, Needed),
dead_proc_eliminate(Pass, Needed, !ModuleInfo, Specs).
%-----------------------------------------------------------------------------%
-dead_proc_analyze(ModuleInfo0, !:Needed) :-
+dead_proc_analyze(!ModuleInfo, !:Needed) :-
set.init(Examined0),
- dead_proc_initialize(ModuleInfo0, Queue0, !:Needed),
- dead_proc_examine(Queue0, Examined0, ModuleInfo0, !Needed).
+ dead_proc_initialize(!ModuleInfo, Queue0, !:Needed),
+ dead_proc_examine(Queue0, Examined0, !.ModuleInfo, !Needed).
% Add all exported entities to the queue and map.
% NOTE: changes here are likely to require changes to dead_pred_elim
% as well.
%
-:- pred dead_proc_initialize(module_info::in,
+:- pred dead_proc_initialize(module_info::in,module_info::out,
entity_queue::out, needed_map::out) is det.
-dead_proc_initialize(ModuleInfo, !:Queue, !:Needed) :-
+dead_proc_initialize(!ModuleInfo, !:Queue, !:Needed) :-
!:Queue = queue.init,
!:Needed = map.init,
- module_info_predids(ModuleInfo, PredIds),
- module_info_preds(ModuleInfo, PredTable),
+ module_info_predids(PredIds, !ModuleInfo),
+ module_info_preds(!.ModuleInfo, PredTable),
dead_proc_initialize_preds(PredIds, PredTable, !Queue, !Needed),
- module_info_get_pragma_exported_procs(ModuleInfo, PragmaExports),
+ module_info_get_pragma_exported_procs(!.ModuleInfo, PragmaExports),
dead_proc_initialize_pragma_exports(PragmaExports, !Queue, !Needed),
- module_info_get_type_ctor_gen_infos(ModuleInfo, TypeCtorGenInfos),
+ module_info_get_type_ctor_gen_infos(!.ModuleInfo, TypeCtorGenInfos),
dead_proc_initialize_base_gen_infos(TypeCtorGenInfos, !Queue, !Needed),
- module_info_get_class_table(ModuleInfo, Classes),
- module_info_get_instance_table(ModuleInfo, Instances),
+ module_info_get_class_table(!.ModuleInfo, Classes),
+ module_info_get_instance_table(!.ModuleInfo, Instances),
dead_proc_initialize_class_methods(Classes, Instances, !Queue, !Needed).
% Add all normally exported procedures within the listed predicates
@@ -494,7 +495,7 @@
module_info::in, module_info::out, list(error_spec)::out) is det.
dead_proc_eliminate(Pass, !.Needed, !ModuleInfo, Specs) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
module_info_preds(!.ModuleInfo, PredTable0),
Changed0 = no,
@@ -731,12 +732,12 @@
list.foldl2(dead_pred_elim_add_entity, Entities, Queue1, Queue,
NeededPreds0, NeededPreds1),
+ module_info_predids(PredIds, !ModuleInfo),
+
set.init(Preds0),
set.init(Names0),
DeadInfo0 = pred_elim_info(!.ModuleInfo, Queue, Preds0, NeededPreds1,
Names0),
-
- module_info_predids(!.ModuleInfo, PredIds),
list.foldl(dead_pred_elim_initialize, PredIds, DeadInfo0, DeadInfo1),
dead_pred_elim_analyze(DeadInfo1, DeadInfo),
DeadInfo = pred_elim_info(!:ModuleInfo, _, _, NeededPreds2, _),
Index: compiler/deep_profiling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/deep_profiling.m,v
retrieving revision 1.61
diff -u -b -r1.61 deep_profiling.m
--- compiler/deep_profiling.m 6 Jan 2007 10:56:11 -0000 1.61
+++ compiler/deep_profiling.m 17 Jan 2007 07:08:04 -0000
@@ -74,7 +74,7 @@
;
TailRecursion = no
),
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
module_info_get_predicate_table(!.ModuleInfo, PredTable0),
predicate_table_get_preds(PredTable0, PredMap0),
list.foldl(transform_predicate(!.ModuleInfo), PredIds, PredMap0, PredMap),
@@ -1453,21 +1453,21 @@
(
lookup_builtin_pred_proc_id(ModuleInfo,
mercury_public_builtin_module, "unify",
- predicate, 2, mode_no(0), PredId, _),
+ pf_predicate, 2, mode_no(0), PredId, _),
Args = [TypeInfoVar | _]
->
Class = call_class_special(proc(PredId, ProcId), TypeInfoVar)
;
lookup_builtin_pred_proc_id(ModuleInfo,
mercury_public_builtin_module, "compare",
- predicate, 3, mode_no(0), PredId, _),
+ pf_predicate, 3, mode_no(0), PredId, _),
Args = [TypeInfoVar | _]
->
Class = call_class_special(proc(PredId, ProcId), TypeInfoVar)
;
lookup_builtin_pred_proc_id(ModuleInfo,
mercury_public_builtin_module,
- "compare_representation", predicate, 3,
+ "compare_representation", pf_predicate, 3,
mode_no(0), PredId, _),
Args = [TypeInfoVar | _]
->
Index: compiler/dep_par_conj.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dep_par_conj.m,v
retrieving revision 1.17
diff -u -b -r1.17 dep_par_conj.m
--- compiler/dep_par_conj.m 13 Jan 2007 12:23:04 -0000 1.17
+++ compiler/dep_par_conj.m 17 Jan 2007 07:27:58 -0000
@@ -181,7 +181,7 @@
ModuleInfo0 = !.ModuleInfo,
% First process all parallel conjunctions in user-defined procedures.
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
ParProcs0 = par_procs(map.init, []),
list.foldl3(process_pred_for_dep_par_conj, PredIds,
!ModuleInfo, ParProcs0, ParProcs, !IO),
@@ -1588,7 +1588,7 @@
Features = [],
InstMapSrc = [FutureVar - ground(shared, none)],
Context = term.context_init,
- goal_util.generate_simple_call(ModuleName, PredName, predicate,
+ goal_util.generate_simple_call(ModuleName, PredName, pf_predicate,
only_mode, detism_det, purity_pure, Args, Features, InstMapSrc,
ModuleInfo, Context, AllocGoal).
@@ -1629,7 +1629,7 @@
Features = [],
InstMapSrc = [WaitVar - ground(shared, none)],
Context = term.context_init,
- goal_util.generate_simple_call(ModuleName, PredName, predicate,
+ goal_util.generate_simple_call(ModuleName, PredName, pf_predicate,
only_mode, detism_det, purity_pure, Args, Features, InstMapSrc,
ModuleInfo, Context, WaitGoal).
@@ -1644,7 +1644,7 @@
Features = [],
InstMapSrc = [],
Context = term.context_init,
- goal_util.generate_simple_call(ModuleName, PredName, predicate,
+ goal_util.generate_simple_call(ModuleName, PredName, pf_predicate,
only_mode, detism_det, purity_impure, Args, Features, InstMapSrc,
ModuleInfo, Context, SignalGoal).
Index: compiler/dependency_graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.93
diff -u -b -r1.93 dependency_graph.m
--- compiler/dependency_graph.m 6 Jan 2007 09:23:29 -0000 1.93
+++ compiler/dependency_graph.m 17 Jan 2007 07:08:04 -0000
@@ -54,13 +54,13 @@
% Build the dependency graph of procedures.
%
-:- pred build_pred_dependency_graph(module_info::in, include_imported::in,
- dependency_info(pred_id)::out) is det.
+:- pred build_pred_dependency_graph(module_info::in, list(pred_id)::in,
+ include_imported::in, dependency_info(pred_id)::out) is det.
% Build the dependency graph of predicates.
%
-:- pred build_proc_dependency_graph(module_info::in, include_imported::in,
- dependency_info(pred_proc_id)::out) is det.
+:- pred build_proc_dependency_graph(module_info::in, list(pred_id)::in,
+ include_imported::in, dependency_info(pred_proc_id)::out) is det.
% Output a form of the static call graph to a file, in a format suitable
% for use in .dependency_info files. After the heading, the format of
@@ -141,28 +141,32 @@
MaybeDepInfo = yes(_)
;
MaybeDepInfo = no,
- build_dependency_graph(!.ModuleInfo, do_not_include_imported, DepInfo),
+ module_info_predids(PredIds, !ModuleInfo),
+ build_dependency_graph(!.ModuleInfo, PredIds, do_not_include_imported,
+ DepInfo),
module_info_set_dependency_info(DepInfo, !ModuleInfo)
).
module_info_rebuild_dependency_info(!ModuleInfo, DepInfo) :-
- build_dependency_graph(!.ModuleInfo, do_not_include_imported, DepInfo),
+ module_info_predids(PredIds, !ModuleInfo),
+ build_dependency_graph(!.ModuleInfo, PredIds, do_not_include_imported,
+ DepInfo),
module_info_set_dependency_info(DepInfo, !ModuleInfo).
-build_proc_dependency_graph(ModuleInfo, Imported, DepInfo) :-
- build_dependency_graph(ModuleInfo, Imported, DepInfo).
+build_proc_dependency_graph(ModuleInfo, PredIds, Imported, DepInfo) :-
+ build_dependency_graph(ModuleInfo, PredIds, Imported, DepInfo).
-build_pred_dependency_graph(ModuleInfo, Imported, DepInfo) :-
- build_dependency_graph(ModuleInfo, Imported, DepInfo).
+build_pred_dependency_graph(ModuleInfo, PredIds, Imported, DepInfo) :-
+ build_dependency_graph(ModuleInfo, PredIds, Imported, DepInfo).
% Traverse the module structure, calling `add_dependency_arcs'
% for each procedure body.
%
-:- pred build_dependency_graph(module_info::in, include_imported::in,
- dependency_info(T)::out) is det <= dependency_node(T).
+:- pred build_dependency_graph(module_info::in, list(pred_id)::in,
+ include_imported::in, dependency_info(T)::out) is det
+ <= dependency_node(T).
-build_dependency_graph(ModuleInfo, Imported, !:DepInfo) :-
- module_info_predids(ModuleInfo, PredIds),
+build_dependency_graph(ModuleInfo, PredIds, Imported, !:DepInfo) :-
relation.init(DepGraph0),
add_dependency_nodes(PredIds, ModuleInfo, Imported, DepGraph0, DepGraph1),
add_dependency_arcs(PredIds, ModuleInfo, Imported, DepGraph1, DepGraph),
Index: compiler/det_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_analysis.m,v
retrieving revision 1.204
diff -u -b -r1.204 det_analysis.m
--- compiler/det_analysis.m 6 Jan 2007 09:23:29 -0000 1.204
+++ compiler/det_analysis.m 17 Jan 2007 07:08:04 -0000
@@ -136,8 +136,9 @@
%-----------------------------------------------------------------------------%
determinism_pass(!ModuleInfo, Specs) :-
- determinism_declarations(!.ModuleInfo, DeclaredProcs, UndeclaredProcs,
- NoInferProcs),
+ module_info_predids(PredIds, !ModuleInfo),
+ determinism_declarations(!.ModuleInfo, PredIds,
+ DeclaredProcs, UndeclaredProcs, NoInferProcs),
list.foldl(set_non_inferred_proc_determinism, NoInferProcs, !ModuleInfo),
module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_bool_option(Globals, verbose, Verbose),
@@ -1710,35 +1711,35 @@
% - NoInferProcs holds the procedures whose determinism is already
% known, and which should not be processed further.
%
-:- pred determinism_declarations(module_info::in, pred_proc_list::out,
- pred_proc_list::out, pred_proc_list::out) is det.
+:- pred determinism_declarations(module_info::in, list(pred_id)::in,
+ pred_proc_list::out, pred_proc_list::out, pred_proc_list::out) is det.
-determinism_declarations(ModuleInfo, DeclaredProcs, UndeclaredProcs,
- NoInferProcs) :-
- get_all_pred_procs(ModuleInfo, PredProcs),
- segregate_procs(ModuleInfo, PredProcs, DeclaredProcs, UndeclaredProcs,
- NoInferProcs).
-
- % Get_all_pred_procs takes a module_info and returns a list of all
- % the procedure ids for that module (except class methods, which
- % do not need to be checked since we generate the code ourselves).
+determinism_declarations(ModuleInfo, PredIds,
+ DeclaredProcs, UndeclaredProcs, NoInferProcs) :-
+ get_all_pred_procs(ModuleInfo, PredIds, PredProcs),
+ segregate_procs(ModuleInfo, PredProcs,
+ DeclaredProcs, UndeclaredProcs, NoInferProcs).
+
+ % Get_all_pred_procs returns a list of all the procedure ids for that
+ % module (except class methods, which do not need to be checked since
+ % we generate the code ourselves).
%
-:- pred get_all_pred_procs(module_info::in, pred_proc_list::out) is det.
+:- pred get_all_pred_procs(module_info::in, list(pred_id)::in,
+ pred_proc_list::out) is det.
-get_all_pred_procs(ModuleInfo, PredProcs) :-
- module_info_predids(ModuleInfo, PredIds),
- module_info_preds(ModuleInfo, Preds),
- get_all_pred_procs_2(Preds, PredIds, [], PredProcs).
+get_all_pred_procs(ModuleInfo, PredIds, PredProcs) :-
+ module_info_preds(ModuleInfo, PredTable),
+ get_all_pred_procs_2(PredTable, PredIds, [], PredProcs).
:- pred get_all_pred_procs_2(pred_table::in, list(pred_id)::in,
pred_proc_list::in, pred_proc_list::out) is det.
-get_all_pred_procs_2(_Preds, [], !PredProcs).
-get_all_pred_procs_2(Preds, [PredId | PredIds], !PredProcs) :-
- map.lookup(Preds, PredId, Pred),
+get_all_pred_procs_2(_PredTable, [], !PredProcs).
+get_all_pred_procs_2(PredTable, [PredId | PredIds], !PredProcs) :-
+ map.lookup(PredTable, PredId, Pred),
ProcIds = pred_info_procids(Pred),
fold_pred_modes(PredId, ProcIds, !PredProcs),
- get_all_pred_procs_2(Preds, PredIds, !PredProcs).
+ get_all_pred_procs_2(PredTable, PredIds, !PredProcs).
:- pred fold_pred_modes(pred_id::in, list(proc_id)::in, pred_proc_list::in,
pred_proc_list::out) is det.
Index: compiler/det_report.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.136
diff -u -b -r1.136 det_report.m
--- compiler/det_report.m 6 Jan 2007 09:23:30 -0000 1.136
+++ compiler/det_report.m 17 Jan 2007 07:08:04 -0000
@@ -342,7 +342,7 @@
% allowed.)
(
% If it is a mode for a function...
- pred_info_is_pred_or_func(PredInfo) = function,
+ pred_info_is_pred_or_func(PredInfo) = pf_function,
% ... that can succeed more than once ...
determinism_components(InferredDetism, _CanFail, NumSolns),
NumSolns \= at_most_zero,
Index: compiler/distance_granularity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/distance_granularity.m,v
retrieving revision 1.1
diff -u -b -r1.1 distance_granularity.m
--- compiler/distance_granularity.m 13 Jan 2007 12:23:05 -0000 1.1
+++ compiler/distance_granularity.m 17 Jan 2007 07:28:13 -0000
@@ -179,7 +179,7 @@
control_distance_granularity(!ModuleInfo, Distance) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
apply_dg_to_preds(PredIds, Distance, !ModuleInfo).
% Apply the distance granularity transformation to each predicate in the
@@ -200,7 +200,7 @@
% Create the new sym_name for the recursive plain calls.
ModuleName = pred_info_module(PredInfo),
Prefix = granularity_prefix,
- MaybePredOrFunc = yes(predicate),
+ MaybePredOrFunc = yes(pf_predicate),
NewPredIdGranularity = newpred_distance_granularity(Distance),
PredName0 = pred_info_name(PredInfo),
make_pred_name(ModuleName, Prefix, MaybePredOrFunc, PredName0,
@@ -220,7 +220,7 @@
% If the original predicate was a function then the specialized version
% is a predicate.
- pred_info_set_is_pred_or_func(predicate, PredInfoClone1,
+ pred_info_set_is_pred_or_func(pf_predicate, PredInfoClone1,
PredInfoClone2),
% The arity and the argument types of the specialized predicate must be
@@ -682,7 +682,7 @@
% Decrement GranularityVar before the call.
lookup_builtin_pred_proc_id(ModuleInfo,
- unqualified("int"), "minus", function, 2, only_mode,
+ unqualified("int"), "minus", pf_function, 2, only_mode,
MinusPredId, MinusProcId),
MinusCallArgs = [GranularityVar, Var, VarResult],
MinusCallBuiltin = inline_builtin,
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.78
diff -u -b -r1.78 equiv_type.m
--- compiler/equiv_type.m 6 Jan 2007 09:23:30 -0000 1.78
+++ compiler/equiv_type.m 18 Jan 2007 02:28:43 -0000
@@ -997,7 +997,8 @@
map.apply_to_list(Args0, Renaming, Args),
apply_variable_renaming_to_type(Renaming, Body0, Body1),
TypeCtorItem = type_ctor_to_item_name(TypeCtor),
- record_expanded_item(item_id(type_item, TypeCtorItem), !EquivTypeInfo),
+ record_expanded_item(item_id(type_abstract_item, TypeCtorItem),
+ !EquivTypeInfo),
map.from_corresponding_lists(Args, TArgs, Subst),
apply_subst_to_type(Subst, Body1, Body),
replace_in_type_location_2(Location, EqvMap,
@@ -1204,7 +1205,7 @@
ExtraModes = ExtraModes0,
(
MaybePredOrFunc0 = no,
- RecordedPredOrFunc = predicate
+ RecordedPredOrFunc = pf_predicate
;
MaybePredOrFunc0 = yes(RecordedPredOrFunc)
),
Index: compiler/equiv_type_hlds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/equiv_type_hlds.m,v
retrieving revision 1.40
diff -u -b -r1.40 equiv_type_hlds.m
--- compiler/equiv_type_hlds.m 6 Jan 2007 09:23:31 -0000 1.40
+++ compiler/equiv_type_hlds.m 17 Jan 2007 07:08:04 -0000
@@ -80,7 +80,7 @@
replace_in_inst_table(EqvMap, Insts0, Insts, InstCache0, InstCache1),
module_info_set_inst_table(Insts, !ModuleInfo),
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl2(replace_in_pred(EqvMap), PredIds, !ModuleInfo, InstCache1, _).
:- pred add_type_to_eqv_map(type_ctor::in, hlds_type_defn::in,
Index: compiler/error_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/error_util.m,v
retrieving revision 1.60
diff -u -b -r1.60 error_util.m
--- compiler/error_util.m 27 Dec 2006 03:44:11 -0000 1.60
+++ compiler/error_util.m 17 Jan 2007 07:17:54 -0000
@@ -1259,8 +1259,8 @@
describe_sym_name(SymName) =
string.append_list(["`", sym_name_to_string(SymName), "'"]).
-pred_or_func_to_string(predicate) = "predicate".
-pred_or_func_to_string(function) = "function".
+pred_or_func_to_string(pf_predicate) = "predicate".
+pred_or_func_to_string(pf_function) = "function".
add_quotes(Str) = "`" ++ Str ++ "'".
Index: compiler/exception_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/exception_analysis.m,v
retrieving revision 1.36
diff -u -b -r1.36 exception_analysis.m
--- compiler/exception_analysis.m 6 Jan 2007 09:23:31 -0000 1.36
+++ compiler/exception_analysis.m 17 Jan 2007 07:08:04 -0000
@@ -1212,7 +1212,7 @@
OptFileRes = ok(OptFile),
io.set_output_stream(OptFile, OldStream, !IO),
module_info_get_exception_info(ModuleInfo, ExceptionInfo),
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.foldl(write_pragma_exceptions(ModuleInfo, ExceptionInfo),
PredIds, !IO),
io.set_output_stream(OldStream, _, !IO),
Index: compiler/export.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/export.m,v
retrieving revision 1.107
diff -u -b -r1.107 export.m
--- compiler/export.m 9 Oct 2006 06:40:24 -0000 1.107
+++ compiler/export.m 17 Jan 2007 07:08:04 -0000
@@ -398,7 +398,7 @@
(
CodeModel = model_det,
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgInfoTypes0, ArgInfoTypes1,
arg_info(RetArgLoc, RetArgMode) - RetType),
RetArgMode = top_out,
Index: compiler/fact_table.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/fact_table.m,v
retrieving revision 1.81
diff -u -b -r1.81 fact_table.m
--- compiler/fact_table.m 1 Dec 2006 15:03:55 -0000 1.81
+++ compiler/fact_table.m 17 Jan 2007 07:08:04 -0000
@@ -396,12 +396,12 @@
( Const = term.atom(TopLevel) ->
(
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
TopLevel = PredString,
Terms = Terms0,
Arity = Arity0
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
TopLevel = "=",
Terms0 = [FuncHeadTerm, FuncResultTerm],
FuncHeadTerm = term.functor(term.atom(PredString), Terms1, _),
@@ -538,7 +538,7 @@
report_type_error(Context, ArgNum, RemainingTerms, PredOrFunc, !Errors) :-
(
% Report a different error message for the return value of a function.
- PredOrFunc = function,
+ PredOrFunc = pf_function,
RemainingTerms = []
->
Msg = "Type error in return value of function."
Index: compiler/follow_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/follow_code.m,v
retrieving revision 1.88
diff -u -b -r1.88 follow_code.m
--- compiler/follow_code.m 6 Jan 2007 09:23:31 -0000 1.88
+++ compiler/follow_code.m 17 Jan 2007 13:12:43 -0000
@@ -31,22 +31,14 @@
:- module ll_backend.follow_code.
:- interface.
-:- import_module hlds.hlds_goal.
:- import_module hlds.hlds_module.
:- import_module hlds.hlds_pred.
-:- import_module list.
-
%-----------------------------------------------------------------------------%
:- pred move_follow_code_in_proc(pred_id::in, proc_id::in, pred_info::in,
proc_info::in, proc_info::out, module_info::in, module_info::out) is det.
- % Split a list of goals into the prefix of builtins and the rest.
- %
-:- pred move_follow_code_select(list(hlds_goal)::in, list(hlds_goal)::out,
- list(hlds_goal)::out) is det.
-
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -54,6 +46,7 @@
:- import_module check_hlds.mode_util.
:- import_module hlds.goal_util.
+:- import_module hlds.hlds_goal.
:- import_module hlds.quantification.
:- import_module libs.compiler_util.
:- import_module libs.globals.
@@ -61,6 +54,7 @@
:- import_module parse_tree.prog_data.
:- import_module bool.
+:- import_module list.
:- import_module pair.
%-----------------------------------------------------------------------------%
@@ -69,22 +63,24 @@
!ModuleInfo) :-
module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_bool_option(Globals, follow_code, FollowCode),
- globals.lookup_bool_option(Globals, prev_code, PrevCode),
- Flags = FollowCode - PrevCode,
+ (
+ FollowCode = no
+ ;
+ FollowCode = yes,
proc_info_get_goal(!.ProcInfo, Goal0),
proc_info_get_varset(!.ProcInfo, Varset0),
proc_info_get_vartypes(!.ProcInfo, VarTypes0),
proc_info_get_rtti_varmaps(!.ProcInfo, RttiVarMaps0),
(
- move_follow_code_in_goal(Goal0, Goal1, Flags, no, Res),
- % Did the goal change?
- Res = yes
+ move_follow_code_in_goal(Goal0, Goal1, no, Changed),
+ Changed = yes
->
- % We need to fix up the goal_info by recalculating the nonlocal vars
- % and the non-atomic instmap deltas.
+ % We need to fix up the goal_info by recalculating the nonlocal
+ % vars and the non-atomic instmap deltas.
proc_info_get_headvars(!.ProcInfo, HeadVars),
implicitly_quantify_clause_body(HeadVars, _Warnings, Goal1, Goal2,
- Varset0, Varset, VarTypes0, VarTypes, RttiVarMaps0, RttiVarMaps),
+ Varset0, Varset, VarTypes0, VarTypes,
+ RttiVarMaps0, RttiVarMaps),
proc_info_get_initial_instmap(!.ProcInfo, !.ModuleInfo, InstMap0),
proc_info_get_inst_varset(!.ProcInfo, InstVarSet),
recompute_instmap_delta(no, Goal2, Goal, VarTypes, InstVarSet,
@@ -98,55 +94,69 @@
proc_info_set_goal(Goal, !ProcInfo),
proc_info_set_varset(Varset, !ProcInfo),
proc_info_set_vartypes(VarTypes, !ProcInfo),
- proc_info_set_rtti_varmaps(RttiVarMaps, !ProcInfo).
+ proc_info_set_rtti_varmaps(RttiVarMaps, !ProcInfo)
+ ).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-:- pred move_follow_code_in_goal(hlds_goal::in, hlds_goal::out, pair(bool)::in,
+:- pred move_follow_code_in_goal(hlds_goal::in, hlds_goal::out,
bool::in, bool::out) is det.
-move_follow_code_in_goal(hlds_goal(GoalExpr0, GoalInfo),
- hlds_goal(GoalExpr, GoalInfo), Flags, !R) :-
- move_follow_code_in_goal_2(GoalExpr0, GoalExpr, Flags, !R).
-
-%-----------------------------------------------------------------------------%
-
-:- pred move_follow_code_in_goal_2(hlds_goal_expr::in, hlds_goal_expr::out,
- pair(bool)::in, bool::in, bool::out) is det.
-
-move_follow_code_in_goal_2(conj(ConjType, Goals0), conj(ConjType, Goals),
- Flags, !R) :-
+move_follow_code_in_goal(Goal0, Goal, !Changed) :-
+ Goal0 = hlds_goal(GoalExpr0, GoalInfo),
+ (
+ GoalExpr0 = conj(ConjType, Goals0),
(
ConjType = plain_conj,
- move_follow_code_in_conj(Goals0, Goals, Flags, !R)
+ goal_info_get_purity(GoalInfo, ConjPurity),
+ move_follow_code_in_conj(Goals0, ConjPurity, Goals, !Changed)
;
ConjType = parallel_conj,
- move_follow_code_in_independent_goals(Goals0, Goals, Flags, !R)
- ).
-move_follow_code_in_goal_2(disj(Goals0), disj(Goals), Flags, !R) :-
- move_follow_code_in_independent_goals(Goals0, Goals, Flags, !R).
-move_follow_code_in_goal_2(negation(Goal0), negation(Goal), Flags, !R) :-
- move_follow_code_in_goal(Goal0, Goal, Flags, !R).
-move_follow_code_in_goal_2(switch(Var, Det, Cases0),
- switch(Var, Det, Cases), Flags, !R) :-
- move_follow_code_in_cases(Cases0, Cases, Flags, !R).
-move_follow_code_in_goal_2(if_then_else(Vars, Cond0, Then0, Else0),
- if_then_else(Vars, Cond, Then, Else), Flags, !R) :-
- move_follow_code_in_goal(Cond0, Cond, Flags, !R),
- move_follow_code_in_goal(Then0, Then, Flags, !R),
- move_follow_code_in_goal(Else0, Else, Flags, !R).
-move_follow_code_in_goal_2(scope(Remove, Goal0), scope(Remove, Goal),
- Flags, !R) :-
- move_follow_code_in_goal(Goal0, Goal, Flags, !R).
-move_follow_code_in_goal_2(Goal @ generic_call(_, _, _, _), Goal, _, !R).
-move_follow_code_in_goal_2(Goal @ plain_call(_, _, _, _, _, _), Goal, _, !R).
-move_follow_code_in_goal_2(Goal @ unify(_, _, _, _, _), Goal, _, !R).
-move_follow_code_in_goal_2(Goal @ call_foreign_proc(_, _, _, _, _, _, _), Goal,
- _, !R).
-move_follow_code_in_goal_2(shorthand(_), _, _, _, _) :-
+ move_follow_code_in_independent_goals(Goals0, Goals, !Changed)
+ ),
+ GoalExpr = conj(ConjType, Goals),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
+ ;
+ GoalExpr0 = disj(Goals0),
+ move_follow_code_in_independent_goals(Goals0, Goals, !Changed),
+ GoalExpr = disj(Goals),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
+ ;
+ GoalExpr0 = negation(SubGoal0),
+ move_follow_code_in_goal(SubGoal0, SubGoal, !Changed),
+ GoalExpr = negation(SubGoal),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
+ ;
+ GoalExpr0 = switch(Var, Det, Cases0),
+ move_follow_code_in_cases(Cases0, Cases, !Changed),
+ GoalExpr = switch(Var, Det, Cases),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
+ ;
+ GoalExpr0 = if_then_else(Vars, Cond0, Then0, Else0),
+ move_follow_code_in_goal(Cond0, Cond, !Changed),
+ move_follow_code_in_goal(Then0, Then, !Changed),
+ move_follow_code_in_goal(Else0, Else, !Changed),
+ GoalExpr = if_then_else(Vars, Cond, Then, Else),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
+ ;
+ GoalExpr0 = scope(Remove, SubGoal0),
+ move_follow_code_in_goal(SubGoal0, SubGoal, !Changed),
+ GoalExpr = scope(Remove, SubGoal),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
+ ;
+ ( GoalExpr0 = generic_call(_, _, _, _)
+ ; GoalExpr0 = plain_call(_, _, _, _, _, _)
+ ; GoalExpr0 = unify(_, _, _, _, _)
+ ; GoalExpr0 = call_foreign_proc(_, _, _, _, _, _, _)
+ ),
+ Goal = Goal0
+ ;
+ GoalExpr0 = shorthand(_),
% These should have been expanded out by now.
- unexpected(this_file, "move_follow_code_in_goal_2: unexpected shorthand").
+ unexpected(this_file,
+ "move_follow_code_in_goal: unexpected shorthand")
+ ).
%-----------------------------------------------------------------------------%
@@ -154,68 +164,78 @@
% parallel conjunction.
%
:- pred move_follow_code_in_independent_goals(list(hlds_goal)::in,
- list(hlds_goal)::out, pair(bool)::in, bool::in, bool::out) is det.
+ list(hlds_goal)::out, bool::in, bool::out) is det.
-move_follow_code_in_independent_goals([], [], _, !R).
-move_follow_code_in_independent_goals([Goal0|Goals0], [Goal|Goals], Flags,
- !R) :-
- move_follow_code_in_goal(Goal0, Goal, Flags, !R),
- move_follow_code_in_independent_goals(Goals0, Goals, Flags, !R).
+move_follow_code_in_independent_goals([], [], !Changed).
+move_follow_code_in_independent_goals([Goal0 | Goals0], [Goal | Goals],
+ !Changed) :-
+ move_follow_code_in_goal(Goal0, Goal, !Changed),
+ move_follow_code_in_independent_goals(Goals0, Goals, !Changed).
%-----------------------------------------------------------------------------%
:- pred move_follow_code_in_cases(list(case)::in, list(case)::out,
- pair(bool)::in, bool::in, bool::out) is det.
+ bool::in, bool::out) is det.
-move_follow_code_in_cases([], [], _, !R).
-move_follow_code_in_cases([case(Cons, Goal0) | Goals0],
- [case(Cons, Goal) | Goals], Flags, !R) :-
- move_follow_code_in_goal(Goal0, Goal, Flags, !R),
- move_follow_code_in_cases(Goals0, Goals, Flags, !R).
+move_follow_code_in_cases([], [], !Changed).
+move_follow_code_in_cases([Case0 | Cases0], [Case | Cases], !Changed) :-
+ Case0 = case(ConsId, Goal0),
+ move_follow_code_in_goal(Goal0, Goal, !Changed),
+ Case = case(ConsId, Goal),
+ move_follow_code_in_cases(Cases0, Cases, !Changed).
%-----------------------------------------------------------------------------%
% Find the first branched structure, and split the conj into those goals
% before and after it.
%
-:- pred move_follow_code_in_conj(list(hlds_goal)::in, list(hlds_goal)::out,
- pair(bool)::in, bool::in, bool::out) is det.
+:- pred move_follow_code_in_conj(list(hlds_goal)::in, purity::in,
+ list(hlds_goal)::out, bool::in, bool::out) is det.
-move_follow_code_in_conj(Goals0, Goals, Flags, !R) :-
- move_follow_code_in_conj_2(Goals0, [], RevGoals, Flags, !R),
+move_follow_code_in_conj(Goals0, ConjPurity, Goals, !Changed) :-
+ move_follow_code_in_conj_2(Goals0, ConjPurity, [], RevGoals, !Changed),
list.reverse(RevGoals, Goals).
-:- pred move_follow_code_in_conj_2(list(hlds_goal)::in, list(hlds_goal)::in,
- list(hlds_goal)::out, pair(bool)::in, bool::in, bool::out) is det.
+:- pred move_follow_code_in_conj_2(list(hlds_goal)::in, purity::in,
+ list(hlds_goal)::in, list(hlds_goal)::out, bool::in, bool::out) is det.
-move_follow_code_in_conj_2([], !RevPrevGoals, _, !R).
-move_follow_code_in_conj_2([Goal0 | Goals0], !RevPrevGoals, Flags, !R) :-
- Flags = PushFollowCode - _PushPrevCode,
+move_follow_code_in_conj_2([], _ConjPurity, !RevPrevGoals, !Changed).
+move_follow_code_in_conj_2([Goal0 | Goals0], ConjPurity, !RevPrevGoals,
+ !Changed) :-
(
- PushFollowCode = yes,
Goal0 = hlds_goal(GoalExpr0, _),
goal_util.goal_is_branched(GoalExpr0),
- move_follow_code_select(Goals0, FollowGoals, RestGoalsPrime),
+ move_follow_code_select(Goals0, FollowGoals, RestGoalsPrime,
+ ConjPurity, WorstPurity),
FollowGoals = [_ | _],
- move_follow_code_move_goals(Goal0, FollowGoals, Goal1Prime)
+ move_follow_code_move_goals(Goal0, FollowGoals, WorstPurity,
+ Goal1Prime)
->
- !:R = yes,
+ !:Changed = yes,
Goal1 = Goal1Prime,
RestGoals = RestGoalsPrime
;
Goal1 = Goal0,
RestGoals = Goals0
),
- move_follow_code_in_goal(Goal1, Goal, Flags, !R),
+ move_follow_code_in_goal(Goal1, Goal, !Changed),
!:RevPrevGoals = [Goal | !.RevPrevGoals],
- move_follow_code_in_conj_2(RestGoals, !RevPrevGoals, Flags, !R).
+ move_follow_code_in_conj_2(RestGoals, ConjPurity, !RevPrevGoals, !Changed).
%-----------------------------------------------------------------------------%
-move_follow_code_select([], [], []).
-move_follow_code_select([Goal | Goals], FollowGoals, RestGoals) :-
- ( move_follow_code_is_builtin(Goal) ->
- move_follow_code_select(Goals, FollowGoals0, RestGoals),
+ % Split a list of goals into the prefix of builtins and the rest.
+ %
+:- pred move_follow_code_select(list(hlds_goal)::in, list(hlds_goal)::out,
+ list(hlds_goal)::out, purity::in, purity::out) is det.
+
+move_follow_code_select([], [], [], !Purity).
+move_follow_code_select([Goal | Goals], FollowGoals, RestGoals, !Purity) :-
+ Goal = hlds_goal(GoalExpr, GoalInfo),
+ ( move_follow_code_is_builtin(GoalExpr) ->
+ goal_info_get_purity(GoalInfo, GoalPurity),
+ !:Purity = worst_purity(!.Purity, GoalPurity),
+ move_follow_code_select(Goals, FollowGoals0, RestGoals, !Purity),
FollowGoals = [Goal | FollowGoals0]
;
FollowGoals = [],
@@ -225,46 +245,59 @@
%-----------------------------------------------------------------------------%
:- pred move_follow_code_move_goals(hlds_goal::in, list(hlds_goal)::in,
- hlds_goal::out) is semidet.
+ purity::in, hlds_goal::out) is semidet.
-move_follow_code_move_goals(hlds_goal(GoalExpr0, GoalInfo), FollowGoals,
- hlds_goal(GoalExpr, GoalInfo)) :-
+move_follow_code_move_goals(Goal0, FollowGoals, FollowPurity, Goal) :-
+ Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
(
GoalExpr0 = switch(Var, Det, Cases0),
- move_follow_code_move_goals_cases(Cases0, FollowGoals, Cases),
+ move_follow_code_move_goals_cases(Cases0, FollowGoals, FollowPurity,
+ Cases),
GoalExpr = switch(Var, Det, Cases)
;
GoalExpr0 = disj(Goals0),
- move_follow_code_move_goals_disj(Goals0, FollowGoals, Goals),
+ move_follow_code_move_goals_disj(Goals0, FollowGoals, FollowPurity,
+ Goals),
GoalExpr = disj(Goals)
;
GoalExpr0 = if_then_else(Vars, Cond, Then0, Else0),
- follow_code_conjoin_goal_and_goal_list(Then0, FollowGoals, Then),
- follow_code_conjoin_goal_and_goal_list(Else0, FollowGoals, Else),
+ follow_code_conjoin_goal_and_goal_list(Then0, FollowGoals,
+ FollowPurity, Then),
+ follow_code_conjoin_goal_and_goal_list(Else0, FollowGoals,
+ FollowPurity, Else),
GoalExpr = if_then_else(Vars, Cond, Then, Else)
- ).
+ ),
+ goal_info_get_purity(GoalInfo0, OldPurity),
+ NewPurity = worst_purity(OldPurity, FollowPurity),
+ goal_info_set_purity(NewPurity, GoalInfo0, GoalInfo),
+ Goal = hlds_goal(GoalExpr, GoalInfo).
%-----------------------------------------------------------------------------%
:- pred move_follow_code_move_goals_cases(list(case)::in, list(hlds_goal)::in,
- list(case)::out) is semidet.
+ purity::in, list(case)::out) is semidet.
-move_follow_code_move_goals_cases([], _FollowGoals, []).
-move_follow_code_move_goals_cases([Case0|Cases0], FollowGoals, [Case|Cases]) :-
+move_follow_code_move_goals_cases([], _FollowGoals, _FollowPurity, []).
+move_follow_code_move_goals_cases([Case0 | Cases0], FollowGoals, FollowPurity,
+ [Case | Cases]) :-
Case0 = case(Cons, Goal0),
- follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal),
+ follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, FollowPurity,
+ Goal),
Case = case(Cons, Goal),
- move_follow_code_move_goals_cases(Cases0, FollowGoals, Cases).
+ move_follow_code_move_goals_cases(Cases0, FollowGoals, FollowPurity,
+ Cases).
%-----------------------------------------------------------------------------%
:- pred move_follow_code_move_goals_disj(list(hlds_goal)::in,
- list(hlds_goal)::in, list(hlds_goal)::out) is semidet.
+ list(hlds_goal)::in, purity::in, list(hlds_goal)::out) is semidet.
-move_follow_code_move_goals_disj([], _FollowGoals, []).
-move_follow_code_move_goals_disj([Goal0|Goals0], FollowGoals, [Goal|Goals]) :-
- follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal),
- move_follow_code_move_goals_disj(Goals0, FollowGoals, Goals).
+move_follow_code_move_goals_disj([], _FollowGoals, _FollowPurity, []).
+move_follow_code_move_goals_disj([Goal0 | Goals0], FollowGoals, FollowPurity,
+ [Goal | Goals]) :-
+ follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, FollowPurity,
+ Goal),
+ move_follow_code_move_goals_disj(Goals0, FollowGoals, FollowPurity, Goals).
%-----------------------------------------------------------------------------%
@@ -273,9 +306,10 @@
% changed.
%
:- pred follow_code_conjoin_goal_and_goal_list(hlds_goal::in,
- list(hlds_goal)::in, hlds_goal::out) is semidet.
+ list(hlds_goal)::in, purity::in, hlds_goal::out) is semidet.
-follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, Goal) :-
+follow_code_conjoin_goal_and_goal_list(Goal0, FollowGoals, FollowPurity,
+ Goal) :-
Goal0 = hlds_goal(GoalExpr0, GoalInfo0),
goal_info_get_determinism(GoalInfo0, Detism0),
determinism_components(Detism0, _CanFail0, MaxSolns0),
@@ -289,7 +323,10 @@
;
GoalExpr = conj(plain_conj, [Goal0 | FollowGoals])
),
- Goal = hlds_goal(GoalExpr, GoalInfo0)
+ goal_info_get_purity(GoalInfo0, OldPurity),
+ NewPurity = worst_purity(OldPurity, FollowPurity),
+ goal_info_set_purity(NewPurity, GoalInfo0, GoalInfo),
+ Goal = hlds_goal(GoalExpr, GoalInfo)
).
% This check is necessary to make sure that follow_code doesn't change
@@ -306,9 +343,9 @@
%-----------------------------------------------------------------------------%
-:- pred move_follow_code_is_builtin(hlds_goal::in) is semidet.
+:- pred move_follow_code_is_builtin(hlds_goal_expr::in) is semidet.
-move_follow_code_is_builtin(hlds_goal(GoalExpr, _)) :-
+move_follow_code_is_builtin(GoalExpr) :-
(
GoalExpr = unify(_, _, _, Unification, _),
Unification \= complicated_unify(_, _, _)
Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.69
diff -u -b -r1.69 foreign.m
--- compiler/foreign.m 8 Jan 2007 03:03:08 -0000 1.69
+++ compiler/foreign.m 17 Jan 2007 07:08:04 -0000
@@ -410,7 +410,7 @@
(
CodeModel = model_det,
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(!Args, RetArg),
RetArg = pragma_var(_, RetArgName, RetMode, _) - RetType,
mode_to_arg_mode(!.ModuleInfo, RetMode, RetType, RetArgMode),
Index: compiler/granularity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/granularity.m,v
retrieving revision 1.6
diff -u -b -r1.6 granularity.m
--- compiler/granularity.m 8 Jan 2007 03:03:09 -0000 1.6
+++ compiler/granularity.m 17 Jan 2007 07:28:22 -0000
@@ -136,7 +136,7 @@
!Attributes),
Attributes = !.Attributes
),
- generate_foreign_proc(ModuleName, ProcName, predicate,
+ generate_foreign_proc(ModuleName, ProcName, pf_predicate,
only_mode, detism_semi, purity_impure, Attributes,
Args, ExtraArgs, MaybeRuntimeCond, Code, Features,
InstMapDeltaSrc, ModuleInfo, Context, Cond),
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.292
diff -u -b -r1.292 handle_options.m
--- compiler/handle_options.m 10 Jan 2007 03:08:08 -0000 1.292
+++ compiler/handle_options.m 17 Jan 2007 08:04:15 -0000
@@ -935,13 +935,13 @@
true
),
- globals.lookup_int_option(!.Globals, debug_opt_pred_id,
- DebugOptPredId),
- globals.lookup_string_option(!.Globals, debug_opt_pred_name,
- DebugOptPredName),
+ globals.lookup_accumulating_option(!.Globals, debug_opt_pred_id,
+ DebugOptPredIdStrs),
+ globals.lookup_accumulating_option(!.Globals, debug_opt_pred_name,
+ DebugOptPredNames),
(
- ( DebugOptPredId > 0
- ; DebugOptPredName \= ""
+ ( DebugOptPredIdStrs = [_ | _]
+ ; DebugOptPredNames = [_ | _]
)
->
globals.set_option(debug_opt, bool(yes), !Globals)
@@ -953,9 +953,10 @@
DebugIntermoduleAnalysis),
analysis.enable_debug_messages(DebugIntermoduleAnalysis, !IO),
- globals.lookup_int_option(!.Globals, dump_hlds_pred_id,
- DumpHLDSPredId),
- ( DumpHLDSPredId >= 0 ->
+ globals.lookup_accumulating_option(!.Globals, dump_hlds_pred_id,
+ DumpHLDSPredIds),
+ (
+ DumpHLDSPredIds = [_ | _],
globals.lookup_string_option(!.Globals, dump_hlds_options,
DumpOptions2),
% Prevent the dumping of the mode and type tables.
@@ -964,7 +965,7 @@
globals.set_option(dump_hlds_options, string(DumpOptions),
!Globals)
;
- true
+ DumpHLDSPredIds = []
),
option_implies(debug_mode_constraints, prop_mode_constraints,
@@ -2494,11 +2495,11 @@
:- pred convert_dump_alias(string::in, string::out) is semidet.
-convert_dump_alias("ALL", "abcdfgilmnprstuvBCDIMPRSTU").
-convert_dump_alias("allD", "abcdfgilmnprstuvBCDMPT").
-convert_dump_alias("all", "abcdfgilmnprstuvBCMPST").
-convert_dump_alias("most", "bcdfgilmnprstuvP").
-convert_dump_alias("trans", "bcdglmnstuv").
+convert_dump_alias("ALL", "abcdfgilmnprstuvzBCDIMPRSTU").
+convert_dump_alias("allD", "abcdfgilmnprstuvzBCDMPT").
+convert_dump_alias("all", "abcdfgilmnprstuvzBCMPST").
+convert_dump_alias("most", "bcdfgilmnprstuvzP").
+convert_dump_alias("trans", "bcdglmnstuvz").
convert_dump_alias("codegen", "dfnprsu").
convert_dump_alias("vanessa", "ltuCIU").
convert_dump_alias("min", "ilv").
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.165
diff -u -b -r1.165 higher_order.m
--- compiler/higher_order.m 6 Jan 2007 09:23:33 -0000 1.165
+++ compiler/higher_order.m 17 Jan 2007 07:28:36 -0000
@@ -108,7 +108,7 @@
!:Info = higher_order_global_info(Requests0, NewPreds0, VersionInfo0,
!.ModuleInfo, GoalSizes0, Params, counter.init(1)),
- module_info_predids(!.ModuleInfo, PredIds0),
+ module_info_predids(PredIds0, !ModuleInfo),
module_info_get_type_spec_info(!.ModuleInfo, TypeSpecInfo),
TypeSpecInfo = type_spec_info(_, UserSpecPreds, _, _),
%
@@ -1084,7 +1084,8 @@
get_typeclass_info_args(ModuleInfo, TypeClassInfoVar, PredName, MakeResultType,
Args, Index, Goals, Vars, !ProcInfo) :-
lookup_builtin_pred_proc_id(ModuleInfo, mercury_private_builtin_module,
- PredName, predicate, 3, only_mode, ExtractArgPredId, ExtractArgProcId),
+ PredName, pf_predicate, 3, only_mode, ExtractArgPredId,
+ ExtractArgProcId),
get_typeclass_info_args_2(TypeClassInfoVar,
ExtractArgPredId, ExtractArgProcId,
qualified(mercury_private_builtin_module, PredName),
@@ -2626,7 +2627,7 @@
% This isn't looked at after here, and just clutters up HLDS dumps
% if it's filled in.
set_clause_list([], ClausesRep),
- EmptyHeadVars = proc_arg_vector_init(predicate, []),
+ EmptyHeadVars = proc_arg_vector_init(pf_predicate, []),
ClausesInfo = clauses_info(EmptyVarSet, EmptyVarTypes,
EmptyTVarNameMap, EmptyVarTypes, EmptyHeadVars, ClausesRep,
EmptyRttiVarMaps, no),
Index: compiler/hlds_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_args.m,v
retrieving revision 1.3
diff -u -b -r1.3 hlds_args.m
--- compiler/hlds_args.m 15 Jan 2007 10:30:30 -0000 1.3
+++ compiler/hlds_args.m 17 Jan 2007 07:08:05 -0000
@@ -280,11 +280,11 @@
proc_arg_vector_init(PredOrFunc, Args0) = ArgVec :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Args = Args0,
MaybeRetVal = no
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
list.det_split_last(Args0, Args, RetVal),
MaybeRetVal = yes(RetVal)
),
@@ -671,7 +671,7 @@
%
:- type poly_arg_vector(T) == proc_arg_vector(T).
-poly_arg_vector_init = proc_arg_vector_init(predicate, []).
+poly_arg_vector_init = proc_arg_vector_init(pf_predicate, []).
poly_arg_vector_set_instance_type_infos(ITI, !A) :-
proc_arg_vector_set_instance_type_infos(ITI, !A).
Index: compiler/hlds_clauses.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_clauses.m,v
retrieving revision 1.7
diff -u -b -r1.7 hlds_clauses.m
--- compiler/hlds_clauses.m 21 Dec 2006 06:33:57 -0000 1.7
+++ compiler/hlds_clauses.m 17 Jan 2007 07:08:05 -0000
@@ -211,7 +211,7 @@
map.init(TVarNameMap),
% Procedures introduced for assertions are always predicates, never
% functions.
- HeadVarVec = proc_arg_vector_init(predicate, HeadVars),
+ HeadVarVec = proc_arg_vector_init(pf_predicate, HeadVars),
set_clause_list([], ClausesRep),
rtti_varmaps_init(RttiVarMaps),
HasForeignClauses = no,
Index: compiler/hlds_error_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_error_util.m,v
retrieving revision 1.25
diff -u -b -r1.25 hlds_error_util.m
--- compiler/hlds_error_util.m 1 Dec 2006 15:03:58 -0000 1.25
+++ compiler/hlds_error_util.m 17 Jan 2007 07:08:05 -0000
@@ -153,12 +153,11 @@
unexpected(this_file, "describe_one_pred_name_mode: bad argument list")
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
ArgModesPart = arg_modes_to_string(InstVarSet, StrippedArgModes)
;
- PredOrFunc = function,
- pred_args_to_func_args(StrippedArgModes, FuncArgModes,
- FuncRetMode),
+ PredOrFunc = pf_function,
+ pred_args_to_func_args(StrippedArgModes, FuncArgModes, FuncRetMode),
ArgModesPart = arg_modes_to_string(InstVarSet, FuncArgModes)
++ " = " ++ mercury_mode_to_string(FuncRetMode, InstVarSet)
),
Index: compiler/hlds_goal.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_goal.m,v
retrieving revision 1.175
diff -u -b -r1.175 hlds_goal.m
--- compiler/hlds_goal.m 6 Jan 2007 10:56:12 -0000 1.175
+++ compiler/hlds_goal.m 17 Jan 2007 07:08:05 -0000
@@ -1466,8 +1466,8 @@
generic_call_pred_or_func(higher_order(_, _, PredOrFunc, _)) = PredOrFunc.
generic_call_pred_or_func(class_method(_, _, _, CallId)) =
simple_call_id_pred_or_func(CallId).
-generic_call_pred_or_func(event_call(_)) = predicate.
-generic_call_pred_or_func(cast(_)) = predicate.
+generic_call_pred_or_func(event_call(_)) = pf_predicate.
+generic_call_pred_or_func(cast(_)) = pf_predicate.
:- func simple_call_id_pred_or_func(simple_call_id) = pred_or_func.
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.148
diff -u -b -r1.148 hlds_module.m
--- compiler/hlds_module.m 19 Dec 2006 07:00:54 -0000 1.148
+++ compiler/hlds_module.m 18 Jan 2007 02:07:09 -0000
@@ -536,15 +536,11 @@
% get removed from this list, so that later passes can rely
% on the predicates in this list being type-correct, etc.)
%
-:- pred module_info_predids(module_info::in, list(pred_id)::out) is det.
-
- % Reverse the list of pred_ids.
- % (The list is built up by inserting values at the front,
- % for efficiency; once we've done so, we reverse the list
- % so that progress messages and error messages come out
- % in the expected order.)
+ % This operation does not logically change the module_info,
+ % but does update it physically.
%
-:- pred module_info_reverse_predids(module_info::in, module_info::out) is det.
+:- pred module_info_predids(list(pred_id)::out,
+ module_info::in, module_info::out) is det.
% Remove a predicate from the list of pred_ids, to prevent
% further processing of this predicate after an error is encountered.
@@ -1079,13 +1075,9 @@
module_info_pred_proc_info(MI, proc(PredId, ProcId), PredInfo, ProcInfo) :-
module_info_pred_proc_info(MI, PredId, ProcId, PredInfo, ProcInfo).
-module_info_predids(MI, PredIds) :-
- module_info_get_predicate_table(MI, PredTable),
- predicate_table_get_predids(PredTable, PredIds).
-
-module_info_reverse_predids(!MI) :-
+module_info_predids(PredIds, !MI) :-
module_info_get_predicate_table(!.MI, PredTable0),
- predicate_table_reverse_predids(PredTable0, PredTable),
+ predicate_table_get_predids(PredIds, PredTable0, PredTable),
module_info_set_predicate_table(PredTable, !MI).
module_info_remove_predid(PredId, !MI) :-
@@ -1227,8 +1219,8 @@
module_add_foreign_decl(Lang, IsLocal, ForeignDecl, Context, !Module) :-
module_info_get_foreign_decl(!.Module, ForeignDeclIndex0),
% Store the decls in reverse order and reverse them later for efficiency.
- ForeignDeclIndex = [foreign_decl_code(Lang, IsLocal, ForeignDecl,
- Context) | ForeignDeclIndex0],
+ ForeignDeclIndex = [foreign_decl_code(Lang, IsLocal, ForeignDecl, Context)
+ | ForeignDeclIndex0],
module_info_set_foreign_decl(ForeignDeclIndex, !Module).
module_add_foreign_body_code(Lang, Foreign_Body_Code, Context, !Module) :-
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.424
diff -u -b -r1.424 hlds_out.m
--- compiler/hlds_out.m 15 Jan 2007 10:30:30 -0000 1.424
+++ compiler/hlds_out.m 17 Jan 2007 11:56:03 -0000
@@ -475,7 +475,7 @@
arg_number_to_string(plain_call_id(simple_call_id(PredOrFunc, _, Arity)),
ArgNum) =
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Arity = ArgNum
->
"the return value"
@@ -485,7 +485,7 @@
arg_number_to_string(generic_call_id(
gcid_higher_order(_Purity, PredOrFunc, Arity)), ArgNum) = Str :-
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
ArgNum = Arity
->
Str = "the return value"
@@ -710,22 +710,31 @@
pred_id::in, io::di, io::uo) is det.
maybe_write_pred(Indent, ModuleInfo, PredTable, PredId, !IO) :-
- globals.io_lookup_string_option(dump_hlds_options, Verbose, !IO),
- globals.io_lookup_int_option(dump_hlds_pred_id, DumpPredId, !IO),
+ module_info_get_globals(ModuleInfo, Globals),
+ globals.lookup_string_option(Globals, dump_hlds_options, Verbose),
+ globals.lookup_accumulating_option(Globals, dump_hlds_pred_id,
+ DumpPredIdStrs),
pred_id_to_int(PredId, PredIdInt),
map.lookup(PredTable, PredId, PredInfo),
(
- % If the user requested one predicate/function to be dumped,
- % we dump it even if the condition of the nested if-then-else
+ % If the user requested one or more predicates/functions to be dumped,
+ % we dump them even if the condition of the nested if-then-else
% says it shouldn't be dumped, and we don't dump anything else.
- DumpPredId >= 0
+ DumpPredIdStrs = [_ | _],
+ (
+ some [DumpPredIdStr, DumpPredId] (
+ list.member(DumpPredIdStr, DumpPredIdStrs),
+ string.to_int(DumpPredIdStr, DumpPredId),
+ PredIdInt = DumpPredId
+ )
->
- ( PredIdInt = DumpPredId ->
write_pred(Indent, ModuleInfo, PredId, PredInfo, !IO)
;
true
)
;
+ DumpPredIdStrs = [],
+ (
(
\+ string.contains_char(Verbose, 'I'),
pred_info_is_imported(PredInfo)
@@ -739,8 +748,9 @@
ProcIds = [ProcId]
;
% We dump unification and other compiler-generated special
- % predicates if suboption 'U' is on. We don't need that information
- % to understand how the program has been transformed.
+ % predicates if suboption 'U' is on. We don't need that
+ % information to understand how the program has been
+ % transformed.
\+ string.contains_char(Verbose, 'U'),
is_unify_or_compare_pred(PredInfo)
)
@@ -748,9 +758,10 @@
true
;
write_pred(Indent, ModuleInfo, PredId, PredInfo, !IO)
+ )
).
-:- pred write_pred(int::in, module_info::in, pred_id::in, pred_info::in,
+ :- pred write_pred(int::in, module_info::in, pred_id::in, pred_info::in,
io::di, io::uo) is det.
write_pred(Indent, ModuleInfo, PredId, PredInfo, !IO) :-
@@ -778,12 +789,12 @@
( string.contains_char(Verbose, 'C') ->
% Information about predicates is dumped if 'C' suboption is on.
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_type(TVarSet, ExistQVars,
qualified(Module, PredName), ArgTypes, no, Purity,
ClassContext, Context, AppendVarNums, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgTypes, FuncArgTypes, FuncRetType),
mercury_output_func_type(TVarSet, ExistQVars,
qualified(Module, PredName), FuncArgTypes, FuncRetType, no,
@@ -1138,7 +1149,7 @@
PredName = predicate_name(ModuleInfo, PredId),
ModuleName = predicate_module(ModuleInfo, PredId),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(HeadTerms, FuncArgs, RetVal),
write_qualified_functor_with_term_args(ModuleName,
term.atom(PredName), FuncArgs, VarSet, AppendVarNums, !IO),
@@ -1146,7 +1157,7 @@
mercury_output_term_nq(VarSet, AppendVarNums, next_to_graphic_token,
RetVal, !IO)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
write_qualified_functor_with_term_args(ModuleName,
term.atom(PredName), HeadTerms, VarSet, AppendVarNums, !IO)
).
@@ -1297,6 +1308,22 @@
;
true
),
+ ( string.contains_char(Verbose, 'z') ->
+ goal_info_get_purity(GoalInfo, Purity),
+ (
+ Purity = purity_pure
+ ;
+ Purity = purity_semipure,
+ write_indent(Indent, !IO),
+ io.write_string("% semipure\n ", !IO)
+ ;
+ Purity = purity_impure,
+ write_indent(Indent, !IO),
+ io.write_string("% impure\n ", !IO)
+ )
+ ;
+ true
+ ),
write_goal_2(GoalExpr, ModuleInfo, VarSet, AppendVarNums, Indent, Follow,
TypeQual, !IO),
( string.contains_char(Verbose, 'i') ->
@@ -1674,7 +1701,7 @@
GenericCall = higher_order(PredVar, Purity, PredOrFunc, _),
globals.io_lookup_string_option(dump_hlds_options, Verbose, !IO),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
( string.contains_char(Verbose, 'l') ->
write_indent(Indent, !IO),
io.write_string("% higher-order predicate call\n", !IO)
@@ -1686,7 +1713,7 @@
write_functor(term.atom("call"), [PredVar | ArgVars], VarSet,
AppendVarNums, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
( string.contains_char(Verbose, 'l') ->
write_indent(Indent, !IO),
io.write_string("% higher-order function application\n", !IO)
@@ -1789,7 +1816,7 @@
write_indent(Indent, !IO),
( PredId = invalid_pred_id ->
% If we don't know then the call must be treated as a predicate.
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
module_info_pred_info(ModuleInfo, PredId, PredInfo),
pred_info_get_purity(PredInfo, Purity),
@@ -1797,10 +1824,10 @@
write_purity_prefix(Purity, !IO)
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
NewArgVars = ArgVars
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgVars, NewArgVars, LHSVar),
mercury_output_var(VarSet, AppendVarNums, LHSVar, !IO),
io.write_string(" = ", !IO)
@@ -2470,7 +2497,7 @@
Indent1 = Indent + 1,
write_purity_prefix(Purity, !IO),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
io.write_string("(", !IO),
(
Vars = [],
@@ -2490,7 +2517,7 @@
write_indent(Indent, !IO),
io.write_string(")", !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, ArgModes, RetMode),
pred_args_to_func_args(Vars, ArgVars, RetVar),
io.write_string("(", !IO),
@@ -2925,7 +2952,7 @@
map.count(VarTypes, NumVarTypes),
write_indent(Indent, !IO),
io.write_string("% variable types map ", !IO),
- io.format("(%d entries): ", [i(NumVarTypes)], !IO),
+ io.format("(%d entries):\n", [i(NumVarTypes)], !IO),
map.keys(VarTypes, Vars),
write_var_types_2(Vars, Indent, VarSet, AppendVarNums, VarTypes, TVarSet,
!IO).
@@ -3700,11 +3727,11 @@
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
varset.init(ModeVarSet),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_decl(ModeVarSet, unqualified(PredName),
HeadModes, DeclaredDeterminism, ModeContext, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(HeadModes, FuncHeadModes, RetHeadMode),
mercury_output_func_mode_decl(ModeVarSet, unqualified(PredName),
FuncHeadModes, RetHeadMode, DeclaredDeterminism, ModeContext, !IO)
@@ -3885,7 +3912,7 @@
( Indent = 0 ->
true
;
- io.write_char('\t', !IO),
+ io.write_string(" ", !IO),
write_indent(Indent - 1, !IO)
).
@@ -4043,12 +4070,12 @@
GroundInstInfo = higher_order(pred_inst_info(PredOrFunc, Modes, Det)),
% XXX we ignore Uniq
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
construct_qualified_term(unqualified("pred"),
list.map(mode_to_term_with_context(Context), Modes),
Context, ModesTerm)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, ArgModes, RetMode),
construct_qualified_term(unqualified("func"),
list.map(mode_to_term_with_context(Context), ArgModes),
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.223
diff -u -b -r1.223 hlds_pred.m
--- compiler/hlds_pred.m 15 Jan 2007 10:30:31 -0000 1.223
+++ compiler/hlds_pred.m 17 Jan 2007 07:08:05 -0000
@@ -1132,7 +1132,7 @@
set.init(Assertions),
- pred_info_create(ModuleName, SymName, predicate, Context, Origin,
+ pred_info_create(ModuleName, SymName, pf_predicate, Context, Origin,
ExportStatus, Markers, ArgTypes, TVarSet, ExistQVars,
ClassContext, Assertions, ProcInfo, ProcId, PredInfo),
@@ -2774,11 +2774,11 @@
map.contains(CtorFieldTable, FieldName).
pred_info_is_field_access_function(ModuleInfo, PredInfo) :-
- pred_info_is_pred_or_func(PredInfo) = function,
+ pred_info_is_pred_or_func(PredInfo) = pf_function,
Module = pred_info_module(PredInfo),
Name = pred_info_name(PredInfo),
PredArity = pred_info_orig_arity(PredInfo),
- adjust_func_arity(function, FuncArity, PredArity),
+ adjust_func_arity(pf_function, FuncArity, PredArity),
is_field_access_function_name(ModuleInfo, qualified(Module, Name),
FuncArity, _, _).
Index: compiler/ilasm.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ilasm.m,v
retrieving revision 1.49
diff -u -b -r1.49 ilasm.m
--- compiler/ilasm.m 20 Sep 2006 09:42:06 -0000 1.49
+++ compiler/ilasm.m 18 Jan 2007 03:46:58 -0000
@@ -22,6 +22,8 @@
% [ ] Add any missing functionality from the assembler grammar
% (events, properties, etc).
% [ ] Fix up all the XXXs.
+% [ ] Replace all reference to io.write with predicates that do not depend
+% on the compiler's internal data representations.
%
%-----------------------------------------------------------------------------%
Index: compiler/implicit_parallelism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/implicit_parallelism.m,v
retrieving revision 1.1
diff -u -b -r1.1 implicit_parallelism.m
--- compiler/implicit_parallelism.m 13 Jan 2007 12:23:08 -0000 1.1
+++ compiler/implicit_parallelism.m 17 Jan 2007 07:28:45 -0000
@@ -110,9 +110,9 @@
io.write_string(Stderr, Error ++ "\n", !IO)
;
MaybeCandidateCallSites = ok(CandidateCallSites),
- module_info_predids(!.ModuleInfo, PredIds),
- process_preds_for_implicit_parallelism(PredIds,
- CandidateCallSites, !ModuleInfo)
+ module_info_predids(PredIds, !ModuleInfo),
+ process_preds_for_implicit_parallelism(PredIds, CandidateCallSites,
+ !ModuleInfo)
).
% Process predicates for implicit parallelism.
@@ -421,7 +421,7 @@
ProcIdInt = proc_id_to_int(ProcId),
RawId = string.append_list([ ModuleString, ".", Name, "/",
string.int_to_string(OrigArity),
- ( IsPredOrFunc = function -> "+1" ; ""), "-",
+ ( IsPredOrFunc = pf_function -> "+1" ; ""), "-",
string.from_int(ProcIdInt) ]).
% Succeeds if the caller, slot number and callee correspond to a
Index: compiler/inlining.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/inlining.m,v
retrieving revision 1.152
diff -u -b -r1.152 inlining.m
--- compiler/inlining.m 15 Jan 2007 02:23:46 -0000 1.152
+++ compiler/inlining.m 17 Jan 2007 07:08:05 -0000
@@ -230,7 +230,7 @@
; CompoundThreshold > 0
)
->
- dead_proc_analyze(!.ModuleInfo, NeededMap)
+ dead_proc_analyze(!ModuleInfo, NeededMap)
;
map.init(NeededMap)
),
Index: compiler/inst_match.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/inst_match.m,v
retrieving revision 1.79
diff -u -b -r1.79 inst_match.m
--- compiler/inst_match.m 15 Jan 2007 10:30:31 -0000 1.79
+++ compiler/inst_match.m 17 Jan 2007 07:08:05 -0000
@@ -784,7 +784,7 @@
GroundInstInfoA).
ground_inst_info_matches_initial(none, higher_order(PredInstB), _, Type,
!Info) :-
- PredInstB = pred_inst_info(function, ArgModes, _Det),
+ PredInstB = pred_inst_info(pf_function, ArgModes, _Det),
Arity = list.length(ArgModes),
PredInstA = pred_inst_info_standard_func_mode(Arity),
pred_inst_matches_2(PredInstA, PredInstB, Type, !Info).
@@ -1087,7 +1087,7 @@
\+ ground_inst_info_is_nonstandard_func_mode(!.Info ^ module_info,
GroundInstInfoA).
ground_inst_info_matches_final(none, higher_order(PredInstB), Type, !Info) :-
- PredInstB = pred_inst_info(function, ArgModes, _Det),
+ PredInstB = pred_inst_info(pf_function, ArgModes, _Det),
Arity = list.length(ArgModes),
PredInstA = pred_inst_info_standard_func_mode(Arity),
pred_inst_matches_2(PredInstA, PredInstB, Type, !Info).
@@ -1231,7 +1231,7 @@
ground_inst_info_matches_binding(_, none, _, _).
ground_inst_info_matches_binding(none, higher_order(PredInstB), MaybeType,
ModuleInfo) :-
- PredInstB = pred_inst_info(function, ArgModes, _Det),
+ PredInstB = pred_inst_info(pf_function, ArgModes, _Det),
Arity = list.length(ArgModes),
PredInstA = pred_inst_info_standard_func_mode(Arity),
pred_inst_matches_1(PredInstA, PredInstB, MaybeType, ModuleInfo).
Index: compiler/inst_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/inst_util.m,v
retrieving revision 1.53
diff -u -b -r1.53 inst_util.m
--- compiler/inst_util.m 15 Jan 2007 10:30:32 -0000 1.53
+++ compiler/inst_util.m 17 Jan 2007 07:08:05 -0000
@@ -1748,7 +1748,7 @@
%-----------------------------------------------------------------------------%
pred_inst_info_is_nonstandard_func_mode(ModuleInfo, PredInstInfo) :-
- PredInstInfo = pred_inst_info(function, ArgModes, _),
+ PredInstInfo = pred_inst_info(pf_function, ArgModes, _),
Arity = list.length(ArgModes),
\+ pred_inst_matches(PredInstInfo,
pred_inst_info_standard_func_mode(Arity), ModuleInfo).
@@ -1758,7 +1758,7 @@
pred_inst_info_is_nonstandard_func_mode(ModuleInfo, PredInstInfo).
pred_inst_info_standard_func_mode(Arity) =
- pred_inst_info(function, ArgModes, detism_det) :-
+ pred_inst_info(pf_function, ArgModes, detism_det) :-
in_mode(InMode),
out_mode(OutMode),
ArgModes = list.duplicate(Arity - 1, InMode) ++ [OutMode].
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.217
diff -u -b -r1.217 intermod.m
--- compiler/intermod.m 8 Jan 2007 03:03:10 -0000 1.217
+++ compiler/intermod.m 17 Jan 2007 15:40:20 -0000
@@ -54,13 +54,13 @@
% they must be called after unused_args.m appends its information
% to the .opt.tmp file.
%
-:- pred write_optfile(module_info::in, module_info::out, io::di, io::uo)
+:- pred write_opt_file(module_info::in, module_info::out, io::di, io::uo)
is det.
% Add the items from the .opt files of imported modules to
% the items for this module.
%
-:- pred grab_optfiles(module_imports::in, module_imports::out, bool::out,
+:- pred grab_opt_files(module_imports::in, module_imports::out, bool::out,
io::di, io::uo) is det.
% Make sure that local preds which have been exported in the .opt
@@ -70,8 +70,8 @@
io::di, io::uo) is det.
:- type opt_file_type
- ---> opt
- ; trans_opt.
+ ---> opt_file
+ ; trans_opt_file.
% update_error_status(OptFileType, FileName, Error, Messages, !Status):
%
@@ -134,7 +134,7 @@
%-----------------------------------------------------------------------------%
-write_optfile(!ModuleInfo, !IO) :-
+write_opt_file(!ModuleInfo, !IO) :-
% We don't want to output line numbers in the .opt files,
% since that causes spurious changes to the .opt files
% when you make trivial changes (e.g. add comments) to the source files.
@@ -152,7 +152,7 @@
;
Result = ok(FileStream),
io.set_output_stream(FileStream, OutputStream, !IO),
- module_info_predids(!.ModuleInfo, RealPredIds),
+ module_info_predids(RealPredIds, !ModuleInfo),
module_info_get_assertion_table(!.ModuleInfo, AssertionTable),
assertion_table_pred_ids(AssertionTable, AssertPredIds),
list.append(AssertPredIds, RealPredIds, PredIds),
@@ -193,17 +193,16 @@
ProcessLocalPreds = no,
gather_pred_list(AllPredIds, ProcessLocalPreds, CollectTypes,
InlineThreshold, HigherOrderSizeLimit, Deforestation, !Info),
- %
+
% Then gather preds used by exported preds (recursively).
- %
set.init(ExtraExportedPreds0),
- gather_preds_2(ExtraExportedPreds0, CollectTypes, InlineThreshold,
+ gather_preds_fixpoint(ExtraExportedPreds0, CollectTypes, InlineThreshold,
HigherOrderSizeLimit, Deforestation, !Info).
-:- pred gather_preds_2(set(pred_id)::in, bool::in, int::in, int::in, bool::in,
- intermod_info::in, intermod_info::out) is det.
+:- pred gather_preds_fixpoint(set(pred_id)::in, bool::in, int::in, int::in,
+ bool::in, intermod_info::in, intermod_info::out) is det.
-gather_preds_2(ExtraExportedPreds0, CollectTypes, InlineThreshold,
+gather_preds_fixpoint(ExtraExportedPreds0, CollectTypes, InlineThreshold,
HigherOrderSizeLimit, Deforestation, !Info) :-
intermod_info_get_pred_decls(!.Info, ExtraExportedPreds),
NewlyExportedPreds = set.to_sorted_list(
@@ -215,8 +214,8 @@
ProcessLocalPreds = yes,
gather_pred_list(NewlyExportedPreds, ProcessLocalPreds, CollectTypes,
InlineThreshold, HigherOrderSizeLimit, Deforestation, !Info),
- gather_preds_2(ExtraExportedPreds, CollectTypes, InlineThreshold,
- HigherOrderSizeLimit, Deforestation, !Info)
+ gather_preds_fixpoint(ExtraExportedPreds, CollectTypes,
+ InlineThreshold, HigherOrderSizeLimit, Deforestation, !Info)
).
:- pred gather_pred_list(list(pred_id)::in, bool::in, bool::in,
@@ -847,7 +846,7 @@
InstanceMethodDefn0, MethodArity, MethodContext),
(
InstanceMethodDefn0 = instance_proc_def_name(InstanceMethodName0),
- PredOrFunc = function,
+ PredOrFunc = pf_function,
(
find_func_matching_instance_method(ModuleInfo, InstanceMethodName0,
MethodArity, MethodCallTVarSet, MethodCallArgTypes,
@@ -871,7 +870,7 @@
)
;
InstanceMethodDefn0 = instance_proc_def_name(InstanceMethodName0),
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
init_markers(Markers),
resolve_pred_overloading(ModuleInfo, Markers,
MethodCallArgTypes, MethodCallTVarSet,
@@ -1142,7 +1141,7 @@
%-----------------------------------------------------------------------------%
- % Output module imports, types, modes, insts and predicates
+ % Output module imports, types, modes, insts and predicates.
%
:- pred write_intermod_info(intermod_info::in, io::di, io::uo) is det.
@@ -1157,10 +1156,9 @@
intermod_info_get_pred_decls(IntermodInfo, PredDecls),
intermod_info_get_instances(IntermodInfo, Instances),
(
- %
- % If none of these item types need writing, nothing
- % else needs to be written.
- %
+ % If none of these item types need writing, nothing else
+ % needs to be written.
+
set.empty(Preds),
set.empty(PredDecls),
Instances = [],
@@ -1175,13 +1173,13 @@
->
true
;
- write_intermod_info_2(IntermodInfo, !IO)
+ write_intermod_info_body(IntermodInfo, !IO)
).
-:- pred write_intermod_info_2(intermod_info::in, io::di, io::uo) is det.
+:- pred write_intermod_info_body(intermod_info::in, io::di, io::uo) is det.
-write_intermod_info_2(IntermodInfo, !IO) :-
- IntermodInfo = info(_, Preds0, PredDecls0, Instances, Types,
+write_intermod_info_body(IntermodInfo, !IO) :-
+ IntermodInfo = intermod_info(_, Preds0, PredDecls0, Instances, Types,
ModuleInfo, WriteHeader, _, _),
set.to_sorted_list(Preds0, Preds),
set.to_sorted_list(PredDecls0, PredDecls),
@@ -1190,8 +1188,8 @@
set.to_sorted_list(Modules0, Modules),
(
Modules = [_ | _],
- % XXX this could be reduced to the set that is actually needed
- % by the items being written.
+ % XXX Modules could and should be reduced to the set of modules
+ % that are actually needed by the items being written.
io.write_string(":- use_module ", !IO),
write_modules(Modules, !IO)
;
@@ -1489,11 +1487,11 @@
AppendVarNums = yes
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_type(TVarSet, ExistQVars, qualified(Module, Name),
ArgTypes, no, Purity, ClassContext, Context, AppendVarNums, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgTypes, FuncArgTypes, FuncRetType),
mercury_output_func_type(TVarSet, ExistQVars, qualified(Module, Name),
FuncArgTypes, FuncRetType, no, Purity, ClassContext, Context,
@@ -1538,12 +1536,12 @@
proc_info_get_context(ProcInfo, Context),
varset.init(Varset),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgModes, FuncArgModes, FuncRetMode),
mercury_output_func_mode_decl(Varset, SymName,
FuncArgModes, FuncRetMode, yes(Detism), Context, !IO)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_decl(Varset, SymName, ArgModes,
yes(Detism), Context, !IO)
),
@@ -1855,31 +1853,33 @@
% A collection of stuff to go in the .opt file.
%
:- type intermod_info
- ---> info(
- im_modules :: set(module_name),
+ ---> intermod_info(
% Modules to import.
+ im_modules :: set(module_name),
- im_preds :: set(pred_id),
% Preds to output clauses for.
+ im_preds :: set(pred_id),
- im_pred_decls :: set(pred_id),
% Preds to output decls for.
+ im_pred_decls :: set(pred_id),
- im_instances :: assoc_list(class_id, hlds_instance_defn),
% Instances declarations to write.
+ im_instances :: assoc_list(class_id,
+ hlds_instance_defn),
- im_types :: assoc_list(type_ctor, hlds_type_defn),
% Type declarations to write.
+ im_types :: assoc_list(type_ctor,
+ hlds_type_defn),
im_module_info :: module_info,
- im_write_foreign_header :: bool,
% Do the pragma foreign_decls for the module need writing,
% yes if there are pragma foreign_procs being exported.
+ im_write_foreign_header :: bool,
+ % Vartypes and tvarset for the current pred.
im_var_types :: vartypes,
im_tvarset :: tvarset
- % Vartypes and tvarset for the current pred.
).
:- pred init_intermod_info(module_info::in, intermod_info::out) is det.
@@ -1892,7 +1892,7 @@
varset.init(TVarSet),
Instances = [],
Types = [],
- IntermodInfo = info(Modules, Procs, ProcDecls, Instances, Types,
+ IntermodInfo = intermod_info(Modules, Procs, ProcDecls, Instances, Types,
ModuleInfo, no, VarTypes, TVarSet).
:- pred intermod_info_get_modules(intermod_info::in, set(module_name)::out)
@@ -1961,25 +1961,25 @@
% the .opt file are exported, and inhibit dead proc elimination
% on those preds.
%
-adjust_pred_import_status(!Module, !IO) :-
+adjust_pred_import_status(!ModuleInfo, !IO) :-
globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
maybe_write_string(VeryVerbose,
"% Adjusting import status of predicates in the `.opt' file...", !IO),
- module_info_predids(!.Module, PredIds),
- module_info_get_globals(!.Module, Globals),
+ module_info_predids(PredIds, !ModuleInfo),
+ module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_int_option(Globals, intermod_inline_simple_threshold,
Threshold),
globals.lookup_bool_option(Globals, deforestation, Deforestation),
globals.lookup_int_option(Globals, higher_order_size_limit,
HigherOrderSizeLimit),
some [!Info] (
- init_intermod_info(!.Module, !:Info),
+ init_intermod_info(!.ModuleInfo, !:Info),
gather_preds(PredIds, yes, Threshold, HigherOrderSizeLimit,
Deforestation, !Info),
gather_instances(!Info),
gather_types(!Info),
- do_adjust_pred_import_status(!.Info, !Module)
+ do_adjust_pred_import_status(!.Info, !ModuleInfo)
),
maybe_write_string(VeryVerbose, " done\n", !IO).
@@ -2167,7 +2167,7 @@
% Read in and process the optimization interfaces.
%
-grab_optfiles(!Module, FoundError, !IO) :-
+grab_opt_files(!Module, FoundError, !IO) :-
% Read in the .opt files for imported and ancestor modules.
ModuleName = !.Module ^ module_name,
Ancestors0 = !.Module ^ parent_deps,
@@ -2278,7 +2278,8 @@
module_name_to_search_file_name(ModuleToRead, ".opt", FileName, !IO),
prog_io.read_opt_file(FileName, ModuleToRead,
ModuleError, Messages, OptItems, !IO),
- update_error_status(opt, FileName, ModuleError, Messages, !Error, !IO),
+ update_error_status(opt_file, FileName, ModuleError, Messages, !Error,
+ !IO),
!:Items = !.Items ++ OptItems,
maybe_write_string(VeryVerbose, "% done.\n", !IO),
@@ -2311,10 +2312,10 @@
;
ModuleError = fatal_module_errors,
(
- FileType = opt,
+ FileType = opt_file,
WarningOption = warn_missing_opt_files
;
- FileType = trans_opt,
+ FileType = trans_opt_file,
WarningOption = warn_missing_trans_opt_files
),
globals.io_lookup_bool_option(WarningOption, DoWarn, !IO),
Index: compiler/lambda.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lambda.m,v
retrieving revision 1.127
diff -u -b -r1.127 lambda.m
--- compiler/lambda.m 6 Jan 2007 09:23:37 -0000 1.127
+++ compiler/lambda.m 17 Jan 2007 07:08:05 -0000
@@ -133,7 +133,7 @@
%
lambda_process_module(!ModuleInfo) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl(lambda_process_pred, PredIds, !ModuleInfo),
% Need update the dependency graph to include the lambda predicates.
module_info_clobber_dependency_info(!ModuleInfo).
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.87
diff -u -b -r1.87 layout_out.m
--- compiler/layout_out.m 12 Jan 2007 05:49:14 -0000 1.87
+++ compiler/layout_out.m 17 Jan 2007 07:08:05 -0000
@@ -2156,10 +2156,10 @@
output_pred_or_func(PredOrFunc, !IO) :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
io.write_string("MR_PREDICATE", !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
io.write_string("MR_FUNCTION", !IO)
).
Index: compiler/lco.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/lco.m,v
retrieving revision 1.44
diff -u -b -r1.44 lco.m
--- compiler/lco.m 6 Jan 2007 09:23:37 -0000 1.44
+++ compiler/lco.m 17 Jan 2007 13:02:02 -0000
@@ -126,6 +126,8 @@
:- import_module hlds.pred_table.
:- import_module hlds.quantification.
:- import_module libs.compiler_util.
+:- import_module libs.globals.
+:- import_module libs.options.
:- import_module mdbcomp.prim_data.
:- import_module parse_tree.prog_data.
:- import_module parse_tree.prog_mode.
@@ -153,7 +155,8 @@
---> variant_id(
list(int), % Positions of output arguments returned in
% memory.
- pred_proc_id % The id of the variant.
+ pred_proc_id, % The id of the variant.
+ string % The name of the variant predicate.
).
:- type variant_map == map(pred_proc_id, variant_id).
@@ -222,19 +225,19 @@
process_proc_update(PredProcId - NewProcInfo, !ModuleInfo) :-
PredProcId = proc(PredId, ProcId),
- module_info_preds(!.ModuleInfo, Preds0),
- map.lookup(Preds0, PredId, PredInfo0),
+ module_info_preds(!.ModuleInfo, PredTable0),
+ map.lookup(PredTable0, PredId, PredInfo0),
pred_info_get_procedures(PredInfo0, Procs0),
map.det_update(Procs0, ProcId, NewProcInfo, Procs),
pred_info_set_procedures(Procs, PredInfo0, PredInfo),
- map.det_update(Preds0, PredId, PredInfo, Preds),
- module_info_set_preds(Preds, !ModuleInfo).
+ map.det_update(PredTable0, PredId, PredInfo, PredTable),
+ module_info_set_preds(PredTable, !ModuleInfo).
:- pred process_proc_variant(pair(pred_proc_id, variant_id)::in,
module_info::in, module_info::out) is det.
process_proc_variant(PredProcId - VariantId, !ModuleInfo) :-
- VariantId = variant_id(AddrOutArgPosns, VariantPredProcId),
+ VariantId = variant_id(AddrOutArgPosns, VariantPredProcId, VariantName),
VariantPredProcId = proc(VariantPredId, VariantProcId),
PredProcId = proc(PredId, ProcId),
@@ -243,34 +246,24 @@
transform_variant_proc(!.ModuleInfo, AddrOutArgPosns,
ProcInfo, VariantProcInfo),
- some [!VariantPredInfo] (
- module_info_preds(!.ModuleInfo, Preds0),
- map.lookup(Preds0, VariantPredId, !:VariantPredInfo),
- Name0 = pred_info_name(!.VariantPredInfo),
+ some [!VariantPredInfo, !PredTable] (
+ module_info_preds(!.ModuleInfo, !:PredTable),
+ map.lookup(!.PredTable, VariantPredId, !:VariantPredInfo),
+ pred_info_set_name(VariantName, !VariantPredInfo),
+ pred_info_set_is_pred_or_func(pf_predicate, !VariantPredInfo),
pred_info_get_origin(!.VariantPredInfo, Origin0),
- create_variant_name(AddrOutArgPosns, Name0, Name),
Transform = transform_return_via_ptr(ProcId, AddrOutArgPosns),
Origin = origin_transformed(Transform, Origin0, PredId),
- pred_info_set_name(Name, !VariantPredInfo),
pred_info_set_origin(Origin, !VariantPredInfo),
% We throw away any other procs in the variant predicate, because
% we create a separate predicate for each variant.
- map.det_insert(map.init, VariantProcId, VariantProcInfo,
- VariantProcs),
+ map.det_insert(map.init, VariantProcId, VariantProcInfo, VariantProcs),
pred_info_set_procedures(VariantProcs, !VariantPredInfo),
- map.det_update(Preds0, VariantPredId, !.VariantPredInfo, Preds),
- module_info_set_preds(Preds, !ModuleInfo)
+ svmap.det_update(VariantPredId, !.VariantPredInfo, !PredTable),
+ module_info_set_preds(!.PredTable, !ModuleInfo)
).
-:- pred create_variant_name(list(int)::in, string::in, string::out) is det.
-
-create_variant_name([], !Name) :-
- !:Name = "LCMC_" ++ !.Name.
-create_variant_name([ArgPos | ArgPoss], !Name) :-
- !:Name = !.Name ++ "_" ++ int_to_string(ArgPos),
- create_variant_name(ArgPoss, !Name).
-
%-----------------------------------------------------------------------------%
:- pred lco_proc(variant_map::in, list(pred_proc_id)::in,
@@ -477,8 +470,8 @@
map.lookup(VarTypes, ConstructedVar, ConstructedType),
ConsTag = cons_id_to_tag(ConsId, ConstructedType, ModuleInfo),
% The code generator can't handle the other tags. For example, it
- % doesn't make sense to the address of the field of a function symbol
- % of a `notag' type.
+ % doesn't make sense to take the address of the field of a function
+ % symbol of a `notag' type.
(
ConsTag = unshared_tag(_)
;
@@ -520,7 +513,7 @@
% memory.
all_true(occurs_once(!.UnifyInputVars), MismatchedCallArgs),
ensure_variant_exists(PredId, ProcId, assoc_list.keys(Mismatches),
- VariantPredProcId, !Info)
+ VariantPredProcId, SymName, VariantSymName, !Info)
->
list.map(update_construct(Subst), !.Unifies, UpdatedUnifies),
proc_info_get_argmodes(CalleeProcInfo, CalleeModes),
@@ -528,7 +521,7 @@
UpdatedCallOutArgs, UpdatedArgs),
VariantPredProcId = proc(VariantPredId, VariantProcId),
UpdatedGoalExpr = plain_call(VariantPredId, VariantProcId, UpdatedArgs,
- Builtin, UnifyContext, SymName),
+ Builtin, UnifyContext, VariantSymName),
UpdatedGoalInfo = RevGoalInfo,
UpdatedGoal = hlds_goal(UpdatedGoalExpr, UpdatedGoalInfo),
Goals = list.reverse(RevGoals) ++ UpdatedUnifies ++ [UpdatedGoal],
@@ -648,33 +641,69 @@
%-----------------------------------------------------------------------------%
:- pred ensure_variant_exists(pred_id::in, proc_id::in, list(int)::in,
- pred_proc_id::out, lco_info::in, lco_info::out) is semidet.
+ pred_proc_id::out, sym_name::in, sym_name::out,
+ lco_info::in, lco_info::out) is semidet.
-ensure_variant_exists(PredId, ProcId, AddrArgNums, VariantPredProcId, !Info) :-
+ensure_variant_exists(PredId, ProcId, AddrArgNums, VariantPredProcId,
+ SymName, VariantSymName, !Info) :-
CurSCCVariants0 = !.Info ^ cur_scc_variants,
( map.search(CurSCCVariants0, proc(PredId, ProcId), ExistingVariant) ->
- ExistingVariant = variant_id(ExistingAddrArgNums, VariantPredProcId),
+ ExistingVariant = variant_id(ExistingAddrArgNums, VariantPredProcId,
+ VariantName),
+ (
+ SymName = unqualified(_Name),
+ VariantSymName = unqualified(VariantName)
+ ;
+ SymName = qualified(ModuleName, _Name),
+ VariantSymName = qualified(ModuleName, VariantName)
+ ),
AddrArgNums = ExistingAddrArgNums
;
ModuleInfo0 = !.Info ^ module_info,
- clone_pred_proc(PredId, ClonePredId, ModuleInfo0, ModuleInfo),
+ clone_pred_proc(PredId, ClonePredId, PredOrFunc,
+ ModuleInfo0, ModuleInfo),
VariantPredProcId = proc(ClonePredId, ProcId),
!:Info = !.Info ^ module_info := ModuleInfo,
- NewVariant = variant_id(AddrArgNums, VariantPredProcId),
+ (
+ SymName = unqualified(Name),
+ create_variant_name(PredOrFunc, AddrArgNums, Name, VariantName),
+ VariantSymName = unqualified(VariantName)
+ ;
+ SymName = qualified(ModuleName, Name),
+ create_variant_name(PredOrFunc, AddrArgNums, Name, VariantName),
+ VariantSymName = qualified(ModuleName, VariantName)
+ ),
+ NewVariant = variant_id(AddrArgNums, VariantPredProcId,
+ VariantName),
map.det_insert(CurSCCVariants0, proc(PredId, ProcId), NewVariant,
CurSCCVariants),
!:Info = !.Info ^ cur_scc_variants := CurSCCVariants
).
-:- pred clone_pred_proc(pred_id::in, pred_id::out,
+:- pred clone_pred_proc(pred_id::in, pred_id::out, pred_or_func::out,
module_info::in, module_info::out) is det.
-clone_pred_proc(PredId, ClonePredId, !ModuleInfo) :-
+clone_pred_proc(PredId, ClonePredId, PredOrFunc, !ModuleInfo) :-
module_info_pred_info(!.ModuleInfo, PredId, PredInfo),
+ PredOrFunc = pred_info_is_pred_or_func(PredInfo),
module_info_get_predicate_table(!.ModuleInfo, PredTable0),
predicate_table_insert(PredInfo, ClonePredId, PredTable0, PredTable),
module_info_set_predicate_table(PredTable, !ModuleInfo).
+:- pred create_variant_name(pred_or_func::in, list(int)::in, string::in,
+ string::out) is det.
+
+create_variant_name(PredOrFunc, ArgPoss, OrigName, VariantName) :-
+ list.map(int_to_string, ArgPoss, ArgPosStrs),
+ ArgPosDesc = string.join_list("_", ArgPosStrs),
+ (
+ PredOrFunc = pf_function,
+ VariantName = "LCMCfn_" ++ OrigName ++ "_" ++ ArgPosDesc
+ ;
+ PredOrFunc = pf_predicate,
+ VariantName = "LCMCpr_" ++ OrigName ++ "_" ++ ArgPosDesc
+ ).
+
%-----------------------------------------------------------------------------%
:- pred update_construct(map(prog_var, prog_var)::in,
@@ -975,7 +1004,7 @@
make_store_goal(ModuleInfo, Var - AddrVar, Goal) :-
generate_simple_call(mercury_private_builtin_module, "store_at_ref",
- predicate, only_mode, detism_det, purity_pure, [AddrVar, Var],
+ pf_predicate, only_mode, detism_det, purity_pure, [AddrVar, Var],
[], [], ModuleInfo, term.context_init, Goal0),
%
% XXX the following hack is used to stop simplify from trying to
Index: compiler/liveness.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/liveness.m,v
retrieving revision 1.154
diff -u -b -r1.154 liveness.m
--- compiler/liveness.m 6 Jan 2007 09:23:38 -0000 1.154
+++ compiler/liveness.m 17 Jan 2007 07:08:05 -0000
@@ -230,7 +230,7 @@
%-----------------------------------------------------------------------------%
detect_liveness_preds_parallel(!HLDS) :-
- module_info_predids(!.HLDS, PredIds),
+ module_info_predids(PredIds, !HLDS),
detect_liveness_preds_parallel_2(PredIds, !.HLDS, !HLDS).
:- pred detect_liveness_preds_parallel_2(list(pred_id)::in,
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.303
diff -u -b -r1.303 llds_out.m
--- compiler/llds_out.m 6 Jan 2007 09:23:39 -0000 1.303
+++ compiler/llds_out.m 17 Jan 2007 09:33:55 -0000
@@ -1273,13 +1273,16 @@
(
Lang = lang_c,
globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
+ globals.io_lookup_bool_option(line_numbers, LineNumbers, !IO),
(
PrintComments = yes,
+ LineNumbers = yes
+ ->
io.write_string("/* ", !IO),
prog_out.write_context(Context, !IO),
io.write_string(" pragma foreign_code */\n", !IO)
;
- PrintComments = no
+ true
),
output_set_line_num(Context, !IO),
io.write_string(Foreign_Code, !IO),
@@ -1313,15 +1316,18 @@
;
set.insert(!.AlreadyDone, Code, !:AlreadyDone),
globals.io_lookup_bool_option(auto_comments, PrintComments, !IO),
+ globals.io_lookup_bool_option(line_numbers, LineNumbers, !IO),
(
PrintComments = yes,
+ LineNumbers = yes
+ ->
io.write_string("/* ", !IO),
prog_out.write_context(Context, !IO),
io.write_string(" pragma foreign_decl_code(", !IO),
io.write(Lang, !IO),
io.write_string(") */\n", !IO)
;
- PrintComments = no
+ true
),
output_set_line_num(Context, !IO),
io.write_string(Code, !IO),
@@ -2138,7 +2144,7 @@
DummyModule = unqualified("DEBUG"),
DummyPredName = "DEBUG",
proc_id_to_int(hlds_pred.initial_proc_id, InitialProcIdInt),
- ProcLabel = ordinary_proc_label(DummyModule, predicate, DummyModule,
+ ProcLabel = ordinary_proc_label(DummyModule, pf_predicate, DummyModule,
DummyPredName, 0, InitialProcIdInt),
ProfInfo = entry_label(entry_label_local, ProcLabel) - ContLabelSet,
output_instruction_and_comment(Instr, Comment, PrintComments,
@@ -2152,7 +2158,7 @@
DummyModule = unqualified("DEBUG"),
DummyPredName = "DEBUG",
proc_id_to_int(hlds_pred.initial_proc_id, InitialProcIdInt),
- ProcLabel = ordinary_proc_label(DummyModule, predicate, DummyModule,
+ ProcLabel = ordinary_proc_label(DummyModule, pf_predicate, DummyModule,
DummyPredName, 0, InitialProcIdInt),
ProfInfo = entry_label(entry_label_local, ProcLabel) - ContLabelSet,
output_instruction(Instr, ProfInfo, !IO).
Index: compiler/make.dependencies.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.dependencies.m,v
retrieving revision 1.35
diff -u -b -r1.35 make.dependencies.m
--- compiler/make.dependencies.m 1 Dec 2006 15:04:04 -0000 1.35
+++ compiler/make.dependencies.m 18 Jan 2007 03:49:31 -0000
@@ -937,10 +937,21 @@
(pred((DepTarget - DepStatus)::in, !.IO::di, !:IO::uo) is det :-
write_dependency_file(DepTarget, !IO),
io.write_string(" - ", !IO),
- io.write(DepStatus, !IO)
+ write_dependency_status(DepStatus, !IO)
), !IO),
io.nl(!IO).
+:- pred write_dependency_status(dependency_status::in, io::di, io::uo) is det.
+
+write_dependency_status(deps_status_not_considered, !IO) :-
+ io.write_string("deps_status_not_considered", !IO).
+write_dependency_status(deps_status_being_built, !IO) :-
+ io.write_string("deps_status_being_built", !IO).
+write_dependency_status(deps_status_up_to_date, !IO) :-
+ io.write_string("deps_status_up_to_date", !IO).
+write_dependency_status(deps_status_error, !IO) :-
+ io.write_string("deps_status_error", !IO).
+
check_dependencies(TargetFileName, MaybeTimestamp, BuildDepsSucceeded,
DepFiles, DepsResult, !Info, !IO) :-
list.map_foldl2(dependency_status, DepFiles, DepStatusList, !Info, !IO),
Index: compiler/make_hlds_passes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make_hlds_passes.m,v
retrieving revision 1.64
diff -u -b -r1.64 make_hlds_passes.m
--- compiler/make_hlds_passes.m 12 Jan 2007 05:00:28 -0000 1.64
+++ compiler/make_hlds_passes.m 17 Jan 2007 07:08:05 -0000
@@ -202,10 +202,6 @@
mq_info_get_mode_error_flag(MQInfo, InvalidModes1),
InvalidModes = InvalidModes0 `or` InvalidModes1,
- % The predid list is constructed in reverse order, for efficiency,
- % so we return it to the correct order here.
- module_info_reverse_predids(!ModuleInfo),
-
sort_error_specs(!.Specs, SortedSpecs),
module_info_get_globals(!.ModuleInfo, CurGlobals),
write_error_specs(SortedSpecs, CurGlobals, 0, _NumWarnings,
@@ -603,11 +599,11 @@
% Add default modes for function declarations, if necessary.
%
(
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
list.length(TypesAndModes, Arity),
- adjust_func_arity(function, FuncArity, Arity),
+ adjust_func_arity(pf_function, FuncArity, Arity),
module_info_get_predicate_table(!.ModuleInfo, PredTable0),
(
predicate_table_search_func_sym_arity(PredTable0,
@@ -914,11 +910,11 @@
Item = item_pred_or_func(_, _, _, _, PredOrFunc, SymName, TypesAndModes,
_WithType, _WithInst, _, _, _, _),
(
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
list.length(TypesAndModes, PredArity),
- adjust_func_arity(function, FuncArity, PredArity),
+ adjust_func_arity(pf_function, FuncArity, PredArity),
maybe_check_field_access_function(SymName, FuncArity, !.Status,
Context, !.ModuleInfo, !Specs)
).
@@ -1116,8 +1112,8 @@
module_info_new_user_init_pred(SymName, CName, !ModuleInfo),
PragmaExportItem =
item_pragma(compiler(initialise_decl),
- pragma_foreign_export(ExportLang, SymName, predicate,
- [di_mode, uo_mode], CName)),
+ pragma_foreign_export(ExportLang, SymName,
+ pf_predicate, [di_mode, uo_mode], CName)),
add_item_clause(PragmaExportItem, !Status, Context,
!ModuleInfo, !QualInfo, !Specs)
;
@@ -1135,8 +1131,8 @@
module_info_new_user_init_pred(SymName, CName, !ModuleInfo),
PragmaExportedItem =
item_pragma(compiler(initialise_decl),
- pragma_foreign_export(ExportLang, SymName, predicate,
- [], CName)),
+ pragma_foreign_export(ExportLang, SymName,
+ pf_predicate, [], CName)),
add_item_clause(PragmaExportedItem, !Status, Context,
!ModuleInfo, !QualInfo, !Specs)
;
@@ -1178,7 +1174,7 @@
ExportLang = lang_c, % XXX Implement for other backends.
PragmaExportItem =
item_pragma(compiler(mutable_decl),
- pragma_foreign_export(ExportLang, SymName, predicate, [],
+ pragma_foreign_export(ExportLang, SymName, pf_predicate, [],
CName)),
add_item_clause(PragmaExportItem, !Status, Context,
!ModuleInfo, !QualInfo, !Specs)
@@ -1236,8 +1232,8 @@
module_info_new_user_final_pred(SymName, CName, !ModuleInfo),
PragmaExportItem =
item_pragma(compiler(finalise_decl),
- pragma_foreign_export(ExportLang, SymName, predicate,
- [di_mode, uo_mode], CName)),
+ pragma_foreign_export(ExportLang, SymName,
+ pf_predicate, [di_mode, uo_mode], CName)),
add_item_clause(PragmaExportItem, !Status, Context,
!ModuleInfo, !QualInfo, !Specs)
;
@@ -1255,8 +1251,8 @@
module_info_new_user_final_pred(SymName, CName, !ModuleInfo),
PragmaExportItem =
item_pragma(compiler(finalise_decl),
- pragma_foreign_export(ExportLang, SymName, predicate,
- [], CName)),
+ pragma_foreign_export(ExportLang, SymName,
+ pf_predicate, [], CName)),
add_item_clause(PragmaExportItem, !Status, Context,
!ModuleInfo, !QualInfo, !Specs)
;
@@ -1435,7 +1431,7 @@
ConstantGetForeignProc = pragma_foreign_proc(
ConstantGetAttrs,
mutable_get_pred_sym_name(ModuleName, Name),
- predicate,
+ pf_predicate,
[pragma_var(X, "X", out_mode(Inst), BoxPolicy)],
ProgVarSet,
InstVarSet,
@@ -1451,7 +1447,7 @@
ConstantSetForeignProc = pragma_foreign_proc(Attrs,
mutable_secret_set_pred_sym_name(ModuleName, Name),
- predicate,
+ pf_predicate,
[pragma_var(X, "X", in_mode(Inst), BoxPolicy)],
ProgVarSet,
InstVarSet,
@@ -1497,7 +1493,7 @@
),
LockForeignProc = pragma_foreign_proc(LockAndUnlockAttrs,
mutable_lock_pred_sym_name(ModuleName, Name),
- predicate,
+ pf_predicate,
[],
varset.init, % Prog varset.
varset.init, % Inst varset.
@@ -1524,7 +1520,7 @@
),
UnlockForeignProc = pragma_foreign_proc(LockAndUnlockAttrs,
mutable_unlock_pred_sym_name(ModuleName, Name),
- predicate,
+ pf_predicate,
[],
varset.init, % Prog varset.
varset.init, % Inst varset.
@@ -1549,7 +1545,7 @@
),
UnsafeGetForeignProc = pragma_foreign_proc(UnsafeGetAttrs,
mutable_unsafe_get_pred_sym_name(ModuleName, Name),
- predicate,
+ pf_predicate,
[pragma_var(X, "X", out_mode(Inst), BoxPolicy)],
ProgVarSet,
varset.init, % Inst varset.
@@ -1600,7 +1596,7 @@
),
UnsafeSetForeignProc = pragma_foreign_proc(UnsafeSetAttrs,
mutable_unsafe_set_pred_sym_name(ModuleName, Name),
- predicate,
+ pf_predicate,
[pragma_var(X, "X", in_mode(Inst), BoxPolicy)],
ProgVarSet,
varset.init, % Inst varset.
@@ -1646,7 +1642,7 @@
StdGetClause = item_clause(
compiler(mutable_decl),
ProgVarSet0,
- predicate,
+ pf_predicate,
GetPredName,
[variable(X, context_init)],
StdGetBody
@@ -1668,7 +1664,7 @@
StdSetClause = item_clause(
compiler(mutable_decl),
ProgVarSet0,
- predicate,
+ pf_predicate,
SetPredName,
[variable(X, context_init)],
StdSetBody
@@ -1691,7 +1687,7 @@
IOGetClause = item_clause(
compiler(mutable_decl),
ProgVarSet,
- predicate,
+ pf_predicate,
GetPredName,
[variable(X, Ctxt), variable(IO, Ctxt), variable(IO, Ctxt)],
IOGetBody
@@ -1711,7 +1707,7 @@
IOSetClause = item_clause(
compiler(mutable_decl),
ProgVarSet,
- predicate,
+ pf_predicate,
SetPredName,
[variable(X, Ctxt), variable(IO, Ctxt), variable(IO, Ctxt)],
IOSetBody
@@ -1751,7 +1747,7 @@
%
InitClause = item_clause(compiler(mutable_decl),
MutVarset,
- predicate,
+ pf_predicate,
mutable_init_pred_sym_name(ModuleName, Name), [],
call_expr(InitSetPredName, [InitTerm], purity_impure)
- Context)
@@ -1777,7 +1773,7 @@
PreInitPredName = mutable_pre_init_pred_sym_name(ModuleName, Name),
PreInitForeignProc = pragma_foreign_proc(Attrs,
PreInitPredName,
- predicate,
+ pf_predicate,
[],
varset.init, % ProgVarSet
varset.init, % InstVarSet
@@ -1801,7 +1797,7 @@
%
InitClause = item_clause(compiler(mutable_decl),
MutVarset,
- predicate,
+ pf_predicate,
mutable_init_pred_sym_name(ModuleName, Name),
[],
InitClauseExpr
@@ -1950,8 +1946,8 @@
% ( R = A + B <=> R = B + A ).
%
module_info_get_name(!.ModuleInfo, ModuleName),
- module_add_clause(VarSet, predicate, qualified(ModuleName, Name), HeadVars,
- Goal, Status, Context, goal_type_promise(PromiseType),
+ module_add_clause(VarSet, pf_predicate, qualified(ModuleName, Name),
+ HeadVars, Goal, Status, Context, goal_type_promise(PromiseType),
!ModuleInfo, !QualInfo, !Specs).
add_stratified_pred(PragmaName, Name, Arity, Context, !ModuleInfo, !Specs) :-
@@ -2135,8 +2131,8 @@
check_field_access_function(_AccessType, FieldName, FuncName, FuncArity,
FuncStatus, Context, ModuleInfo, !Specs) :-
- adjust_func_arity(function, FuncArity, PredArity),
- FuncCallId = simple_call_id(function, FuncName, PredArity),
+ adjust_func_arity(pf_function, FuncArity, PredArity),
+ FuncCallId = simple_call_id(pf_function, FuncName, PredArity),
% Check that a function applied to an exported type is also exported.
module_info_get_ctor_field_table(ModuleInfo, CtorFieldTable),
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.424
diff -u -b -r1.424 mercury_compile.m
--- compiler/mercury_compile.m 13 Jan 2007 12:23:09 -0000 1.424
+++ compiler/mercury_compile.m 19 Jan 2007 03:56:36 -0000
@@ -1874,7 +1874,7 @@
->
maybe_write_string(Verbose, "% Reading .opt files...\n", !IO),
maybe_flush_output(Verbose, !IO),
- intermod.grab_optfiles(Imports0, Imports1, Error1, !IO),
+ grab_opt_files(Imports0, Imports1, Error1, !IO),
maybe_write_string(Verbose, "% Done.\n", !IO)
;
Imports1 = Imports0,
@@ -1885,8 +1885,7 @@
MaybeTransOptDeps = yes(TransOptDeps),
% When creating the trans_opt file, only import the
% trans_opt files which are lower in the ordering.
- trans_opt.grab_optfiles(TransOptDeps, Imports1, Imports, Error2,
- !IO)
+ grab_trans_opt_files(TransOptDeps, Imports1, Imports, Error2, !IO)
;
MaybeTransOptDeps = no,
Imports = Imports1,
@@ -1923,7 +1922,7 @@
% imported (or used), and for all ancestor modules.
list.condense([Imports0 ^ parent_deps,
Imports0 ^ int_deps, Imports0 ^ impl_deps], TransOptFiles),
- trans_opt.grab_optfiles(TransOptFiles, Imports1, Imports, Error2,
+ grab_trans_opt_files(TransOptFiles, Imports1, Imports, Error2,
!IO)
;
TransOpt = no,
@@ -2000,8 +1999,7 @@
;
FoundUndefTypeError = no,
maybe_write_string(Verbose, "% Checking typeclasses...\n", !IO),
- check_typeclass.check_typeclasses(!HLDS, QualInfo0, QualInfo,
- [], Specs),
+ check_typeclasses(!HLDS, QualInfo0, QualInfo, [], Specs),
maybe_dump_hlds(!.HLDS, 5, "typeclass", !DumpInfo, !IO),
set_module_recomp_info(QualInfo, !HLDS),
@@ -2180,7 +2178,7 @@
TablingAnalysis),
(
MakeOptInt = yes,
- intermod.write_optfile(!HLDS, !IO),
+ write_opt_file(!HLDS, !IO),
% If intermod_unused_args is being performed, run polymorphism,
% mode analysis and determinism analysis, then run unused_args
@@ -2305,13 +2303,13 @@
io::di, io::uo) is det.
output_trans_opt_file(!.HLDS, !DumpInfo, !IO) :-
- globals.io_lookup_bool_option(verbose, Verbose, !IO),
- globals.io_lookup_bool_option(statistics, Stats, !IO),
- globals.io_lookup_bool_option(analyse_closures, ClosureAnalysis, !IO),
- %
+ module_info_get_globals(!.HLDS, Globals),
+ globals.lookup_bool_option(Globals, verbose, Verbose),
+ globals.lookup_bool_option(Globals, statistics, Stats),
+ globals.lookup_bool_option(Globals, analyse_closures, ClosureAnalysis),
+
% Closure analysis assumes that lambda expressions have
% been converted into separate predicates.
- %
(
ClosureAnalysis = yes,
process_lambdas(Verbose, Stats, !HLDS, !IO)
@@ -2335,19 +2333,19 @@
maybe_dump_hlds(!.HLDS, 210, "structure_sharing", !DumpInfo, !IO),
maybe_structure_reuse_analysis(Verbose, Stats, !HLDS, !IO),
maybe_dump_hlds(!.HLDS, 212, "structure_reuse", !DumpInfo, !IO),
- trans_opt.write_optfile(!.HLDS, !IO).
+ write_trans_opt_file(!.HLDS, !IO).
:- pred output_analysis_file(module_name::in, module_info::in,
dump_info::in, dump_info::out, io::di, io::uo) is det.
output_analysis_file(ModuleName, !.HLDS, !DumpInfo, !IO) :-
- globals.io_lookup_bool_option(verbose, Verbose, !IO),
- globals.io_lookup_bool_option(statistics, Stats, !IO),
- globals.io_lookup_bool_option(analyse_closures, ClosureAnalysis, !IO),
- %
+ module_info_get_globals(!.HLDS, Globals),
+ globals.lookup_bool_option(Globals, verbose, Verbose),
+ globals.lookup_bool_option(Globals, statistics, Stats),
+ globals.lookup_bool_option(Globals, analyse_closures, ClosureAnalysis),
+
% Closure analysis assumes that lambda expressions have
% been converted into separate predicates.
- %
(
ClosureAnalysis = yes,
process_lambdas(Verbose, Stats, !HLDS, !IO)
@@ -2371,8 +2369,7 @@
module_info_get_analysis_info(!.HLDS, AnalysisInfo),
module_info_get_all_deps(!.HLDS, ImportedModules),
ModuleId = module_name_to_module_id(ModuleName),
- ImportedModuleIds = set.map(module_name_to_module_id,
- ImportedModules),
+ ImportedModuleIds = set.map(module_name_to_module_id, ImportedModules),
analysis.write_analysis_files(mmc, ModuleId, ImportedModuleIds,
AnalysisInfo, _AnalysisInfo, !IO).
@@ -2697,7 +2694,7 @@
io::di, io::uo) is det.
backend_pass_by_preds(!HLDS, !GlobalData, LLDS, !IO) :-
- module_info_predids(!.HLDS, PredIds),
+ module_info_predids(PredIds, !HLDS),
globals.io_lookup_bool_option(optimize_proc_dups, ProcDups, !IO),
(
ProcDups = no,
@@ -2705,7 +2702,7 @@
MaybeDupProcMap = no
;
ProcDups = yes,
- dependency_graph.build_pred_dependency_graph(!.HLDS,
+ dependency_graph.build_pred_dependency_graph(!.HLDS, PredIds,
do_not_include_imported, DepInfo),
hlds_dependency_info_get_dependency_ordering(DepInfo, PredSCCs),
list.condense(PredSCCs, OrderedPredIds),
@@ -2822,15 +2819,11 @@
SavedVarsCell = no
),
globals.lookup_bool_option(Globals, follow_code, FollowCode),
- globals.lookup_bool_option(Globals, prev_code, PrevCode),
(
- ( FollowCode = yes
- ; PrevCode = yes
- )
- ->
+ FollowCode = yes,
move_follow_code_in_proc(PredId, ProcId, PredInfo, !ProcInfo, !HLDS)
;
- true
+ FollowCode = no
),
find_simplifications(no, Globals, Simplifications0),
SimpList0 = simplifications_to_list(Simplifications0),
@@ -2846,12 +2839,12 @@
%
% NOTE: Any changes here may also need to be made to
% mercury_compile.simplify.
- %
+
ProfTrans = yes,
SimpList1 = list.delete_all(SimpList0, simp_constant_prop)
;
ProfTrans = no,
- SimpList1 = SimpList0
+ list.cons(simp_constant_prop, SimpList0, SimpList1)
),
SimpList = [simp_do_once, simp_elim_removable_scopes | SimpList1],
@@ -3289,7 +3282,8 @@
IsProfPass = yes,
list.delete_all(!.SimpList, simp_constant_prop, !:SimpList)
;
- IsProfPass = no
+ IsProfPass = no,
+ list.cons(simp_constant_prop, !SimpList)
),
list.cons(simp_do_once, !SimpList),
list.cons(simp_elim_removable_scopes, !SimpList)
@@ -3611,7 +3605,7 @@
maybe_dump_hlds(HLDS1, 505, "bytecode_args_to_regs", !DumpInfo, !IO),
maybe_write_string(Verbose, "% Generating bytecodes...\n", !IO),
maybe_flush_output(Verbose, !IO),
- bytecode_gen.gen_module(HLDS1, Bytecode, !IO),
+ bytecode_gen.gen_module(HLDS1, _HLDS2, Bytecode, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO),
module_name_to_file_name(ModuleName, ".bytedebug", yes, BytedebugFile,
@@ -4288,12 +4282,8 @@
maybe_followcode(Verbose, Stats, !HLDS, !IO) :-
module_info_get_globals(!.HLDS, Globals),
globals.lookup_bool_option(Globals, follow_code, FollowCode),
- globals.lookup_bool_option(Globals, prev_code, PrevCode),
(
- ( FollowCode = yes
- ; PrevCode = yes
- )
- ->
+ FollowCode = yes,
maybe_write_string(Verbose, "% Migrating branch code...", !IO),
maybe_flush_output(Verbose, !IO),
process_all_nonimported_procs(update_module(move_follow_code_in_proc),
@@ -4301,7 +4291,7 @@
maybe_write_string(Verbose, " done.\n", !IO),
maybe_report_stats(Stats, !IO)
;
- true
+ FollowCode = no
).
:- pred compute_liveness(bool::in, bool::in,
@@ -4371,7 +4361,7 @@
generate_code_for_module(HLDS, Verbose, Stats, !GlobalData, LLDS, !IO) :-
maybe_write_string(Verbose, "% Generating code...\n", !IO),
maybe_flush_output(Verbose, !IO),
- generate_module_code(HLDS, !GlobalData, LLDS, !IO),
+ generate_module_code(HLDS, _HLDS, !GlobalData, LLDS, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO).
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.313
diff -u -b -r1.313 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m 15 Jan 2007 10:30:32 -0000 1.313
+++ compiler/mercury_to_mercury.m 18 Jan 2007 03:44:28 -0000
@@ -517,7 +517,7 @@
% Function declarations using `with_type` have the same
% format as predicate declarations, but with `func' instead
% of `pred'.
- PredOrFunc = function,
+ PredOrFunc = pf_function,
WithType = no
->
pred_args_to_func_args(TypesAndModes, FuncTypesAndModes,
@@ -539,7 +539,7 @@
(
% Function mode declarations using `with_type` have
% the same format as predicate mode declarations.
- PredOrFunc = yes(function),
+ PredOrFunc = yes(pf_function),
WithInst = no
->
pred_args_to_func_args(Modes, FuncModes, RetMode),
@@ -558,10 +558,10 @@
maybe_unqualify_sym_name(UnqualifiedItemNames, PredName0, PredName),
maybe_output_line_number(Context, !IO),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_clause(VarSet, PredName, Args, Body, Context, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Args, FuncArgs, Result),
mercury_output_func_clause(VarSet, PredName, FuncArgs, Result, Body,
Context, !IO)
@@ -600,7 +600,8 @@
ExportName, !IO)
;
Pragma = pragma_obsolete(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate, "obsolete", no, !IO)
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate, "obsolete", no,
+ !IO)
;
Pragma = pragma_tabled(Type, Pred, Arity, _PredOrFunc, _Mode,
MaybeAttributes),
@@ -655,7 +656,7 @@
MaybeAttributes = no,
MaybeAfter = no
),
- mercury_output_pragma_decl(Pred, Arity, predicate, PragmaName,
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate, PragmaName,
MaybeAfter, !IO)
;
Pragma = pragma_type_spec(_, _, _, _, _, _, _, _),
@@ -663,10 +664,11 @@
mercury_output_pragma_type_spec(Pragma, AppendVarnums, !IO)
;
Pragma = pragma_inline(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate, "inline", no, !IO)
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate, "inline", no,
+ !IO)
;
Pragma = pragma_no_inline(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate, "no_inline", no,
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate, "no_inline", no,
!IO)
;
Pragma = pragma_unused_args(PredOrFunc, PredName, Arity, ModeNum,
@@ -701,15 +703,15 @@
add_string(").\n", !IO)
;
Pragma = pragma_promise_pure(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate, "promise_pure", no,
- !IO)
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
+ "promise_pure", no, !IO)
;
Pragma = pragma_promise_semipure(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate, "promise_semipure",
- no, !IO)
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
+ "promise_semipure", no, !IO)
;
Pragma = pragma_promise_equivalent_clauses(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate,
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"promise_equivalent_clauses", no, !IO)
;
Pragma = pragma_termination_info(PredOrFunc, PredName, ModeList,
@@ -724,15 +726,15 @@
MaybeTermination, Context, !IO)
;
Pragma = pragma_terminates(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate, "terminates", no,
- !IO)
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
+ "terminates", no, !IO)
;
Pragma = pragma_does_not_terminate(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate,
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"does_not_terminate", no, !IO)
;
Pragma = pragma_check_termination(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate,
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"check_termination", no, !IO)
;
Pragma = pragma_structure_sharing(PredOrFunc, PredName, ModesList,
@@ -746,7 +748,7 @@
Context, HeadVars, no, Types, no, MaybeStructureReuseDomain, !IO)
;
Pragma = pragma_mode_check_clauses(Pred, Arity),
- mercury_output_pragma_decl(Pred, Arity, predicate,
+ mercury_output_pragma_decl(Pred, Arity, pf_predicate,
"mode_check_clauses", no, !IO)
).
@@ -890,7 +892,7 @@
% Function declarations using `with_type` have the
% same format as predicate declarations, but with
% `func' instead of `pred'.
- PredOrFunc = function,
+ PredOrFunc = pf_function,
WithType = no
->
pred_args_to_func_args(TypesAndModes,
@@ -914,7 +916,7 @@
(
% Function mode declarations using `with_type` have
% the same format as predicate mode declarations.
- PredOrFunc = yes(function),
+ PredOrFunc = yes(pf_function),
WithInst = no
->
pred_args_to_func_args(Modes, FuncModes, RetMode),
@@ -937,10 +939,10 @@
Defn = instance_proc_def_name(Name2),
io.write_char('\t', !IO),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
io.write_string("func(", !IO)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
io.write_string("pred(", !IO)
),
mercury_output_bracketed_sym_name(Name1, next_to_graphic_token, !IO),
@@ -963,11 +965,11 @@
output_instance_method_clause(Name1, Context, Item, !IO) :-
( Item = item_clause(_, VarSet, PredOrFunc, _PredName, HeadTerms, Body) ->
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_clause(VarSet, Name1, HeadTerms, Body, Context,
!IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(HeadTerms, ArgTerms, ResultTerm),
mercury_output_func_clause(VarSet, Name1, ArgTerms, ResultTerm,
Body, Context, !IO)
@@ -1151,7 +1153,7 @@
add_string(" */", !U)
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
(
Modes = [],
add_string("((pred) is ", !U),
@@ -1166,7 +1168,7 @@
add_string(")\n", !U)
)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, ArgModes, RetMode),
(
Modes = [],
@@ -1241,7 +1243,7 @@
add_string(" */", !U)
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
(
Modes = [],
add_string("((pred) is ", !U),
@@ -1256,7 +1258,7 @@
add_string(")", !U)
)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, ArgModes, RetMode),
(
ArgModes = [],
@@ -2062,7 +2064,7 @@
mercury_format_pred_type(VarSet, ExistQVars, PredName, Types, WithType,
MaybeDet, Purity, ClassContext, Context, AppendVarnums, !U) :-
- mercury_format_pred_or_func_type_2(predicate, VarSet, ExistQVars,
+ mercury_format_pred_or_func_type_2(pf_predicate, VarSet, ExistQVars,
PredName, Types, WithType, MaybeDet, Purity, ClassContext,
Context, AppendVarnums, ":- ", ".\n", !U).
@@ -2120,7 +2122,7 @@
% get_determinism/3. The alternative is more `nice', but less
% efficient.
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
MaybeDet = no,
unqualify_name(PredName) = "is",
list.length(Types, 2)
@@ -2399,11 +2401,11 @@
mercury_format_mode_subdecl(PredOrFunc, InstVarSet, Name, Modes,
MaybeDet, Context, !U) :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_format_pred_or_func_mode_subdecl(InstVarSet, Name,
Modes, no, MaybeDet, Context, !U)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, ArgModes, RetMode),
mercury_format_func_mode_subdecl(InstVarSet, Name, ArgModes,
RetMode, MaybeDet, Context, !U)
@@ -3256,11 +3258,11 @@
add_string(", ", !U),
mercury_format_sym_name(PredName, !U),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Vars = Vars0,
ResultVars = []
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Vars0, Vars, ResultVar),
ResultVars = [ResultVar]
),
@@ -3274,9 +3276,9 @@
add_string(")", !U)
),
(
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
add_string(" = (", !U),
mercury_format_pragma_foreign_code_vars(ResultVars, ProgVarset,
InstVarset, !U),
@@ -3367,7 +3369,7 @@
unexpected(this_file, "pragma type_spec: no pred_or_func")
),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, FuncModes, RetMode),
mercury_output_sym_name(PredName, !IO),
io.write_string("(", !IO),
@@ -3376,7 +3378,7 @@
io.write_string(") = ", !IO),
mercury_output_mode(RetMode, InstVarSet, !IO)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_sym_name(PredName, !IO),
io.write_string("(", !IO),
varset.init(InstVarSet),
@@ -3539,10 +3541,10 @@
mercury_format_pragma_decl(PredName, Arity, PredOrFunc, PragmaName, MaybeAfter,
!U) :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
DeclaredArity = Arity
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
DeclaredArity = Arity - 1
),
add_string(":- pragma ", !U),
@@ -3573,14 +3575,14 @@
add_string(":- pragma import(", !U),
mercury_format_sym_name(Name, !U),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ModeList, ArgModes, RetMode),
add_string("(", !U),
mercury_format_mode_list(ArgModes, InstInfo, !U),
add_string(") = ", !U),
mercury_format_mode(RetMode, InstInfo, !U)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
add_string("(", !U),
mercury_format_mode_list(ModeList, InstInfo, !U),
add_string(")", !U)
@@ -3604,14 +3606,14 @@
add_string(", ", !U),
mercury_format_sym_name(Name, !U),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ModeList, ArgModes, RetMode),
add_string("(", !U),
mercury_format_mode_list(ArgModes, InstInfo, !U),
add_string(") = ", !U),
mercury_format_mode(RetMode, InstInfo, !U)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
add_string("(", !U),
mercury_format_mode_list(ModeList, InstInfo, !U),
add_string(")", !U)
@@ -4155,9 +4157,9 @@
pred(add_quoted_atom/3) is term_io.quote_atom,
pred(add_quoted_string/3) is term_io.quote_string,
pred(add_constant/3) is term_io.write_constant,
- pred(add_class_id/3) is io.write,
- pred(add_eval_method/3) is io.write,
- pred(add_lambda_eval_method/3) is io.write,
+ pred(add_class_id/3) is write_class_id,
+ pred(add_eval_method/3) is write_eval_method,
+ pred(add_lambda_eval_method/3) is write_lambda_eval_method,
pred(add_escaped_string/3) is term_io.write_escaped_string,
pred(add_format/4) is io.format,
pred(add_list/5) is io.write_list
@@ -4181,6 +4183,25 @@
pred(add_list/5) is output_list
].
+:- pred write_class_id(class_id::in, io::di, io::uo) is det.
+
+write_class_id(ClassId, !IO) :-
+ output_class_id(ClassId, "", ClassIdStr),
+ io.write_string(ClassIdStr, !IO).
+
+:- pred write_eval_method(eval_method::in, io::di, io::uo) is det.
+
+write_eval_method(EvalMethod, !IO) :-
+ output_eval_method(EvalMethod, "", EvalMethodStr),
+ io.write_string(EvalMethodStr, !IO).
+
+:- pred write_lambda_eval_method(lambda_eval_method::in, io::di, io::uo)
+ is det.
+
+write_lambda_eval_method(LambdaEvalMethod, !IO) :-
+ output_lambda_eval_method(LambdaEvalMethod, "", LambdaEvalMethodStr),
+ io.write_string(LambdaEvalMethodStr, !IO).
+
:- pred output_string(string::in, string::di, string::uo) is det.
output_string(S, Str0, Str) :-
@@ -4306,11 +4327,11 @@
io.write_string(":- pragma termination_info(", !IO),
varset.init(InitVarSet),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_subdecl(InitVarSet, SymName,
ModeList, no, Context, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ModeList, FuncModeList, RetMode),
mercury_output_func_mode_subdecl(InitVarSet, SymName,
FuncModeList, RetMode, no, Context, !IO)
@@ -4351,7 +4372,7 @@
io.write_string("[]", !IO).
write_used_args([UsedArg | UsedArgs], !IO) :-
io.write_string("[", !IO),
- io.write(UsedArg, !IO),
+ write_bool(UsedArg, !IO),
write_used_args_2(UsedArgs, !IO),
io.write_string("]", !IO).
@@ -4360,9 +4381,20 @@
write_used_args_2([], !IO).
write_used_args_2([ UsedArg | UsedArgs ], !IO) :-
io.write_string(", ", !IO),
- io.write(UsedArg, !IO),
+ write_bool(UsedArg, !IO),
write_used_args_2(UsedArgs, !IO).
+:- pred write_bool(bool::in, io::di, io::uo) is det.
+
+write_bool(Bool, !IO) :-
+ (
+ Bool = no,
+ io.write_string("no", !IO)
+ ;
+ Bool = yes,
+ io.write_string("yes", !IO)
+ ).
+
write_maybe_termination_info(MaybeTerminationInfo, Verbose, !IO) :-
(
MaybeTerminationInfo = no,
@@ -4398,11 +4430,11 @@
!IO) :-
io.write_string(":- pragma termination2_info(", !IO),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_subdecl(varset.init, PredName,
ModeList, no, Context, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ModeList, FuncModeList, RetMode),
mercury_output_func_mode_subdecl(varset.init, PredName,
FuncModeList, RetMode, no, Context, !IO)
@@ -4488,11 +4520,11 @@
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_subdecl(InitVarSet, SymName,
Modes, no, Context, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, FuncModeList, RetMode),
mercury_output_func_mode_subdecl(InitVarSet, SymName,
FuncModeList, RetMode, no, Context, !IO)
@@ -4525,11 +4557,11 @@
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_subdecl(InitVarSet, SymName,
Modes, no, Context, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Modes, FuncModeList, RetMode),
mercury_output_func_mode_subdecl(InitVarSet, SymName,
FuncModeList, RetMode, no, Context, !IO)
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.76
diff -u -b -r1.76 ml_call_gen.m
--- compiler/ml_call_gen.m 23 Dec 2006 12:49:23 -0000 1.76
+++ compiler/ml_call_gen.m 17 Jan 2007 07:08:05 -0000
@@ -699,7 +699,7 @@
% and it has an output mode, then return it as a value.
VarNames1 = [],
CodeModel = model_det,
- PredOrFunc = function,
+ PredOrFunc = pf_function,
ArgMode = top_out
)
->
Index: compiler/ml_closure_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_closure_gen.m,v
retrieving revision 1.48
diff -u -b -r1.48 ml_closure_gen.m
--- compiler/ml_closure_gen.m 23 Dec 2006 12:49:22 -0000 1.48
+++ compiler/ml_closure_gen.m 17 Jan 2007 07:08:05 -0000
@@ -1011,7 +1011,7 @@
;
% For model_det functions, output mode function results
% are mapped to MLDS return values.
- PredOrFunc = function,
+ PredOrFunc = pf_function,
CodeModel = model_det,
ArgMode = top_out,
Types1 = [],
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.121
diff -u -b -r1.121 ml_code_util.m
--- compiler/ml_code_util.m 6 Jan 2007 09:23:42 -0000 1.121
+++ compiler/ml_code_util.m 17 Jan 2007 07:08:05 -0000
@@ -1092,7 +1092,7 @@
% output mode, make the result into the MLDS return type.
(
RetTypes0 = [],
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(HeadModes, _, ResultMode),
ResultMode = top_out,
pred_args_to_func_args(HeadTypes, _, ResultType),
@@ -1238,7 +1238,7 @@
ml_is_output_det_function(ModuleInfo, PredId, ProcId, RetArgVar) :-
module_info_pred_proc_info(ModuleInfo, PredId, ProcId, PredInfo, ProcInfo),
- pred_info_is_pred_or_func(PredInfo) = function,
+ pred_info_is_pred_or_func(PredInfo) = pf_function,
proc_info_interface_code_model(ProcInfo, model_det),
proc_info_get_argmodes(ProcInfo, Modes),
@@ -1379,7 +1379,7 @@
MaybeDeclaringModule = no
),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
\+ ml_is_output_det_function(ModuleInfo, PredId, ProcId, _)
->
NonOutputFunc = yes
@@ -2107,7 +2107,7 @@
% Generate the address of `private_builtin.gc_trace/1#0'.
PredName = "gc_trace",
PredOrigArity = 1,
- PredLabel = mlds_user_pred_label((predicate), no, PredName, PredOrigArity,
+ PredLabel = mlds_user_pred_label(pf_predicate, no, PredName, PredOrigArity,
model_det, no),
ProcId = hlds_pred.initial_proc_id,
PredModule = mercury_private_builtin_module,
Index: compiler/ml_elim_nested.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_elim_nested.m,v
retrieving revision 1.88
diff -u -b -r1.88 ml_elim_nested.m
--- compiler/ml_elim_nested.m 23 Dec 2006 12:49:22 -0000 1.88
+++ compiler/ml_elim_nested.m 17 Jan 2007 07:08:05 -0000
@@ -1286,8 +1286,8 @@
ml_pred_label_name(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule,
Name, Arity, _CodeModel, _NonOutputFunc)) = LabelName :-
- ( PredOrFunc = predicate, Suffix = "p"
- ; PredOrFunc = function, Suffix = "f"
+ ( PredOrFunc = pf_predicate, Suffix = "p"
+ ; PredOrFunc = pf_function, Suffix = "f"
),
(
MaybeDefiningModule = yes(DefiningModule),
Index: compiler/ml_optimize.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_optimize.m,v
retrieving revision 1.48
diff -u -b -r1.48 ml_optimize.m
--- compiler/ml_optimize.m 8 Jan 2007 03:03:12 -0000 1.48
+++ compiler/ml_optimize.m 17 Jan 2007 07:08:05 -0000
@@ -258,7 +258,7 @@
code_addr_proc(qual(ModName, module_qual, ProcLabel),
_FuncSignature))),
ProcLabel = mlds_proc_label(PredLabel, _ProcId),
- PredLabel = mlds_user_pred_label(predicate, _DefnModName, PredName,
+ PredLabel = mlds_user_pred_label(pf_predicate, _DefnModName, PredName,
_Arity, _CodeModel, _NonOutputFunc),
(
PredName = "mark_hp",
Index: compiler/ml_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_util.m,v
retrieving revision 1.55
diff -u -b -r1.55 ml_util.m
--- compiler/ml_util.m 23 Dec 2006 12:49:23 -0000 1.55
+++ compiler/ml_util.m 17 Jan 2007 07:08:05 -0000
@@ -210,7 +210,7 @@
list.member(Defn, Defns),
Defn = mlds_defn(Name, _, _, _),
Name = entity_function(FuncName, _, _, _),
- FuncName = mlds_user_pred_label(predicate, _, "main", 2, _, _).
+ FuncName = mlds_user_pred_label(pf_predicate, _, "main", 2, _, _).
can_optimize_tailcall(Name, Call) :-
Call = mlcall(_Signature, FuncRval, MaybeObject, _CallArgs,
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.209
diff -u -b -r1.209 mlds_to_c.m
--- compiler/mlds_to_c.m 16 Jan 2007 16:22:29 -0000 1.209
+++ compiler/mlds_to_c.m 17 Jan 2007 08:54:11 -0000
@@ -1878,7 +1878,7 @@
(
% Don't module-qualify main/2.
Name = entity_function(PredLabel, _, _, _),
- PredLabel = mlds_user_pred_label(predicate, no, "main", 2,
+ PredLabel = mlds_user_pred_label(pf_predicate, no, "main", 2,
model_det, no)
;
Name = entity_data(mlds_rtti(RttiId)),
@@ -1901,7 +1901,7 @@
% Don't module-qualify main/2.
QualifiedName = qual(_ModuleName, _QualKind, Name),
Name = mlds_proc_label(PredLabel, _ProcId),
- PredLabel = mlds_user_pred_label(predicate, no, "main", 2,
+ PredLabel = mlds_user_pred_label(pf_predicate, no, "main", 2,
model_det, no)
->
mlds_output_proc_label(Name, !IO)
@@ -1957,8 +1957,8 @@
mlds_output_pred_label(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule,
Name, Arity, _CodeModel, _NonOutputFunc), !IO) :-
- ( PredOrFunc = predicate, Suffix = "p"
- ; PredOrFunc = function, Suffix = "f"
+ ( PredOrFunc = pf_predicate, Suffix = "p"
+ ; PredOrFunc = pf_function, Suffix = "f"
),
MangledName = name_mangle(Name),
io.format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)], !IO),
@@ -1993,8 +1993,8 @@
mlds_pred_label_to_string(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule,
Name, Arity, _CodeModel, _NonOutputFunc)) = Str :-
- ( PredOrFunc = predicate, Suffix = "p"
- ; PredOrFunc = function, Suffix = "f"
+ ( PredOrFunc = pf_predicate, Suffix = "p"
+ ; PredOrFunc = pf_function, Suffix = "f"
),
MangledName = name_mangle(Name),
MainStr = string.format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)]),
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.127
diff -u -b -r1.127 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m 5 Jan 2007 02:19:38 -0000 1.127
+++ compiler/mlds_to_gcc.m 17 Jan 2007 07:17:38 -0000
@@ -1639,8 +1639,8 @@
get_pred_label_name(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule, Name,
Arity, _CodeMode, _NonOutputFunc), LabelName) :-
- ( PredOrFunc = predicate, Suffix = "p"
- ; PredOrFunc = function, Suffix = "f"
+ ( PredOrFunc = pf_predicate, Suffix = "p"
+ ; PredOrFunc = pf_function, Suffix = "f"
),
MangledName = name_mangle(Name),
string__format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)],
@@ -2560,7 +2560,7 @@
% don't module-qualify main/2
%
Name = entity_function(PredLabel, _, _, _),
- PredLabel = mlds_user_pred_label(predicate, no,
+ PredLabel = mlds_user_pred_label(pf_predicate, no,
"main", 2, model_det, no)
;
Name = entity_data(mlds_rtti(RttiId)),
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.177
diff -u -b -r1.177 mlds_to_il.m
--- compiler/mlds_to_il.m 5 Jan 2007 03:25:14 -0000 1.177
+++ compiler/mlds_to_il.m 17 Jan 2007 07:08:05 -0000
@@ -1143,7 +1143,7 @@
% in the cctor of this module.
(
Name = entity_function(PredLabel, _ProcId, MaybeSeqNum, _PredId),
- PredLabel = mlds_user_pred_label(predicate, no, "main", 2,
+ PredLabel = mlds_user_pred_label(pf_predicate, no, "main", 2,
model_det, no),
MaybeSeqNum = no
->
@@ -3302,14 +3302,14 @@
MaybeModuleStr = ""
),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
( CodeModel = model_semi ->
PredOrFuncStr = "_p"
;
PredOrFuncStr = ""
)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
PredOrFuncStr = "_f"
),
proc_id_to_int(ProcId, ProcIdInt),
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.89
diff -u -b -r1.89 mlds_to_java.m
--- compiler/mlds_to_java.m 23 Dec 2006 12:49:24 -0000 1.89
+++ compiler/mlds_to_java.m 17 Jan 2007 07:08:05 -0000
@@ -1005,11 +1005,11 @@
pred_label_string(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule, Name,
PredArity, _CodeModel, _NonOutputFunc)) = PredLabelStr :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Suffix = "p",
OrigArity = PredArity
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Suffix = "f",
OrigArity = PredArity - 1
),
@@ -1746,11 +1746,11 @@
output_pred_label(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule, Name,
PredArity, _, _), !IO) :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Suffix = "p",
OrigArity = PredArity
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Suffix = "f",
OrigArity = PredArity - 1
),
Index: compiler/mode_constraints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_constraints.m,v
retrieving revision 1.39
diff -u -b -r1.39 mode_constraints.m
--- compiler/mode_constraints.m 6 Jan 2007 10:56:15 -0000 1.39
+++ compiler/mode_constraints.m 17 Jan 2007 07:08:05 -0000
@@ -113,14 +113,14 @@
].
process_module(!ModuleInfo, !IO) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
globals.io_lookup_bool_option(simple_mode_constraints, Simple, !IO),
globals.io_lookup_bool_option(prop_mode_constraints, New, !IO),
(
New = no,
list__foldl2(hhf__process_pred(Simple), PredIds, !ModuleInfo, !IO),
- get_predicate_sccs(!.ModuleInfo, SCCs),
+ get_predicate_sccs(!ModuleInfo, SCCs),
% Stage 1: Process SCCs bottom-up to determine variable producers.
list.foldl3(process_scc(Simple), SCCs,
@@ -141,7 +141,7 @@
clear_caches(!IO)
;
New = yes,
- get_predicate_sccs(!.ModuleInfo, SCCs),
+ get_predicate_sccs(!ModuleInfo, SCCs),
% Preprocess to accommodate implied modes.
% XXX The following transformation adds more unifications
@@ -1795,11 +1795,14 @@
:- type sccs == list(list(pred_id)).
-:- pred get_predicate_sccs(module_info::in, sccs::out) is det.
-
-get_predicate_sccs(ModuleInfo, SCCs) :-
% Obtain the SCCs for the module.
- dependency_graph.build_pred_dependency_graph(ModuleInfo,
+ %
+:- pred get_predicate_sccs(module_info::in, module_info::out, sccs::out)
+ is det.
+
+get_predicate_sccs(!ModuleInfo, SCCs) :-
+ module_info_predids(PredIds, !ModuleInfo),
+ dependency_graph.build_pred_dependency_graph(!.ModuleInfo, PredIds,
do_not_include_imported, DepInfo),
hlds_dependency_info_get_dependency_ordering(DepInfo, SCCs0),
@@ -1809,12 +1812,12 @@
% the rest of their SCC since the mode declaration can be used in any
% calls to them. Such predicates should be processed last to take
% advantage of mode info inferred from other predicates.
- extract_mode_decl_preds(ModuleInfo, SCCs0, [], SCCs1),
+ extract_mode_decl_preds(!.ModuleInfo, SCCs0, [], SCCs1),
% We add imported preds to the end of the SCC list, one SCC per pred.
% This allows a constraint to be created for each imported pred
% based on its mode declarations.
- add_imported_preds(ModuleInfo, SCCs1, SCCs).
+ add_imported_preds(!.ModuleInfo, SCCs1, SCCs).
:- pred extract_mode_decl_preds(module_info::in, sccs::in, sccs::in, sccs::out)
is det.
@@ -1848,7 +1851,7 @@
:- pred add_imported_preds(module_info::in, sccs::in, sccs::out) is det.
add_imported_preds(ModuleInfo, SCCs0, SCCs) :-
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.filter_map(
(pred(PredId::in, [PredId]::out) is semidet :-
module_info_pred_info(ModuleInfo, PredId, PredInfo),
Index: compiler/mode_errors.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_errors.m,v
retrieving revision 1.113
diff -u -b -r1.113 mode_errors.m
--- compiler/mode_errors.m 6 Jan 2007 09:23:42 -0000 1.113
+++ compiler/mode_errors.m 17 Jan 2007 07:08:05 -0000
@@ -762,11 +762,11 @@
mode_info_get_context(ModeInfo, Context),
mode_info_get_varset(ModeInfo, VarSet),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Expecting = "expecting higher-order pred inst (of arity " ++
int_to_string(Arity) ++ ")."
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Expecting = "expecting higher-order func inst (of arity " ++
int_to_string(Arity - 1) ++ ")."
),
@@ -1304,11 +1304,11 @@
),
strip_builtin_qualifiers_from_mode_list(!ArgModes),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Detail = mercury_pred_mode_decl_to_string(VarSet, Name,
!.ArgModes, !.MaybeDet, Context)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(!.ArgModes, FuncArgModes, RetMode),
Detail = mercury_func_mode_decl_to_string(VarSet, Name,
FuncArgModes, RetMode, !.MaybeDet, Context)
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.196
diff -u -b -r1.196 mode_util.m
--- compiler/mode_util.m 15 Jan 2007 10:30:33 -0000 1.196
+++ compiler/mode_util.m 17 Jan 2007 07:08:05 -0000
@@ -591,7 +591,7 @@
)
;
Inst0 = ground(Uniq, none),
- ( type_is_higher_order_details(Type, _Purity, function, _, ArgTypes) ->
+ ( type_is_higher_order_details(Type, _, pf_function, _, ArgTypes) ->
default_higher_order_func_inst(ModuleInfo, ArgTypes,
HigherOrderInstInfo),
Inst = ground(Uniq, higher_order(HigherOrderInstInfo))
@@ -667,7 +667,7 @@
;
Inst0 = ground(Uniq, none),
apply_type_subst(Type0, Subst, Type),
- ( type_is_higher_order_details(Type, _, function, _, ArgTypes) ->
+ ( type_is_higher_order_details(Type, _, pf_function, _, ArgTypes) ->
default_higher_order_func_inst(ModuleInfo, ArgTypes,
HigherOrderInstInfo),
Inst = ground(Uniq, higher_order(HigherOrderInstInfo))
@@ -747,7 +747,7 @@
list.append(FuncArgModes, [FuncRetMode], PredArgModes0),
propagate_types_into_mode_list(ModuleInfo, PredArgTypes,
PredArgModes0, PredArgModes),
- PredInstInfo = pred_inst_info(function, PredArgModes, detism_det).
+ PredInstInfo = pred_inst_info(pf_function, PredArgModes, detism_det).
constructors_to_bound_insts(ModuleInfo, Uniq, Constructors, BoundInsts) :-
constructors_to_bound_insts_2(ModuleInfo, Uniq,
Index: compiler/modecheck_call.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modecheck_call.m,v
retrieving revision 1.77
diff -u -b -r1.77 modecheck_call.m
--- compiler/modecheck_call.m 15 Jan 2007 10:30:33 -0000 1.77
+++ compiler/modecheck_call.m 17 Jan 2007 07:08:05 -0000
@@ -230,7 +230,7 @@
GroundInstInfo = none,
mode_info_get_var_types(!.ModeInfo, VarTypes),
map.lookup(VarTypes, PredVar, Type),
- type_is_higher_order_details(Type, _Purity, function, _, ArgTypes),
+ type_is_higher_order_details(Type, _, pf_function, _, ArgTypes),
PredInstInfo = pred_inst_info_standard_func_mode(
list.length(ArgTypes))
),
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.354
diff -u -b -r1.354 modes.m
--- compiler/modes.m 15 Jan 2007 10:30:34 -0000 1.354
+++ compiler/modes.m 17 Jan 2007 07:08:05 -0000
@@ -416,7 +416,7 @@
check_pred_modes(WhatToCheck, MayChangeCalledProc,
!ModuleInfo, UnsafeToContinue, !IO) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
globals.io_lookup_int_option(mode_inference_iteration_limit,
MaxIterations, !IO),
modecheck_to_fixpoint(PredIds, MaxIterations, WhatToCheck,
@@ -3223,7 +3223,7 @@
% Get the pred_info and proc_info for the procedure we are calling.
SymName = qualified(CalleeModuleName, CalleePredName),
- get_pred_id_and_proc_id(is_fully_qualified, SymName, predicate, TVarSet,
+ get_pred_id_and_proc_id(is_fully_qualified, SymName, pf_predicate, TVarSet,
ArgTypes, ModuleInfo0, CalleePredId, CalleeProcId),
module_info_pred_proc_info(ModuleInfo0, CalleePredId, CalleeProcId,
CalleePredInfo, CalleeProcInfo),
@@ -3284,7 +3284,7 @@
io::di, io::uo) is det.
check_eval_methods(!ModuleInfo, !IO) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
pred_check_eval_methods(PredIds, !ModuleInfo, !IO).
:- pred pred_check_eval_methods(list(pred_id)::in,
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.155
diff -u -b -r1.155 module_qual.m
--- compiler/module_qual.m 6 Jan 2007 09:23:44 -0000 1.155
+++ compiler/module_qual.m 18 Jan 2007 02:28:57 -0000
@@ -1439,7 +1439,7 @@
:- func convert_simple_item_type(id_type) = item_type.
-convert_simple_item_type(type_id) = type_item.
+convert_simple_item_type(type_id) = type_abstract_item.
convert_simple_item_type(mode_id) = mode_item.
convert_simple_item_type(inst_id) = inst_item.
convert_simple_item_type(class_id) = typeclass_item.
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.419
diff -u -b -r1.419 modules.m
--- compiler/modules.m 10 Jan 2007 11:02:36 -0000 1.419
+++ compiler/modules.m 17 Jan 2007 07:20:38 -0000
@@ -6279,7 +6279,7 @@
(
list.member(ItemAndContext, ItemAndContexts),
ItemAndContext = item_and_context(Item, _),
- Item = item_pred_or_func(_, _, _, _, predicate, Name, [_, _],
+ Item = item_pred_or_func(_, _, _, _, pf_predicate, Name, [_, _],
WithType, _, _, _, _, _),
unqualify_name(Name) = "main",
Index: compiler/name_mangle.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/name_mangle.m,v
retrieving revision 1.22
diff -u -b -r1.22 name_mangle.m
--- compiler/name_mangle.m 27 Sep 2006 06:16:59 -0000 1.22
+++ compiler/name_mangle.m 17 Jan 2007 07:08:05 -0000
@@ -131,9 +131,11 @@
PredName, Arity, ModeInt),
LabelName = make_pred_or_func_name(DefiningModule, PredOrFunc,
PredModule, PredName, Arity, AddPrefix),
- ( PredOrFunc = function ->
+ (
+ PredOrFunc = pf_function,
OrigArity = Arity - 1
;
+ PredOrFunc = pf_predicate,
OrigArity = Arity
),
string.int_to_string(OrigArity, ArityString),
@@ -150,7 +152,7 @@
DummyArity = -1, % not used by make_pred_or_func_name.
TypeCtor = type_ctor(qualified(TypeModule, TypeName), TypeArity),
PredName = special_pred_name(SpecialPredId, TypeCtor),
- LabelName = make_pred_or_func_name(unqualified(""), predicate,
+ LabelName = make_pred_or_func_name(unqualified(""), pf_predicate,
unqualified(""), PredName, DummyArity, AddPrefix),
% Figure out the ModeNumString.
@@ -207,10 +209,10 @@
),
LabelName2 = name_mangle(LabelName1),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
LabelName3 = "fn__" ++ LabelName2
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
LabelName3 = LabelName2
),
(
Index: compiler/optimize.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/optimize.m,v
retrieving revision 1.60
diff -u -b -r1.60 optimize.m
--- compiler/optimize.m 5 Dec 2006 03:50:56 -0000 1.60
+++ compiler/optimize.m 17 Jan 2007 07:08:05 -0000
@@ -129,21 +129,44 @@
init_opt_debug_info(Name, Arity, PredProcId, ProcLabel, Instrs0, Counter,
OptDebugInfo, !IO) :-
- globals.io_lookup_bool_option(debug_opt, DebugOpt, !IO),
- globals.io_lookup_int_option(debug_opt_pred_id, DebugOptPredId, !IO),
- globals.io_lookup_string_option(debug_opt_pred_name, DebugOptPredName,
- !IO),
+ globals.io_get_globals(Globals, !IO),
+ globals.lookup_bool_option(Globals, debug_opt, DebugOpt),
+ globals.lookup_accumulating_option(Globals, debug_opt_pred_id,
+ DebugOptPredIdStrs),
+ globals.lookup_accumulating_option(Globals, debug_opt_pred_name,
+ DebugOptPredNames),
PredProcId = proc(PredId, ProcId),
pred_id_to_int(PredId, PredIdInt),
proc_id_to_int(ProcId, ProcIdInt),
(
DebugOpt = yes,
- ( DebugOptPredId >= 0 ->
+ (
+ DebugOptPredIdStrs = [_ | _],
+ DebugOptPredNames = [_ | _],
+ (
+ some [DebugOptPredIdStr, DebugOptPredId] (
+ list.member(DebugOptPredIdStr, DebugOptPredIdStrs),
+ string.to_int(DebugOptPredIdStr, DebugOptPredId),
DebugOptPredId = PredIdInt
- ; DebugOptPredName \= "" ->
- DebugOptPredName = Name
+ )
;
- true
+ list.member(Name, DebugOptPredNames)
+ )
+ ;
+ DebugOptPredIdStrs = [_ | _],
+ DebugOptPredNames = [],
+ some [DebugOptPredIdStr, DebugOptPredId] (
+ list.member(DebugOptPredIdStr, DebugOptPredIdStrs),
+ string.to_int(DebugOptPredIdStr, DebugOptPredId),
+ DebugOptPredId = PredIdInt
+ )
+ ;
+ DebugOptPredIdStrs = [],
+ DebugOptPredNames = [_ | _],
+ list.member(Name, DebugOptPredNames)
+ ;
+ DebugOptPredIdStrs = [],
+ DebugOptPredNames = []
)
->
BaseName = opt_subdir_name ++ "/"
Index: compiler/options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.545
diff -u -b -r1.545 options.m
--- compiler/options.m 15 Jan 2007 07:47:54 -0000 1.545
+++ compiler/options.m 19 Jan 2007 03:28:48 -0000
@@ -513,6 +513,7 @@
; user_guided_type_specialization
; introduce_accumulators
; optimize_constructor_last_call_accumulator
+ ; optimize_constructor_last_call_null
; optimize_constructor_last_call
; optimize_duplicate_calls
; constant_propagation
@@ -535,7 +536,6 @@
; loop_invariants
; delay_construct
; follow_code
- ; prev_code
; optimize_dead_procs
; deforestation
; deforestation_depth_limit
@@ -924,8 +924,8 @@
debug_det - bool(no),
debug_term - bool(no),
debug_opt - bool(no),
- debug_opt_pred_id - int(-1),
- debug_opt_pred_name - string(""),
+ debug_opt_pred_id - accumulating([]),
+ debug_opt_pred_name - accumulating([]),
debug_pd - bool(no),
debug_il_asm - bool(no),
debug_liveness - int(-1),
@@ -989,7 +989,7 @@
show_dependency_graph - bool(no),
dump_trace_counts - accumulating([]),
dump_hlds - accumulating([]),
- dump_hlds_pred_id - int(-1),
+ dump_hlds_pred_id - accumulating([]),
dump_hlds_alias - string(""),
dump_hlds_options - string(""),
dump_mlds - accumulating([]),
@@ -1280,7 +1280,6 @@
optimize_saved_vars_cell_include_all_candidates - bool(yes),
optimize_saved_vars - bool_special,
delay_construct - bool(no),
- prev_code - bool(no),
follow_code - bool(no),
optimize_unused_args - bool(no),
intermod_unused_args - bool(no),
@@ -1293,6 +1292,7 @@
user_guided_type_specialization - bool(no),
introduce_accumulators - bool(no),
optimize_constructor_last_call_accumulator - bool(no),
+ optimize_constructor_last_call_null - bool(no),
optimize_constructor_last_call - bool(no),
optimize_dead_procs - bool(no),
deforestation - bool(no),
@@ -1978,7 +1978,6 @@
optimize_saved_vars_cell_include_all_candidates).
long_option("delay-construct", delay_construct).
long_option("delay-constructs", delay_construct).
-long_option("prev-code", prev_code).
long_option("follow-code", follow_code).
long_option("constraint-propagation", constraint_propagation).
long_option("local-constraint-propagation", local_constraint_propagation).
@@ -2007,6 +2006,10 @@
optimize_constructor_last_call_accumulator).
long_option("optimize-constructor-last-call-accumulator",
optimize_constructor_last_call_accumulator).
+long_option("optimise-constructor-last-call-null",
+ optimize_constructor_last_call_null).
+long_option("optimize-constructor-last-call-null",
+ optimize_constructor_last_call_null).
long_option("optimise-constructor-last-call",
optimize_constructor_last_call).
long_option("optimize-constructor-last-call",
@@ -2737,9 +2740,6 @@
% I think this is deliberate, because the transformation
% might make code run slower?
%
-% prev_code:
-% Not useful?
-%
% unneeded_code:
% Because it can cause slowdowns at high optimization levels;
% cause unknown
@@ -2751,7 +2751,7 @@
% is resolved.
%
% optimize_constructor_last_call:
-% Not implemented yet.
+% Not a speedup in general.
%-----------------------------------------------------------------------------%
@@ -4168,6 +4168,10 @@
% "--optimize-constructor-last-call-accumulator",
% "\tEnable the optimization via accumulators of ""last"" calls",
% "\tthat are followed by constructor application.",
+% "--optimize-constructor-last-call-null",
+% "\tWhen --optimize-constructor-last-call is enabled, put NULL in"
+% "\tuninitialized fields (to prevent the garbage collector from",
+% "\tlooking at and following a random bit pattern).",
"--optimize-constructor-last-call",
"\tEnable the optimization of ""last"" calls that are followed by",
"\tconstructor application.",
Index: compiler/parse_tree.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/parse_tree.m,v
retrieving revision 1.16
diff -u -b -r1.16 parse_tree.m
--- compiler/parse_tree.m 5 Sep 2006 06:21:29 -0000 1.16
+++ compiler/parse_tree.m 18 Jan 2007 02:35:01 -0000
@@ -18,11 +18,10 @@
:- import_module libs.
:- import_module mdbcomp.
-:- import_module recompilation.
% The parse tree data type itself.
-% The parse tree is split in two. The parts defined in prog_item is
-% only needed in the frontend of the compiler, the parts in prog_data
+% The parse tree is split in two. The parts defined in prog_item are
+% needed only by the frontend of the compiler, the parts in prog_data
% are needed throughout.
:- include_module prog_item.
:- include_module prog_data.
Index: compiler/passes_aux.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/passes_aux.m,v
retrieving revision 1.87
diff -u -b -r1.87 passes_aux.m
--- compiler/passes_aux.m 1 Dec 2006 15:04:13 -0000 1.87
+++ compiler/passes_aux.m 17 Jan 2007 07:08:06 -0000
@@ -256,7 +256,7 @@
process_matching_nonimported_procs_errors(Task, Filter, !ModuleInfo,
!Specs, !IO) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
( Task = update_pred_error(Pred) ->
list.foldl3(process_nonimported_pred(Pred, Filter), PredIds,
!ModuleInfo, !Specs, !IO)
@@ -273,7 +273,7 @@
process_matching_nonimported_procs_update_errors(Task0, Task, Filter,
!ModuleInfo, !Specs, !IO) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
process_nonimported_procs_in_preds(PredIds, Task0, Task, Filter,
!ModuleInfo, !IO).
@@ -678,7 +678,7 @@
report_pred_name_mode(PredOrFunc, PredName, ArgModes, !IO),
io.write_string("':\n", !IO).
-report_pred_name_mode(predicate, PredName, ArgModes, !IO) :-
+report_pred_name_mode(pf_predicate, PredName, ArgModes, !IO) :-
io.write_string(PredName, !IO),
(
ArgModes = [_ | _],
@@ -691,7 +691,7 @@
ArgModes = []
).
-report_pred_name_mode(function, FuncName, ArgModes, !IO) :-
+report_pred_name_mode(pf_function, FuncName, ArgModes, !IO) :-
varset.init(InstVarSet), % XXX inst var names
strip_builtin_qualifiers_from_mode_list(ArgModes, StrippedArgModes),
pred_args_to_func_args(StrippedArgModes, FuncArgModes, FuncRetMode),
Index: compiler/pd_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pd_info.m,v
retrieving revision 1.32
diff -u -b -r1.32 pd_info.m
--- compiler/pd_info.m 6 Jan 2007 09:23:46 -0000 1.32
+++ compiler/pd_info.m 17 Jan 2007 07:29:17 -0000
@@ -631,7 +631,7 @@
pd_info_get_module_info(!.PDInfo, ModuleInfo0),
module_info_get_name(ModuleInfo0, ModuleName),
make_pred_name_with_context(ModuleName, "DeforestationIn",
- predicate, PredName, Line, Count, SymName),
+ pf_predicate, PredName, Line, Count, SymName),
Name = unqualify_name(SymName),
pd_info_get_proc_info(!.PDInfo, ProcInfo),
Index: compiler/pd_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pd_util.m,v
retrieving revision 1.60
diff -u -b -r1.60 pd_util.m
--- compiler/pd_util.m 6 Jan 2007 09:23:46 -0000 1.60
+++ compiler/pd_util.m 17 Jan 2007 07:08:06 -0000
@@ -629,14 +629,6 @@
% We have extra information about a switched-on variable
% at the end of each branch.
-/* ### In clause for predicate `get_branch_vars'/7: */
-/* ### type error in unification of variable `Goal' */
-/* ### and functor `-/2'. */
-/* ### variable `Goal' has type `((hlds.hlds_goal).hlds_goal)', */
-/* ### functor `-/2' has overloaded type */
-/* ### { (T1 - T2): (pair.pair(T1, T2)), */
-/* ### (int - int): int */
-/* ### }. */
( Goal = hlds_goal(switch(SwitchVar, _, _), _) ->
( map.search(!.ExtraVars, SwitchVar, SwitchVarSet0) ->
set.insert(SwitchVarSet0, BranchNo, SwitchVarSet)
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.317
diff -u -b -r1.317 polymorphism.m
--- compiler/polymorphism.m 11 Jan 2007 04:47:39 -0000 1.317
+++ compiler/polymorphism.m 17 Jan 2007 07:08:06 -0000
@@ -2245,7 +2245,7 @@
% We extract the superclass typeclass_info by inserting a call
% to superclass_from_typeclass_info in private_builtin.
goal_util.generate_simple_call(mercury_private_builtin_module,
- "superclass_from_typeclass_info", predicate, only_mode,
+ "superclass_from_typeclass_info", pf_predicate, only_mode,
detism_det, purity_pure, [SubClassVar, IndexVar, Var], [], [],
ModuleInfo, term.context_init, SuperClassGoal),
!:ExtraGoals = [SuperClassGoal, IndexGoal | !.ExtraGoals].
@@ -2653,7 +2653,7 @@
special_pred_name_arity(SpecialPredId, SpecialName, _, Arity),
Name = "builtin_" ++ SpecialName ++ "_" ++ CategoryName,
lookup_builtin_pred_proc_id(ModuleInfo, mercury_private_builtin_module,
- Name, predicate, Arity, only_mode, PredId, ProcId),
+ Name, pf_predicate, Arity, only_mode, PredId, ProcId),
PredName = qualified(mercury_private_builtin_module, Name)
).
@@ -2871,7 +2871,7 @@
new_type_info_var_raw(Type, type_info, TypeInfoVar,
!VarSet, !VarTypes, !RttiVarMaps),
goal_util.generate_simple_call(mercury_private_builtin_module,
- "type_info_from_typeclass_info", predicate, only_mode,
+ "type_info_from_typeclass_info", pf_predicate, only_mode,
detism_det, purity_pure, [TypeClassInfoVar, IndexVar, TypeInfoVar], [],
[TypeInfoVar - ground(shared, none)], ModuleInfo,
term.context_init, CallGoal),
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.117
diff -u -b -r1.117 post_typecheck.m
--- compiler/post_typecheck.m 6 Jan 2007 10:56:16 -0000 1.117
+++ compiler/post_typecheck.m 17 Jan 2007 07:08:06 -0000
@@ -938,9 +938,9 @@
list.append(FuncArgVars, [X0], ArgVars),
Modes = [],
Det = detism_erroneous,
- adjust_func_arity(function, Arity, FullArity),
+ adjust_func_arity(pf_function, Arity, FullArity),
HOCall = generic_call(
- higher_order(FuncVar, Purity, function, FullArity),
+ higher_order(FuncVar, Purity, pf_function, FullArity),
ArgVars, Modes, Det),
Goal = hlds_goal(HOCall, GoalInfo0)
;
Index: compiler/pred_table.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pred_table.m,v
retrieving revision 1.8
diff -u -b -r1.8 pred_table.m
--- compiler/pred_table.m 13 Jan 2007 12:23:13 -0000 1.8
+++ compiler/pred_table.m 17 Jan 2007 16:46:55 -0000
@@ -88,8 +88,11 @@
% Get a list of all the valid predids in the predicate_table.
%
-:- pred predicate_table_get_predids(predicate_table::in, list(pred_id)::out)
- is det.
+ % This operation does not logically change the predicate table,
+ % but does update it physically.
+ %
+:- pred predicate_table_get_predids(list(pred_id)::out,
+ predicate_table::in, predicate_table::out) is det.
% Remove a pred_id from the valid list.
%
@@ -98,11 +101,6 @@
:- pred predicate_table_remove_predicate(pred_id::in,
predicate_table::in, predicate_table::out) is det.
- % Reverse the order of pred_ids stored in the predicate_table.
- %
-:- pred predicate_table_reverse_predids(predicate_table::in,
- predicate_table::out) is det.
-
% Search the table for (a) predicates or functions (b) predicates only
% or (c) functions only matching this (possibly module-qualified) sym_name.
%
@@ -313,9 +311,14 @@
next_pred_id :: pred_id,
% The next available pred_id.
- pred_ids :: list(pred_id),
+ old_pred_ids :: list(pred_id),
+ new_rev_pred_ids :: list(pred_id),
% The keys of the pred_table - cached
- % here for efficiency.
+ % here for efficiency. The old pred_ids
+ % are listed in order; the new pred_iss
+ % are listed in reverse order. You can get
+ % the full list with old_pred_ids ++
+ % reverse(new_rev_pred_ids).
accessibility_table :: accessibility_table,
% How is the predicate accessible?
@@ -369,23 +372,24 @@
map(pair(module_name, string), map(arity, list(pred_id))).
predicate_table_init(PredicateTable) :-
- PredicateTable = predicate_table(Preds, NextPredId, PredIds,
- AccessibilityTable,
- Pred_N_Index, Pred_NA_Index, Pred_MNA_Index,
- Func_N_Index, Func_NA_Index, Func_MNA_Index),
map.init(Preds),
NextPredId = hlds_pred.initial_pred_id,
- PredIds = [],
+ OldPredIds = [],
+ NewRevPredIds = [],
map.init(AccessibilityTable),
map.init(Pred_N_Index),
map.init(Pred_NA_Index),
map.init(Pred_MNA_Index),
map.init(Func_N_Index),
map.init(Func_NA_Index),
- map.init(Func_MNA_Index).
+ map.init(Func_MNA_Index),
+ PredicateTable = predicate_table(Preds, NextPredId,
+ OldPredIds, NewRevPredIds, AccessibilityTable,
+ Pred_N_Index, Pred_NA_Index, Pred_MNA_Index,
+ Func_N_Index, Func_NA_Index, Func_MNA_Index).
predicate_table_optimize(PredicateTable0, PredicateTable) :-
- PredicateTable0 = predicate_table(A, B, C, D,
+ PredicateTable0 = predicate_table(A, B, C, D, E,
Pred_N_Index0, Pred_NA_Index0, Pred_MNA_Index0,
Func_N_Index0, Func_NA_Index0, Func_MNA_Index0),
map.optimize(Pred_N_Index0, Pred_N_Index),
@@ -394,7 +398,7 @@
map.optimize(Func_N_Index0, Func_N_Index),
map.optimize(Func_NA_Index0, Func_NA_Index),
map.optimize(Func_MNA_Index0, Func_MNA_Index),
- PredicateTable = predicate_table(A, B, C, D,
+ PredicateTable = predicate_table(A, B, C, D, E,
Pred_N_Index, Pred_NA_Index, Pred_MNA_Index,
Func_N_Index, Func_NA_Index, Func_MNA_Index).
@@ -403,17 +407,33 @@
predicate_table_set_preds(Preds, PredicateTable,
PredicateTable ^ preds := Preds).
-predicate_table_get_predids(PredicateTable, PredicateTable ^ pred_ids).
+predicate_table_get_predids(PredIds, !PredicateTable) :-
+ OldPredIds = !.PredicateTable ^ old_pred_ids,
+ NewRevPredIds = !.PredicateTable ^ new_rev_pred_ids,
+ (
+ NewRevPredIds = [],
+ PredIds = OldPredIds
+ ;
+ NewRevPredIds = [_ | _],
+ PredIds = OldPredIds ++ list.reverse(NewRevPredIds)
+ ),
+ !:PredicateTable = !.PredicateTable ^ old_pred_ids := PredIds,
+ !:PredicateTable = !.PredicateTable ^ new_rev_pred_ids := [].
-predicate_table_remove_predid(PredId, PredicateTable0, PredicateTable) :-
- list.delete_all(PredicateTable0 ^ pred_ids, PredId, PredIds),
- PredicateTable = PredicateTable0 ^ pred_ids := PredIds.
+predicate_table_remove_predid(PredId, !PredicateTable) :-
+ OldPredIds0 = !.PredicateTable ^ old_pred_ids,
+ NewRevPredIds0 = !.PredicateTable ^ new_rev_pred_ids,
+ list.delete_all(OldPredIds0, PredId, OldPredIds),
+ list.delete_all(NewRevPredIds0, PredId, NewRevPredIds),
+ !:PredicateTable = !.PredicateTable ^ old_pred_ids := OldPredIds,
+ !:PredicateTable = !.PredicateTable ^ new_rev_pred_ids := NewRevPredIds.
predicate_table_remove_predicate(PredId, PredicateTable0, PredicateTable) :-
- PredicateTable0 = predicate_table(Preds0, NextPredId, PredIds0,
- AccessibilityTable0,
+ PredicateTable0 = predicate_table(Preds0, NextPredId,
+ OldPredIds0, NewRevPredIds0, AccessibilityTable0,
PredN0, PredNA0, PredMNA0, FuncN0, FuncNA0, FuncMNA0),
- list.delete_all(PredIds0, PredId, PredIds),
+ list.delete_all(OldPredIds0, PredId, OldPredIds),
+ list.delete_all(NewRevPredIds0, PredId, NewRevPredIds),
map.det_remove(Preds0, PredId, PredInfo, Preds),
map.det_remove(AccessibilityTable0, PredId, _, AccessibilityTable),
Module = pred_info_module(PredInfo),
@@ -421,20 +441,20 @@
Arity = pred_info_orig_arity(PredInfo),
IsPredOrFunc = pred_info_is_pred_or_func(PredInfo),
(
- IsPredOrFunc = predicate,
+ IsPredOrFunc = pf_predicate,
predicate_table_remove_from_index(Module, Name, Arity, PredId,
PredN0, PredN, PredNA0, PredNA, PredMNA0, PredMNA),
- PredicateTable = predicate_table(Preds, NextPredId, PredIds,
- AccessibilityTable,
+ PredicateTable = predicate_table(Preds, NextPredId,
+ OldPredIds, NewRevPredIds, AccessibilityTable,
PredN, PredNA, PredMNA, FuncN0, FuncNA0, FuncMNA0)
;
- IsPredOrFunc = function,
+ IsPredOrFunc = pf_function,
FuncArity = Arity - 1,
predicate_table_remove_from_index(Module, Name, FuncArity,
PredId, FuncN0, FuncN, FuncNA0, FuncNA,
FuncMNA0, FuncMNA),
- PredicateTable = predicate_table(Preds, NextPredId, PredIds,
- AccessibilityTable,
+ PredicateTable = predicate_table(Preds, NextPredId,
+ OldPredIds, NewRevPredIds, AccessibilityTable,
PredN0, PredNA0, PredMNA0, FuncN, FuncNA, FuncMNA)
).
@@ -490,12 +510,6 @@
%-----------------------------------------------------------------------------%
-predicate_table_reverse_predids(PredicateTable0, PredicateTable) :-
- list.reverse(PredicateTable0 ^ pred_ids, PredIds),
- PredicateTable = PredicateTable0 ^ pred_ids := PredIds.
-
-%-----------------------------------------------------------------------------%
-
predicate_table_search_sym(PredicateTable, may_be_partially_qualified,
unqualified(Name), PredIdList) :-
predicate_table_search_name(PredicateTable, Name, PredIdList).
@@ -720,20 +734,20 @@
%-----------------------------------------------------------------------------%
predicate_table_search_pf_m_n_a(PredicateTable, IsFullyQualified,
- predicate, Module, Name, Arity, PredIds) :-
+ pf_predicate, Module, Name, Arity, PredIds) :-
predicate_table_search_pred_m_n_a(PredicateTable, IsFullyQualified,
Module, Name, Arity, PredIds).
predicate_table_search_pf_m_n_a(PredicateTable, IsFullyQualified,
- function, Module, Name, Arity, PredIds) :-
+ pf_function, Module, Name, Arity, PredIds) :-
FuncArity = Arity - 1,
predicate_table_search_func_m_n_a(PredicateTable, IsFullyQualified,
Module, Name, FuncArity, PredIds).
-predicate_table_search_pf_name_arity(PredicateTable, predicate, Name, Arity,
+predicate_table_search_pf_name_arity(PredicateTable, pf_predicate, Name, Arity,
PredIds) :-
predicate_table_search_pred_name_arity(PredicateTable, Name, Arity,
PredIds).
-predicate_table_search_pf_name_arity(PredicateTable, function, Name, Arity,
+predicate_table_search_pf_name_arity(PredicateTable, pf_function, Name, Arity,
PredIds) :-
FuncArity = Arity - 1,
predicate_table_search_func_name_arity(PredicateTable, Name, FuncArity,
@@ -748,29 +762,29 @@
predicate_table_search_pf_name_arity(PredicateTable, PredOrFunc,
Name, Arity, PredIdList).
-predicate_table_search_pf_sym(PredicateTable, IsFullyQualified, predicate,
+predicate_table_search_pf_sym(PredicateTable, IsFullyQualified, pf_predicate,
SymName, PredIdList) :-
predicate_table_search_pred_sym(PredicateTable, IsFullyQualified,
SymName, PredIdList).
-predicate_table_search_pf_sym(PredicateTable, IsFullyQualified,
- function, SymName, PredIdList) :-
+predicate_table_search_pf_sym(PredicateTable, IsFullyQualified, pf_function,
+ SymName, PredIdList) :-
predicate_table_search_func_sym(PredicateTable, IsFullyQualified,
SymName, PredIdList).
%-----------------------------------------------------------------------------%
predicate_table_restrict(PartialQualInfo, PredIds, OrigPredicateTable,
- PredicateTable) :-
- predicate_table_reset(OrigPredicateTable, PredicateTable0),
+ !:PredicateTable) :-
+ predicate_table_reset(OrigPredicateTable, !:PredicateTable),
predicate_table_get_preds(OrigPredicateTable, Preds),
AccessibilityTable = OrigPredicateTable ^ accessibility_table,
-
- % Note that we use foldr here rather than foldl, so that the PredIds list
- % in the predicate table is the same as the PredIds list argument here
- % (if we used foldl, it would get reversed, since each new predicate
- % inserted into the table gets its pred_id added at the start of the list).
- list.foldr(reinsert_for_restrict(PartialQualInfo, Preds,
- AccessibilityTable), PredIds, PredicateTable0, PredicateTable).
+ list.foldl(
+ reinsert_for_restrict(PartialQualInfo, Preds, AccessibilityTable),
+ PredIds, !PredicateTable),
+ predicate_table_get_predids(NewPredIds, !PredicateTable),
+ list.sort(NewPredIds, SortedNewPredIds),
+ !:PredicateTable = !.PredicateTable ^ old_pred_ids := SortedNewPredIds,
+ !:PredicateTable = !.PredicateTable ^ new_rev_pred_ids := [].
:- pred reinsert_for_restrict(partial_qualifier_info::in, pred_table::in,
accessibility_table::in, pred_id::in,
@@ -803,7 +817,7 @@
predicate_table_reset(PredicateTable0, PredicateTable) :-
NextPredId = PredicateTable0 ^ next_pred_id,
- PredicateTable = predicate_table(map.init, NextPredId, [], map.init,
+ PredicateTable = predicate_table(map.init, NextPredId, [], [], map.init,
map.init, map.init, map.init, map.init, map.init, map.init).
%-----------------------------------------------------------------------------%
@@ -823,8 +837,8 @@
do_predicate_table_insert(MaybePredId, PredInfo, NeedQual, MaybeQualInfo,
PredId, !PredicateTable) :-
- !.PredicateTable = predicate_table(Preds0, NextPredId0, PredIds0,
- AccessibilityTable0,
+ !.PredicateTable = predicate_table(Preds0, NextPredId0,
+ OldPredIds0, NewRevPredIds0, AccessibilityTable0,
Pred_N_Index0, Pred_NA_Index0, Pred_MNA_Index0,
Func_N_Index0, Func_NA_Index0, Func_MNA_Index0),
Module = pred_info_module(PredInfo),
@@ -843,7 +857,7 @@
% as appropriate.
PredOrFunc = pred_info_is_pred_or_func(PredInfo),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
predicate_table_do_insert(Module, Name, Arity,
NeedQual, MaybeQualInfo, PredId,
AccessibilityTable0, AccessibilityTable,
@@ -855,7 +869,7 @@
Func_NA_Index = Func_NA_Index0,
Func_MNA_Index = Func_MNA_Index0
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
FuncArity = Arity - 1,
predicate_table_do_insert(Module, Name, FuncArity,
NeedQual, MaybeQualInfo, PredId,
@@ -869,14 +883,14 @@
Pred_MNA_Index = Pred_MNA_Index0
),
- % Insert the pred_id into the pred_id list.
- PredIds = [PredId | PredIds0],
+ % Insert the pred_id into the new pred_id list.
+ NewRevPredIds = [PredId | NewRevPredIds0],
% Save the pred_info for this pred_id.
map.det_insert(Preds0, PredId, PredInfo, Preds),
- !:PredicateTable = predicate_table(Preds, NextPredId, PredIds,
- AccessibilityTable,
+ !:PredicateTable = predicate_table(Preds, NextPredId,
+ OldPredIds0, NewRevPredIds, AccessibilityTable,
Pred_N_Index, Pred_NA_Index, Pred_MNA_Index,
Func_N_Index, Func_NA_Index, Func_MNA_Index).
@@ -909,10 +923,8 @@
% Insert partially module-qualified versions of the name into the
% module.name/arity index.
get_partial_qualifiers(Module, QualInfo, PartialQuals),
- list.foldl((pred(AncModule::in, MNAs0::in, MNAs::out) is det :-
- insert_into_mna_index(AncModule, Name, Arity, PredId,
- MNAs0, MNAs)
- ), PartialQuals, !MNA_Index),
+ list.foldl(insert_into_mna_index(Name, Arity, PredId), PartialQuals,
+ !MNA_Index),
AccessibleByPartiallyQualifiedNames = yes
;
@@ -920,16 +932,16 @@
AccessibleByPartiallyQualifiedNames = no
),
% Insert the fully-qualified name into the module.name/arity index.
- insert_into_mna_index(Module, Name, Arity, PredId, !MNA_Index),
+ insert_into_mna_index(Name, Arity, PredId, Module, !MNA_Index),
Access = access(AccessibleByUnqualifiedName,
AccessibleByPartiallyQualifiedNames),
svmap.set(PredId, Access, !AccessibilityTable).
-:- pred insert_into_mna_index(module_name::in, string::in, arity::in,
- pred_id::in, module_name_arity_index::in,
- module_name_arity_index::out) is det.
+:- pred insert_into_mna_index(string::in, arity::in, pred_id::in,
+ module_name::in, module_name_arity_index::in, module_name_arity_index::out)
+ is det.
-insert_into_mna_index(Module, Name, Arity, PredId, !MNA_Index) :-
+insert_into_mna_index(Name, Arity, PredId, Module, !MNA_Index) :-
( map.search(!.MNA_Index, Module - Name, MN_Arities0) ->
multi_map.set(MN_Arities0, Arity, PredId, MN_Arities),
svmap.det_update(Module - Name, MN_Arities, !MNA_Index)
@@ -1115,11 +1127,11 @@
module_info_get_predicate_table(Module, PredTable),
(
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
predicate_table_search_pred_m_n_a(PredTable, is_fully_qualified,
ModuleName, ProcName, Arity, [PredId0])
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
predicate_table_search_func_m_n_a(PredTable, is_fully_qualified,
ModuleName, ProcName, Arity, [PredId0])
)
@@ -1133,11 +1145,11 @@
% typeclass_infos, as this code here does, is error-prone as well as
% inefficient.
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
predicate_table_search_pred_m_n_a(PredTable, is_fully_qualified,
ModuleName, ProcName, Arity - 1, [PredId0])
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
predicate_table_search_func_m_n_a(PredTable, is_fully_qualified,
ModuleName, ProcName, Arity - 1, [PredId0])
)
Index: compiler/proc_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/proc_gen.m,v
retrieving revision 1.17
diff -u -b -r1.17 proc_gen.m
--- compiler/proc_gen.m 15 Jan 2007 02:23:48 -0000 1.17
+++ compiler/proc_gen.m 17 Jan 2007 07:08:06 -0000
@@ -44,7 +44,7 @@
% Translate a HLDS module to LLDS.
%
-:- pred generate_module_code(module_info::in,
+:- pred generate_module_code(module_info::in, module_info::out,
global_data::in, global_data::out,
list(c_procedure)::out, io::di, io::uo) is det.
@@ -109,11 +109,11 @@
%---------------------------------------------------------------------------%
-generate_module_code(ModuleInfo0, !GlobalData, Procedures, !IO) :-
+generate_module_code(!ModuleInfo, !GlobalData, Procedures, !IO) :-
% Get a list of all the predicate ids for which we will generate code.
- module_info_predids(ModuleInfo0, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
% Check if we want to use parallel code generation.
- module_info_get_globals(ModuleInfo0, Globals),
+ module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_bool_option(Globals, parallel_code_gen, ParallelCodeGen),
globals.lookup_bool_option(Globals, very_verbose, VeryVerbose),
globals.lookup_bool_option(Globals, detailed_statistics, Statistics),
@@ -123,10 +123,10 @@
VeryVerbose = no,
Statistics = no
->
- generate_code_parallel(ModuleInfo0, PredIds, !GlobalData,
+ generate_code_parallel(!.ModuleInfo, PredIds, !GlobalData,
Procedures)
;
- generate_code_sequential(ModuleInfo0, PredIds, !GlobalData,
+ generate_code_sequential(!.ModuleInfo, PredIds, !GlobalData,
Procedures, !IO)
).
@@ -1260,7 +1260,7 @@
"\t\t\t""", PredName, """,\n",
"\t\t\t", ProcStr, ",\n",
"\t\t\t", ArityStr, ",\n",
- "\t\t\t", (PredOrFunc = function -> "MR_TRUE" ; "MR_FALSE"), "\n",
+ "\t\t\t", (PredOrFunc = pf_function -> "MR_TRUE" ; "MR_FALSE"), "\n",
"\t\t};\n"
], CallStruct),
Index: compiler/prog_io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io.m,v
retrieving revision 1.280
diff -u -b -r1.280 prog_io.m
--- compiler/prog_io.m 12 Jan 2007 05:00:29 -0000 1.280
+++ compiler/prog_io.m 17 Jan 2007 07:21:44 -0000
@@ -1012,7 +1012,7 @@
maybe1(item)::out) is det.
process_pred_clause(ok2(Name, Args0), VarSet, Body,
- ok1(item_clause(user, VarSet, predicate, Name, Args, Body))) :-
+ ok1(item_clause(user, VarSet, pf_predicate, Name, Args, Body))) :-
list.map(term.coerce, Args0, Args).
process_pred_clause(error2(Errors0), _, _, error1(Errors)) :-
Errors = assoc_list.map_values_only(term.coerce, Errors0).
@@ -1021,7 +1021,7 @@
goal::in, maybe1(item)::out) is det.
process_func_clause(ok2(Name, Args0), Result0, VarSet, Body,
- ok1(item_clause(user, VarSet, function, Name, Args, Body))) :-
+ ok1(item_clause(user, VarSet, pf_function, Name, Args, Body))) :-
list.append(Args0, [Result0], Args1),
list.map(term.coerce, Args1, Args).
process_func_clause(error2(Errors0), _, _, _, error1(Errors)) :-
@@ -1628,7 +1628,7 @@
get_with_inst(Body2, Body3, WithInst),
get_with_type(Body3, Body4, WithTypeResult),
( WithTypeResult = ok1(WithType),
- process_type_decl_pred_or_func(predicate, ModuleName, WithType,
+ process_type_decl_pred_or_func(pf_predicate, ModuleName, WithType,
WithInst, MaybeDeterminism, VarSet, Body4, Condition, Attributes,
Result)
;
@@ -1657,7 +1657,7 @@
(
% Function declarations with `with_type` annotations
% have the same form as predicate declarations.
- PredOrFunc = function,
+ PredOrFunc = pf_function,
WithType = no
->
process_func(ModuleName, VarSet, Body, Condition,
@@ -1693,7 +1693,7 @@
get_with_type(Body3, Body4, WithTypeResult),
(
WithTypeResult = ok1(WithType),
- process_type_decl_pred_or_func(function, ModuleName,
+ process_type_decl_pred_or_func(pf_function, ModuleName,
WithType, WithInst, MaybeDeterminism, VarSet, Body4,
Condition, Attributes, Result)
;
@@ -2908,8 +2908,8 @@
:- func pred_or_func_decl_string(pred_or_func) = string.
-pred_or_func_decl_string(function) = "`:- func' declaration".
-pred_or_func_decl_string(predicate) = "`:- pred' declaration".
+pred_or_func_decl_string(pf_function) = "`:- func' declaration".
+pred_or_func_decl_string(pf_predicate) = "`:- pred' declaration".
%-----------------------------------------------------------------------------%
@@ -3158,8 +3158,8 @@
->
Origin = user,
Result0 = ok1(item_pred_or_func(Origin, TVarSet, IVarSet,
- ExistQVars, function, F, Args, no, no, MaybeDet, Cond,
- Purity, ClassContext)),
+ ExistQVars, pf_function, F, Args, no, no, MaybeDet,
+ Cond, Purity, ClassContext)),
check_no_attributes(Result0, Attributes, Result)
;
Msg = "inconsistent constraints on inst variables " ++
@@ -3245,7 +3245,7 @@
( inst_var_constraints_are_consistent_in_modes(As) ->
(
WithInst = no,
- PredOrFunc = yes(predicate)
+ PredOrFunc = yes(pf_predicate)
;
WithInst = yes(_),
% We don't know whether it's a predicate or a function
@@ -3291,8 +3291,8 @@
varset.coerce(VarSet0, VarSet),
list.append(As, [RetMode], ArgModes),
( inst_var_constraints_are_consistent_in_modes(ArgModes) ->
- Result0 = ok1(item_pred_or_func_mode(VarSet, yes(function),
- F, ArgModes, no, MaybeDet, Cond))
+ Result0 = ok1(item_pred_or_func_mode(VarSet,
+ yes(pf_function), F, ArgModes, no, MaybeDet, Cond))
;
Msg = "inconsistent constraints on inst variables " ++
"in function mode declaration",
Index: compiler/prog_io_dcg.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_dcg.m,v
retrieving revision 1.41
diff -u -b -r1.41 prog_io_dcg.m
--- compiler/prog_io_dcg.m 1 Dec 2006 15:04:16 -0000 1.41
+++ compiler/prog_io_dcg.m 17 Jan 2007 07:21:53 -0000
@@ -683,7 +683,7 @@
prog_var::in, goal::in, prog_context::in, maybe1(item)::out) is det.
process_dcg_clause(ok2(Name, Args0), VarSet, Var0, Var, Body, Context,
- ok1(item_clause(user, VarSet, predicate, Name, Args, Body))) :-
+ ok1(item_clause(user, VarSet, pf_predicate, Name, Args, Body))) :-
list.map(term.coerce, Args0, Args1),
Args = Args1 ++ [variable(Var0, Context), variable(Var, Context)].
process_dcg_clause(error2(Errors), _, _, _, _, _, error1(Errors)).
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.121
diff -u -b -r1.121 prog_io_pragma.m
--- compiler/prog_io_pragma.m 15 Jan 2007 02:23:49 -0000 1.121
+++ compiler/prog_io_pragma.m 17 Jan 2007 07:40:48 -0000
@@ -439,10 +439,10 @@
],
(
PredOrFuncTerm = term.functor(term.atom("predicate"), [], _),
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
PredOrFuncTerm = term.functor(term.atom("function"), [], _),
- PredOrFunc = function
+ PredOrFunc = pf_function
),
parse_implicitly_qualified_term(ModuleName, PredNameTerm, ErrorTerm,
"`:- pragma unused_args' declaration", PredNameResult),
@@ -770,10 +770,10 @@
],
(
PredOrFuncTerm = term.functor(term.atom("predicate"), [], _),
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
PredOrFuncTerm = term.functor(term.atom("function"), [], _),
- PredOrFunc = function
+ PredOrFunc = pf_function
),
parse_implicitly_qualified_term(ModuleName, PredNameTerm, ErrorTerm,
"`:- pragma exceptions' declaration", PredNameResult),
@@ -817,10 +817,10 @@
],
(
PredOrFuncTerm = term.functor(term.atom("predicate"), [], _),
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
PredOrFuncTerm = term.functor(term.atom("function"), [], _),
- PredOrFunc = function
+ PredOrFunc = pf_function
),
parse_implicitly_qualified_term(ModuleName, PredNameTerm, ErrorTerm,
"`:- pragma trailing_info' declaration", PredNameResult),
@@ -857,10 +857,10 @@
],
(
PredOrFuncTerm = term.functor(term.atom("predicate"), [], _),
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
PredOrFuncTerm = term.functor(term.atom("function"), [], _),
- PredOrFunc = function
+ PredOrFunc = pf_function
),
parse_implicitly_qualified_term(ModuleName, PredNameTerm,
ErrorTerm, "`:- pragma mm_tabling_info' declaration",
@@ -1889,10 +1889,10 @@
% Is this a function or a predicate?
MaybeRetTerm = yes(FuncResultTerm0)
->
- PredOrFunc = function,
+ PredOrFunc = pf_function,
list.append(VarList0, [FuncResultTerm0], VarList)
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
VarList = VarList0
),
parse_pragma_c_code_varlist(VarSet0, VarList, PragmaVars, Error),
@@ -2191,7 +2191,7 @@
(
PredAndModesResult = ok2(PredName - PredOrFunc, Modes),
list.length(Modes, Arity0),
- ( PredOrFunc = function ->
+ ( PredOrFunc = pf_function ->
Arity = Arity0 - 1
;
Arity = Arity0
@@ -2228,14 +2228,14 @@
->
list.append(ArgModes0, [RetMode], ArgModes1),
list.map(constrain_inst_vars_in_mode, ArgModes1, ArgModes),
- Result = ok2(PredName - function, ArgModes)
+ Result = ok2(PredName - pf_function, ArgModes)
;
ErrorMsg = "error in return mode in " ++ Msg,
Result = error2([ErrorMsg - ErrorTerm])
)
;
MaybeRetModeTerm = no,
- Result = ok2(PredName - predicate, ArgModes0)
+ Result = ok2(PredName - pf_predicate, ArgModes0)
)
;
ErrorMsg = "error in argument modes in " ++ Msg,
Index: compiler/prog_io_typeclass.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_typeclass.m,v
retrieving revision 1.58
diff -u -b -r1.58 prog_io_typeclass.m
--- compiler/prog_io_typeclass.m 1 Dec 2006 15:04:16 -0000 1.58
+++ compiler/prog_io_typeclass.m 17 Jan 2007 07:22:45 -0000
@@ -754,7 +754,7 @@
parse_qualified_term(InstanceMethod, InstanceMethod,
"instance method", ok2(InstanceMethodName, []))
->
- Result = ok1(instance_method(predicate, ClassMethodName,
+ Result = ok1(instance_method(pf_predicate, ClassMethodName,
instance_proc_def_name(InstanceMethodName), ArityInt,
TermContext))
;
@@ -772,7 +772,7 @@
parse_qualified_term(InstanceMethod, InstanceMethod,
"instance method", ok2(InstanceMethodName, []))
->
- Result = ok1(instance_method(function, ClassMethodName,
+ Result = ok1(instance_method(pf_function, ClassMethodName,
instance_proc_def_name(InstanceMethodName), ArityInt,
TermContext))
;
Index: compiler/prog_io_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_io_util.m,v
retrieving revision 1.56
diff -u -b -r1.56 prog_io_util.m
--- compiler/prog_io_util.m 1 Dec 2006 15:04:16 -0000 1.56
+++ compiler/prog_io_util.m 17 Jan 2007 07:23:17 -0000
@@ -226,8 +226,8 @@
parse_pred_or_func_name_and_arity(ModuleName, PorFPredAndArityTerm,
PredOrFunc, SymName, Arity) :-
PorFPredAndArityTerm = term.functor(term.atom(PredOrFuncStr), Args, _),
- ( PredOrFuncStr = "pred", PredOrFunc = predicate
- ; PredOrFuncStr = "func", PredOrFunc = function
+ ( PredOrFuncStr = "pred", PredOrFunc = pf_predicate
+ ; PredOrFuncStr = "func", PredOrFunc = pf_function
),
Args = [Arg],
parse_name_and_arity(ModuleName, Arg, SymName, Arity).
@@ -242,11 +242,11 @@
ok2(SymName, ArgTerms0 - MaybeRetTerm)),
(
MaybeRetTerm = yes(RetTerm),
- PredOrFunc = function,
+ PredOrFunc = pf_function,
list.append(ArgTerms0, [RetTerm], ArgTerms)
;
MaybeRetTerm = no,
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
ArgTerms = ArgTerms0
).
@@ -482,7 +482,7 @@
DetTerm = term.functor(term.atom(DetString), [], _),
standard_det(DetString, Detism),
convert_mode_list(AllowConstrainedInstVar, ArgModesTerms, ArgModes),
- PredInstInfo = pred_inst_info(predicate, ArgModes, Detism),
+ PredInstInfo = pred_inst_info(pf_predicate, ArgModes, Detism),
Inst = ground(shared, higher_order(PredInstInfo)),
Mode = (Inst -> Inst)
;
@@ -503,7 +503,7 @@
convert_mode_list(AllowConstrainedInstVar, ArgModesTerms, ArgModes0),
convert_mode(AllowConstrainedInstVar, RetModeTerm, RetMode),
list.append(ArgModes0, [RetMode], ArgModes),
- FuncInstInfo = pred_inst_info(function, ArgModes, Detism),
+ FuncInstInfo = pred_inst_info(pf_function, ArgModes, Detism),
Inst = ground(shared, higher_order(FuncInstInfo)),
Mode = (Inst -> Inst)
;
@@ -540,7 +540,7 @@
DetTerm = term.functor(term.atom(DetString), [], _),
standard_det(DetString, Detism),
convert_mode_list(AllowConstrainedInstVar, ArgModesTerm, ArgModes),
- PredInst = pred_inst_info(predicate, ArgModes, Detism),
+ PredInst = pred_inst_info(pf_predicate, ArgModes, Detism),
Result = ground(shared, higher_order(PredInst))
;
% The syntax for a higher-order func inst is
@@ -559,7 +559,7 @@
convert_mode_list(AllowConstrainedInstVar, ArgModesTerm, ArgModes0),
convert_mode(AllowConstrainedInstVar, RetModeTerm, RetMode),
list.append(ArgModes0, [RetMode], ArgModes),
- FuncInst = pred_inst_info(function, ArgModes, Detism),
+ FuncInst = pred_inst_info(pf_function, ArgModes, Detism),
Result = ground(shared, higher_order(FuncInst))
; Name = "bound", Args0 = [Disj] ->
Index: compiler/prog_mutable.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_mutable.m,v
retrieving revision 1.20
diff -u -b -r1.20 prog_mutable.m
--- compiler/prog_mutable.m 12 Jan 2007 05:00:29 -0000 1.20
+++ compiler/prog_mutable.m 17 Jan 2007 07:23:56 -0000
@@ -333,7 +333,7 @@
Origin = compiler(mutable_decl),
UnsafeGetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet,
ExistQVars,
- predicate,
+ pf_predicate,
mutable_unsafe_get_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, out_mode(Inst))],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -347,7 +347,7 @@
Origin = compiler(mutable_decl),
UnsafeSetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet,
ExistQVars,
- predicate,
+ pf_predicate,
mutable_unsafe_set_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, in_mode(Inst))],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -360,7 +360,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
LockPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_lock_pred_sym_name(ModuleName, Name),
[],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -373,7 +373,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
UnlockPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_unlock_pred_sym_name(ModuleName, Name),
[],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -388,7 +388,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
GetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_get_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, out_mode(Inst))],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -401,7 +401,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
SetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_set_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, in_mode(Inst))],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -414,7 +414,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
GetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_get_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, out_mode(Inst))],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -427,7 +427,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
SetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_secret_set_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, in_mode(Inst))],
no /* with_type */, no /* with_inst */, yes(detism_det),
@@ -440,7 +440,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
GetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_get_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, out_mode(Inst)),
type_and_mode(io_state_type, di_mode),
@@ -455,7 +455,7 @@
Constraints = constraints([], []),
Origin = compiler(mutable_decl),
SetPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate,
+ pf_predicate,
mutable_set_pred_sym_name(ModuleName, Name),
[type_and_mode(Type, in_mode(Inst)),
type_and_mode(io_state_type, di_mode),
@@ -474,7 +474,7 @@
Condition = cond_true,
Origin = compiler(mutable_decl),
InitPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet, ExistQVars,
- predicate, mutable_init_pred_sym_name(ModuleName, Name), ArgDecls,
+ pf_predicate, mutable_init_pred_sym_name(ModuleName, Name), ArgDecls,
WithType, WithInst, yes(detism_det), Condition,
purity_impure, Constraints).
@@ -489,7 +489,7 @@
Condition = cond_true,
Origin = compiler(mutable_decl),
PreInitPredDecl = item_pred_or_func(Origin, VarSet, InstVarSet,
- ExistQVars, predicate,
+ ExistQVars, pf_predicate,
mutable_pre_init_pred_sym_name(ModuleName, Name),
ArgDecls, WithType, WithInst, yes(detism_det), Condition,
purity_impure, Constraints).
Index: compiler/prog_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_out.m,v
retrieving revision 1.80
diff -u -b -r1.80 prog_out.m
--- compiler/prog_out.m 27 Dec 2006 04:16:29 -0000 1.80
+++ compiler/prog_out.m 17 Jan 2007 07:24:09 -0000
@@ -368,11 +368,11 @@
write_pred_or_func(PorF, !IO) :-
io.write_string(pred_or_func_to_full_str(PorF), !IO).
-pred_or_func_to_full_str(predicate) = "predicate".
-pred_or_func_to_full_str(function) = "function".
+pred_or_func_to_full_str(pf_predicate) = "predicate".
+pred_or_func_to_full_str(pf_function) = "function".
-pred_or_func_to_str(predicate) = "pred".
-pred_or_func_to_str(function) = "func".
+pred_or_func_to_str(pf_predicate) = "pred".
+pred_or_func_to_str(pf_function) = "func".
write_purity_prefix(Purity, !IO) :-
( Purity = purity_pure ->
Index: compiler/prog_type.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_type.m,v
retrieving revision 1.31
diff -u -b -r1.31 prog_type.m
--- compiler/prog_type.m 21 Dec 2006 11:11:28 -0000 1.31
+++ compiler/prog_type.m 17 Jan 2007 07:24:29 -0000
@@ -433,11 +433,11 @@
higher_order_type(ArgTypes, MaybeRetType, Purity, EvalMethod),
(
MaybeRetType = yes(RetType),
- PredOrFunc = function,
+ PredOrFunc = pf_function,
PredArgTypes = list.append(ArgTypes, [RetType])
;
MaybeRetType = no,
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
PredArgTypes = ArgTypes
).
@@ -537,10 +537,10 @@
get_purity_and_eval_method(SymName, Purity, EvalMethod, PorFStr),
(
PorFStr = "pred",
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
;
PorFStr = "func",
- PredOrFunc = function
+ PredOrFunc = pf_function
).
:- pred get_purity_and_eval_method(sym_name::in, purity::out,
@@ -660,10 +660,10 @@
construct_higher_order_type(Purity, PredOrFunc, EvalMethod, ArgTypes, Type) :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
construct_higher_order_pred_type(Purity, EvalMethod, ArgTypes, Type)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgTypes, FuncArgTypes, FuncRetType),
construct_higher_order_func_type(Purity, EvalMethod, FuncArgTypes,
FuncRetType, Type)
Index: compiler/prog_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_util.m,v
retrieving revision 1.99
diff -u -b -r1.99 prog_util.m
--- compiler/prog_util.m 13 Jan 2007 12:23:13 -0000 1.99
+++ compiler/prog_util.m 17 Jan 2007 07:41:35 -0000
@@ -288,6 +288,7 @@
:- import_module libs.compiler_util.
:- import_module parse_tree.mercury_to_mercury.
+:- import_module parse_tree.prog_out.
:- import_module bool.
:- import_module int.
@@ -337,8 +338,8 @@
%-----------------------------------------------------------------------------%
-adjust_func_arity(predicate, Arity, Arity).
-adjust_func_arity(function, Arity - 1, Arity).
+adjust_func_arity(pf_predicate, Arity, Arity).
+adjust_func_arity(pf_function, Arity - 1, Arity).
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
@@ -571,13 +572,7 @@
NewPredId, SymName) :-
(
MaybePredOrFunc = yes(PredOrFunc),
- (
- PredOrFunc = predicate,
- PFS = "pred"
- ;
- PredOrFunc = function,
- PFS = "func"
- )
+ PFS = pred_or_func_to_str(PredOrFunc)
;
MaybePredOrFunc = no,
PFS = "pred_or_func"
Index: compiler/pseudo_type_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/pseudo_type_info.m,v
retrieving revision 1.28
diff -u -b -r1.28 pseudo_type_info.m
--- compiler/pseudo_type_info.m 27 Sep 2006 06:17:02 -0000 1.28
+++ compiler/pseudo_type_info.m 17 Jan 2007 07:08:06 -0000
@@ -243,10 +243,10 @@
type_is_var_arity(Type, VarArityCtorId) :-
( type_is_higher_order_details(Type, _Purity, PredOrFunc, _, _) ->
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
VarArityCtorId = pred_type_info
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
VarArityCtorId = func_type_info
)
; type_is_tuple(Type, _) ->
Index: compiler/purity.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/purity.m,v
retrieving revision 1.110
diff -u -b -r1.110 purity.m
--- compiler/purity.m 6 Jan 2007 09:23:49 -0000 1.110
+++ compiler/purity.m 17 Jan 2007 07:08:06 -0000
@@ -218,7 +218,7 @@
finish_typecheck_and_check_preds_purity(FoundTypeError, PostTypecheckError,
!ModuleInfo, !Specs) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
% Only report error messages for unbound type variables if we didn't get
% any type errors already; this avoids a lot of spurious diagnostics.
@@ -1073,11 +1073,11 @@
Pieces1 = [words("In call to "), fixed(PurityName)] ++
PredPieces ++ [suffix(":"), nl],
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Pieces2 = [words("purity error: call must be preceded by"),
quote(PurityName), words("indicator."), nl]
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Pieces2 = [words("purity error: call must be in"),
words("an explicit unification which is preceded by"),
quote(PurityName), words("indicator."), nl]
Index: compiler/qual_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/qual_info.m,v
retrieving revision 1.20
diff -u -b -r1.20 qual_info.m
--- compiler/qual_info.m 6 Jan 2007 09:23:49 -0000 1.20
+++ compiler/qual_info.m 17 Jan 2007 07:08:06 -0000
@@ -287,13 +287,13 @@
do_construct_pred_or_func_call(PredId, PredOrFunc, SymName, Args,
GoalInfo, Goal) :-
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Goal = hlds_goal(
plain_call(PredId, invalid_proc_id, Args, not_builtin, no,
SymName),
GoalInfo)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Args, FuncArgs, RetArg),
list.length(FuncArgs, Arity),
ConsId = cons(SymName, Arity),
Index: compiler/recompilation.check.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.check.m,v
retrieving revision 1.38
diff -u -b -r1.38 recompilation.check.m
--- compiler/recompilation.check.m 6 Jan 2007 09:23:50 -0000 1.38
+++ compiler/recompilation.check.m 18 Jan 2007 02:31:39 -0000
@@ -158,8 +158,8 @@
;
ModulesToRecompile = some_modules(_),
!:Info = !.Info ^ is_inline_sub_module := yes,
- list.foldl2(should_recompile_2(yes,
- FindTargetFiles, FindTimestampFiles),
+ list.foldl2(
+ should_recompile_2(yes, FindTargetFiles, FindTimestampFiles),
!.Info ^ sub_modules, !Info, !IO)
)
;
@@ -528,8 +528,8 @@
(
Term = term.functor(term.atom(PredOrFuncStr),
[ModuleTerm, ArityTerm], _),
- ( PredOrFuncStr = "predicate", PredOrFunc = predicate
- ; PredOrFuncStr = "function", PredOrFunc = function
+ ( PredOrFuncStr = "predicate", PredOrFunc = pf_predicate
+ ; PredOrFuncStr = "function", PredOrFunc = pf_function
),
sym_name_and_args(ModuleTerm, ModuleName, []),
ArityTerm = term.functor(term.integer(Arity), [], _)
@@ -748,10 +748,11 @@
NewInstanceVersionNumbers),
% Check whether any of the items which were used have changed.
- list.foldl(check_item_version_numbers(ModuleName, UsedItemVersionNumbers,
+ list.foldl(
+ check_item_version_numbers(ModuleName, UsedItemVersionNumbers,
NewItemVersionNumbers),
- [type_item, type_body_item, inst_item, mode_item, typeclass_item,
- predicate_item, function_item], !Info),
+ [type_abstract_item, type_body_item, inst_item, mode_item,
+ typeclass_item, predicate_item, function_item], !Info),
% Check whether added or modified items could cause name resolution
% ambiguities with items which were used.
@@ -866,7 +867,8 @@
Item = item_type_defn(_, Name, Params, Body, _),
Arity = list.length(Params),
check_for_simple_item_ambiguity(NeedQualifier, OldTimestamp,
- VersionNumbers, type_item, Name, Arity, NeedsCheck, !Info),
+ VersionNumbers, type_abstract_item, Name, Arity, NeedsCheck,
+ !Info),
(
NeedsCheck = yes,
check_type_defn_ambiguity_with_functor(NeedQualifier,
@@ -1039,7 +1041,8 @@
),
PredId = invalid_pred_id,
- ( SymName = qualified(ModuleName, _) ->
+ (
+ SymName = qualified(ModuleName, _),
(
WithType = yes(_),
% We don't know the actual arity.
@@ -1053,6 +1056,7 @@
check_functor_ambiguities_by_name(NeedQualifier, SymName,
AritiesToMatch, ResolvedFunctor, !Info)
;
+ SymName = unqualified(_),
unexpected(this_file,
"check_for_pred_or_func_item_ambiguity: " ++
"unqualified predicate name")
@@ -1459,7 +1463,7 @@
:- pred body_item(item_type::in, item_type::out) is semidet.
-body_item(type_body_item, type_item).
+body_item(type_body_item, type_abstract_item).
:- func describe_functor(sym_name, arity, resolved_functor) =
list(format_component).
Index: compiler/recompilation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.m,v
retrieving revision 1.25
diff -u -b -r1.25 recompilation.m
--- compiler/recompilation.m 7 Sep 2006 05:51:05 -0000 1.25
+++ compiler/recompilation.m 18 Jan 2007 02:15:01 -0000
@@ -66,7 +66,7 @@
---> item_name(sym_name, arity).
:- type item_type
- ---> type_item % Just the name of the type, not its body.
+ ---> type_abstract_item % Just the name of the type, not its body.
% It is common for a value of a type to
% be passed through a predicate without
% inspecting the value -- such predicates
@@ -84,7 +84,7 @@
; foreign_proc_item.
:- inst simple_item
- ---> type_item
+ ---> type_abstract_item
; type_body_item
; mode_item
; inst_item
@@ -288,10 +288,10 @@
%-----------------------------------------------------------------------------%
-pred_or_func_to_item_type(predicate) = predicate_item.
-pred_or_func_to_item_type(function) = function_item.
+pred_or_func_to_item_type(pf_predicate) = predicate_item.
+pred_or_func_to_item_type(pf_function) = function_item.
-is_simple_item_type(type_item).
+is_simple_item_type(type_abstract_item).
is_simple_item_type(type_body_item).
is_simple_item_type(inst_item).
is_simple_item_type(mode_item).
@@ -300,7 +300,7 @@
is_pred_or_func_item_type(predicate_item).
is_pred_or_func_item_type(function_item).
-string_to_item_type("type", type_item).
+string_to_item_type("type", type_abstract_item).
string_to_item_type("type_body", type_body_item).
string_to_item_type("inst", inst_item).
string_to_item_type("mode", mode_item).
@@ -331,13 +331,14 @@
init_used_items = item_id_set(map.init, map.init, map.init, map.init,
map.init, map.init, map.init, map.init, map.init, map.init).
-extract_simple_item_set(Items, type_item) = Items ^ types.
+extract_simple_item_set(Items, type_abstract_item) = Items ^ types.
extract_simple_item_set(Items, type_body_item) = Items ^ type_bodies.
extract_simple_item_set(Items, mode_item) = Items ^ modes.
extract_simple_item_set(Items, inst_item) = Items ^ insts.
extract_simple_item_set(Items, typeclass_item) = Items ^ typeclasses.
-update_simple_item_set(Items, type_item, IdMap) = Items ^ types := IdMap.
+update_simple_item_set(Items, type_abstract_item, IdMap) =
+ Items ^ types := IdMap.
update_simple_item_set(Items, type_body_item, IdMap) =
Items ^ type_bodies := IdMap.
update_simple_item_set(Items, mode_item, IdMap) = Items ^ modes := IdMap.
@@ -353,7 +354,7 @@
update_pred_or_func_set(Items, function_item, Set) =
Items ^ functions := Set.
-extract_ids(Items, type_item) = Items ^ types.
+extract_ids(Items, type_abstract_item) = Items ^ types.
extract_ids(Items, type_body_item) = Items ^ type_bodies.
extract_ids(Items, mode_item) = Items ^ modes.
extract_ids(Items, inst_item) = Items ^ insts.
@@ -364,7 +365,7 @@
extract_ids(Items, mutable_item) = Items ^ mutables.
extract_ids(Items, foreign_proc_item) = Items ^ foreign_procs.
-update_ids(Items, type_item, IdMap) = Items ^ types := IdMap.
+update_ids(Items, type_abstract_item, IdMap) = Items ^ types := IdMap.
update_ids(Items, type_body_item, IdMap) = Items ^ type_bodies := IdMap.
update_ids(Items, mode_item, IdMap) = Items ^ modes := IdMap.
update_ids(Items, inst_item, IdMap) = Items ^ insts := IdMap.
@@ -382,8 +383,8 @@
update_ids(NewItems0, ItemType,
Func(ItemType, extract_ids(Items0, ItemType)))
),
- [type_item, type_body_item, mode_item, inst_item, typeclass_item,
- functor_item, predicate_item, function_item],
+ [type_abstract_item, type_body_item, mode_item, inst_item,
+ typeclass_item, functor_item, predicate_item, function_item],
Items1).
%-----------------------------------------------------------------------------%
Index: compiler/recompilation.usage.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.usage.m,v
retrieving revision 1.42
diff -u -b -r1.42 recompilation.usage.m
--- compiler/recompilation.usage.m 1 Dec 2006 15:04:18 -0000 1.42
+++ compiler/recompilation.usage.m 18 Jan 2007 03:34:45 -0000
@@ -148,8 +148,8 @@
list(module_name)::in, recompilation_info::in,
module_timestamps::in, io::di, io::uo) is det.
-write_usage_file_2(ModuleInfo, NestedSubModules,
- RecompInfo, Timestamps, !IO) :-
+write_usage_file_2(ModuleInfo, NestedSubModules, RecompInfo, Timestamps,
+ !IO) :-
io.write_int(usage_file_version_number, !IO),
io.write_string(",", !IO),
io.write_int(version_numbers_version_number, !IO),
@@ -186,7 +186,7 @@
io.write_string("used_items(\n\t", !IO),
some [!WriteComma] (
!:WriteComma = no,
- write_simple_item_matches(type_item, ResolvedUsedItems,
+ write_simple_item_matches(type_abstract_item, ResolvedUsedItems,
!WriteComma, !IO),
write_simple_item_matches(type_body_item, ResolvedUsedItems,
!WriteComma, !IO),
@@ -450,7 +450,7 @@
(
ResolvedFunctor = resolved_functor_pred_or_func(_, ModuleName,
PredOrFunc, Arity),
- io.write(PredOrFunc, !IO),
+ write_pred_or_func(PredOrFunc, !IO),
io.write_string("(", !IO),
mercury_output_bracketed_sym_name(ModuleName, !IO),
io.write_string(", ", !IO),
@@ -589,16 +589,16 @@
map.foldl(find_items_used_by_instances, Instances, !Info),
Predicates = UsedItems ^ predicates,
- find_items_used_by_preds(predicate, Predicates, !Info),
+ find_items_used_by_preds(pf_predicate, Predicates, !Info),
Functions = UsedItems ^ functions,
- find_items_used_by_preds(function, Functions, !Info),
+ find_items_used_by_preds(pf_function, Functions, !Info),
Constructors = UsedItems ^ functors,
find_items_used_by_functors(Constructors, !Info),
Types = UsedItems ^ types,
- find_items_used_by_simple_item_set(type_item, Types, !Info),
+ find_items_used_by_simple_item_set(type_abstract_item, Types, !Info),
TypeBodies = UsedItems ^ type_bodies,
find_items_used_by_simple_item_set(type_body_item, TypeBodies, !Info),
@@ -796,13 +796,13 @@
pred_info_get_exist_quant_tvars(PredInfo, PredExistQVars),
adjust_func_arity(PredOrFunc, OrigArity, PredArity),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
OrigArity >= Arity,
% We don't support first-class polymorphism, so you can't take
% the address of an existentially quantified predicate.
PredExistQVars = []
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
OrigArity >= Arity,
% We don't support first-class polymorphism, so you can't take
% the address of an existentially quantified function. You can however
@@ -914,7 +914,7 @@
:- pred find_items_used_by_item(item_type::in, item_name::in,
recompilation_usage_info::in, recompilation_usage_info::out) is det.
-find_items_used_by_item(type_item, TypeCtorItem, !Info) :-
+find_items_used_by_item(type_abstract_item, TypeCtorItem, !Info) :-
ModuleInfo = !.Info ^ module_info,
module_info_get_type_table(ModuleInfo, Types),
TypeCtor = item_name_to_type_ctor(TypeCtorItem),
@@ -972,9 +972,9 @@
true
).
find_items_used_by_item(predicate_item, ItemId, !Info) :-
- record_used_pred_or_func(predicate, ItemId, !Info).
+ record_used_pred_or_func(pf_predicate, ItemId, !Info).
find_items_used_by_item(function_item, ItemId, !Info) :-
- record_used_pred_or_func(function, ItemId, !Info).
+ record_used_pred_or_func(pf_function, ItemId, !Info).
find_items_used_by_item(functor_item, _, !Info) :-
unexpected(this_file, "find_items_used_by_item: functor").
find_items_used_by_item(mutable_item, _MutableItemId, !Info).
@@ -1280,7 +1280,8 @@
\+ type_ctor_is_higher_order(TypeCtor, _, _, _)
->
TypeCtorItem = type_ctor_to_item_name(TypeCtor),
- maybe_record_item_to_process(type_item, TypeCtorItem, !Info)
+ maybe_record_item_to_process(type_abstract_item, TypeCtorItem,
+ !Info)
;
true
),
Index: compiler/recompilation.version.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.version.m,v
retrieving revision 1.57
diff -u -b -r1.57 recompilation.version.m
--- compiler/recompilation.version.m 6 Jan 2007 09:23:50 -0000 1.57
+++ compiler/recompilation.version.m 18 Jan 2007 02:30:10 -0000
@@ -314,7 +314,7 @@
),
TypeCtorItem = item_name(Name, list.length(Args)),
GatheredItems0 = !.Info ^ gathered_items,
- add_gathered_item(NameItem, item_id(type_item, TypeCtorItem),
+ add_gathered_item(NameItem, item_id(type_abstract_item, TypeCtorItem),
ItemContext, !.Section, yes, GatheredItems0, GatheredItems1),
add_gathered_item(BodyItem, item_id(type_body_item, TypeCtorItem),
ItemContext, !.Section, yes, GatheredItems1, GatheredItems),
@@ -509,7 +509,7 @@
item_to_item_id_2(item_clause(_, _, _, _, _, _), no).
item_to_item_id_2(item_type_defn(_, Name, Params, _, _),
- yes(item_id(type_item, item_name(Name, Arity)))) :-
+ yes(item_id(type_abstract_item, item_name(Name, Arity)))) :-
list.length(Params, Arity).
item_to_item_id_2(item_inst_defn(_, Name, Params, _, _),
yes(item_id(inst_item, item_name(Name, Arity)))) :-
@@ -751,10 +751,10 @@
% added later by make_hlds.m, so they won't have been
% split into a separate declaration here.
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Det1 = Det2
;
- PredOrFunc = predicate
+ PredOrFunc = pf_predicate
),
pred_or_func_type_is_unchanged(TVarSet1, ExistQVars1,
@@ -1004,7 +1004,7 @@
ItemVersions = extract_ids(VersionNumbers, ItemType),
\+ map.is_empty(ItemVersions)
),
- [type_item, type_body_item, mode_item, inst_item,
+ [type_abstract_item, type_body_item, mode_item, inst_item,
predicate_item, function_item, typeclass_item]),
io.write_string("{\n\t", !IO),
io.write_list(VersionNumbersList, ",\n\t",
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.78
diff -u -b -r1.78 rtti.m
--- compiler/rtti.m 5 Jan 2007 02:19:39 -0000 1.78
+++ compiler/rtti.m 17 Jan 2007 07:08:06 -0000
@@ -1520,8 +1520,8 @@
%-----------------------------------------------------------------------------%
-pred_or_func_to_string(predicate, "MR_PREDICATE").
-pred_or_func_to_string(function, "MR_FUNCTION").
+pred_or_func_to_string(pf_predicate, "MR_PREDICATE").
+pred_or_func_to_string(pf_function, "MR_FUNCTION").
sectag_locn_to_string(sectag_none, "MR_SECTAG_NONE").
sectag_locn_to_string(sectag_local, "MR_SECTAG_LOCAL").
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.205
diff -u -b -r1.205 simplify.m
--- compiler/simplify.m 15 Jan 2007 02:23:50 -0000 1.205
+++ compiler/simplify.m 17 Jan 2007 09:54:19 -0000
@@ -1554,7 +1554,7 @@
EvalInstMapDeltaSrc = [],
goal_info_get_context(ScopeGoalInfo, Context),
generate_foreign_proc(PrivateBuiltin, EvalPredName,
- predicate, only_mode, detism_semi, purity_semipure,
+ pf_predicate, only_mode, detism_semi, purity_semipure,
EvalAttributes, [], [], yes(RuntimeExpr), EvalCode,
EvalFeatures, EvalInstMapDeltaSrc, ModuleInfo,
Context, CondGoal),
@@ -1722,7 +1722,7 @@
Unique = ground(unique, none),
ArgInsts = [R - Unique],
BuiltinModule = mercury_public_builtin_module,
- goal_util.generate_simple_call(BuiltinModule, "compare", predicate,
+ goal_util.generate_simple_call(BuiltinModule, "compare", pf_predicate,
mode_no(ModeNo), detism_det, purity_pure, Args, [], ArgInsts,
ModuleInfo, Context, CmpGoal0),
CmpGoal0 = hlds_goal(CmpExpr, CmpInfo0),
@@ -1964,28 +1964,47 @@
simplify_library_call("int", PredName, _ModeNum, CrossCompiling, Args,
GoalExpr, !GoalInfo, !Info) :-
+ CrossCompiling = no,
(
PredName = "quot_bits_per_int",
Args = [X, Y],
- CrossCompiling = no,
% There is no point in checking whether bits_per_int is 0; it isn't.
Op = "unchecked_quotient",
- IsBuiltin = inline_builtin
+ simplify_library_call_int_arity2(Op, X, Y, GoalExpr, !GoalInfo, !Info)
;
PredName = "times_bits_per_int",
Args = [X, Y],
- CrossCompiling = no,
Op = "*",
- IsBuiltin = inline_builtin
+ simplify_library_call_int_arity2(Op, X, Y, GoalExpr, !GoalInfo, !Info)
;
PredName = "rem_bits_per_int",
Args = [X, Y],
- CrossCompiling = no,
% There is no point in checking whether bits_per_int is 0; it isn't.
Op = "unchecked_rem",
- IsBuiltin = inline_builtin
- ),
+ simplify_library_call_int_arity2(Op, X, Y, GoalExpr, !GoalInfo, !Info)
+ ;
+ PredName = "bits_per_int",
+ Args = [X],
+ ConstConsId = int_const(int.bits_per_int),
+ RHS = rhs_functor(ConstConsId, no, []),
+ ModeOfX = out_mode,
+ ModeOfConstConsId = in_mode,
+ UnifyMode = ModeOfX - ModeOfConstConsId,
+ How = construct_dynamically,
+ IsUnique = cell_is_shared,
+ Sub = no_construct_sub_info,
+ Unification = construct(X, ConstConsId, [], [], How, IsUnique, Sub),
+ UnifyMainContext = umc_implicit("simplify_library_call"),
+ UnifyContext = unify_context(UnifyMainContext, []),
+ GoalExpr = unify(X, RHS, UnifyMode, Unification, UnifyContext)
+ ).
+
+:- pred simplify_library_call_int_arity2(string::in,
+ prog_var::in, prog_var::in, hlds_goal_expr::out,
+ hlds_goal_info::in, hlds_goal_info::out,
+ simplify_info::in, simplify_info::out) is semidet.
+simplify_library_call_int_arity2(Op, X, Y, GoalExpr, !GoalInfo, !Info) :-
simplify_info_get_varset(!.Info, VarSet0),
simplify_info_get_var_types(!.Info, VarTypes0),
varset.new_var(VarSet0, ConstVar, VarSet),
@@ -2020,6 +2039,7 @@
proc_id_to_int(OpProcId, OpProcIdInt),
OpArgs = [X, ConstVar, Y],
MaybeUnifyContext = no,
+ IsBuiltin = inline_builtin,
OpGoalExpr = plain_call(OpPredId, OpProcId, OpArgs, IsBuiltin,
MaybeUnifyContext, OpSymName),
@@ -2067,7 +2087,7 @@
% builtin_unify_pred (which calls error/1).
goal_info_get_context(GoalInfo0, GContext),
generate_simple_call(mercury_private_builtin_module,
- "builtin_unify_pred", predicate, mode_no(0), detism_semi,
+ "builtin_unify_pred", pf_predicate, mode_no(0), detism_semi,
purity_pure, [XVar, YVar], [], [], ModuleInfo, GContext,
hlds_goal(Call0, _)),
simplify_goal_2(Call0, Call1, GoalInfo0, GoalInfo, !Info, !IO),
@@ -2133,7 +2153,7 @@
ArgVars = [TypeInfoVar, XVar, YVar],
goal_info_get_context(GoalInfo, Context),
goal_util.generate_simple_call(mercury_public_builtin_module,
- "unify", predicate, mode_no(0), detism_semi, purity_pure, ArgVars,
+ "unify", pf_predicate, mode_no(0), detism_semi, purity_pure, ArgVars,
[], [], ModuleInfo, Context, Call).
:- pred call_specific_unify(type_ctor::in, list(prog_var)::in,
Index: compiler/size_prof.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/size_prof.m,v
retrieving revision 1.51
diff -u -b -r1.51 size_prof.m
--- compiler/size_prof.m 6 Jan 2007 09:23:51 -0000 1.51
+++ compiler/size_prof.m 17 Jan 2007 07:29:47 -0000
@@ -759,8 +759,9 @@
% so we make it a no_type_info_builtin.
TermSizeProfBuiltin = mercury_term_size_prof_builtin_module,
goal_util.generate_simple_call(TermSizeProfBuiltin,
- "increment_size", predicate, only_mode, detism_det, purity_impure,
- [Var, SizeVar], [], [], !.Info ^ module_info, Context, UpdateGoal),
+ "increment_size", pf_predicate, only_mode, detism_det,
+ purity_impure, [Var, SizeVar], [], [], !.Info ^ module_info,
+ Context, UpdateGoal),
% Put UnifyGoal first in case it fails.
Goals = [UnifyGoal] ++ ArgGoals ++ SizeGoals ++ [UpdateGoal],
GoalExpr = conj(plain_conj, Goals)
@@ -823,7 +824,7 @@
get_new_var(int_type, "FinalSizeVar", SizeVar, !Info),
TermSizeProfModule = mercury_term_size_prof_builtin_module,
goal_util.generate_simple_call(TermSizeProfModule,
- "term_size_plus", function, mode_no(0), detism_det, purity_pure,
+ "term_size_plus", pf_function, mode_no(0), detism_det, purity_pure,
[SizeVar0, KnownSizeVar, SizeVar], [],
[SizeVar - ground(shared, none)],
!.Info ^ module_info, Context, AddGoal),
@@ -886,7 +887,7 @@
!:Info = !.Info ^ vartypes := VarTypes,
PrivateBuiltin = mercury_private_builtin_module,
goal_util.generate_simple_call(PrivateBuiltin,
- "type_info_from_typeclass_info", predicate, only_mode,
+ "type_info_from_typeclass_info", pf_predicate, only_mode,
detism_det, purity_pure,
[TypeClassInfoVar, SlotVar, TypeInfoVar], [],
[TypeInfoVar - ground(shared, none)],
@@ -1012,7 +1013,7 @@
Args = [TypeInfoVar, Arg, SizeVar]
),
TermSizeProfBuiltin = mercury_term_size_prof_builtin_module,
- goal_util.generate_simple_call(TermSizeProfBuiltin, Pred, predicate,
+ goal_util.generate_simple_call(TermSizeProfBuiltin, Pred, pf_predicate,
only_mode, detism_det, purity_pure, Args,
[], [SizeVar - ground(shared, none)],
!.Info ^ module_info, Context, SizeGoal),
Index: compiler/state_var.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/state_var.m,v
retrieving revision 1.21
diff -u -b -r1.21 state_var.m
--- compiler/state_var.m 6 Jan 2007 09:23:51 -0000 1.21
+++ compiler/state_var.m 17 Jan 2007 07:08:06 -0000
@@ -1030,7 +1030,7 @@
%-----------------------------------------------------------------------------%
-illegal_state_var_func_result(function, Args, StateVar) :-
+illegal_state_var_func_result(pf_function, Args, StateVar) :-
list.last(Args, functor(atom("!"), [variable(StateVar, _)], _Ctxt)).
%-----------------------------------------------------------------------------%
Index: compiler/stratify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.59
diff -u -b -r1.59 stratify.m
--- compiler/stratify.m 6 Jan 2007 09:23:52 -0000 1.59
+++ compiler/stratify.m 17 Jan 2007 07:08:06 -0000
@@ -92,7 +92,7 @@
% is disabled because it is currently unable to detect cases where a
% higher order proc is hidden in some complex data structure
%
- % gen_conservative_graph(Module2, DepGraph0, DepGraph, HOInfo),
+ % gen_conservative_graph(!ModuleInfo, DepGraph0, DepGraph, HOInfo),
% relation.atsort(DepGraph, HOSCCs1),
% dep_sets_to_lists_and_sets(HOSCCs1, [], HOSCCs),
% higher_order_check_sccs(HOSCCs, HOInfo, !ModuleInfo, !IO).
@@ -443,11 +443,11 @@
% a new dependency graph with all possible higher order calls added.
% It also returns a map of all the higher order info it collects.
%
-:- pred gen_conservative_graph(module_info::in,
+:- pred gen_conservative_graph(module_info::in, module_info::out,
dependency_graph::in, dependency_graph::out, ho_map::out) is det.
-gen_conservative_graph(ModuleInfo, !DepGraph, HOInfo) :-
- get_call_info(ModuleInfo, ProcCalls, HOInfo0, CallsHO),
+gen_conservative_graph(!ModuleInfo, !DepGraph, HOInfo) :-
+ get_call_info(!ModuleInfo, ProcCalls, HOInfo0, CallsHO),
map.keys(ProcCalls, Callers),
iterate_solution(Callers, ProcCalls, CallsHO, HOInfo0, HOInfo),
map.to_assoc_list(HOInfo, HOInfoL),
@@ -458,15 +458,15 @@
% This pred also returns a set of all non imported procedures that
% make a higher order call.
%
-:- pred get_call_info(module_info::in, call_map::out, ho_map::out,
- set(pred_proc_id)::out) is det.
+:- pred get_call_info(module_info::in, module_info::out, call_map::out,
+ ho_map::out, set(pred_proc_id)::out) is det.
-get_call_info(ModuleInfo, !:ProcCalls, !:HOInfo, !:CallsHO) :-
+get_call_info(!ModuleInfo, !:ProcCalls, !:HOInfo, !:CallsHO) :-
map.init(!:ProcCalls),
map.init(!:HOInfo),
set.init(!:CallsHO),
- module_info_predids(ModuleInfo, PredIds),
- expand_predids(PredIds, ModuleInfo, !ProcCalls, !HOInfo, !CallsHO).
+ module_info_predids(PredIds, !ModuleInfo),
+ expand_predids(PredIds, !.ModuleInfo, !ProcCalls, !HOInfo, !CallsHO).
% Finds the transitive closure of a given list of procedures.
% This pred is used to see how face(???) a higher order address
Index: compiler/structure_reuse.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.analysis.m,v
retrieving revision 1.7
diff -u -b -r1.7 structure_reuse.analysis.m
--- compiler/structure_reuse.analysis.m 1 Dec 2006 15:04:21 -0000 1.7
+++ compiler/structure_reuse.analysis.m 17 Jan 2007 07:08:06 -0000
@@ -160,7 +160,7 @@
:- pred process_imported_reuse(module_info::in, module_info::out) is det.
process_imported_reuse(!ModuleInfo):-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl(process_imported_reuse_in_pred, PredIds, !ModuleInfo).
:- pred process_imported_reuse_in_pred(pred_id::in, module_info::in,
@@ -258,10 +258,10 @@
% Code for writing out optimization interfaces
%
-:- pred make_opt_int(module_info::in, io::di, io::uo) is det.
+:- pred make_opt_int(module_info::in, module_info::out, io::di, io::uo) is det.
-make_opt_int(ModuleInfo, !IO) :-
- module_info_get_name(ModuleInfo, ModuleName),
+make_opt_int(!ModuleInfo, !IO) :-
+ module_info_get_name(!.ModuleInfo, ModuleName),
module_name_to_file_name(ModuleName, ".opt.tmp", no, OptFileName, !IO),
globals.io_lookup_bool_option(verbose, Verbose, !IO),
maybe_write_string(Verbose, "% Appending structure_reuse pragmas to ",
@@ -273,8 +273,8 @@
(
OptFileRes = ok(OptFile),
io.set_output_stream(OptFile, OldStream, !IO),
- module_info_predids(ModuleInfo, PredIds),
- list.foldl(write_pred_reuse_info(ModuleInfo), PredIds, !IO),
+ module_info_predids(PredIds, !ModuleInfo),
+ list.foldl(write_pred_reuse_info(!.ModuleInfo), PredIds, !IO),
io.set_output_stream(OldStream, _, !IO),
io.close_output(OptFile, !IO),
maybe_write_string(Verbose, " done.\n", !IO)
Index: compiler/structure_reuse.direct.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.direct.m,v
retrieving revision 1.6
diff -u -b -r1.6 structure_reuse.direct.m
--- compiler/structure_reuse.direct.m 6 Jan 2007 10:56:17 -0000 1.6
+++ compiler/structure_reuse.direct.m 17 Jan 2007 07:08:06 -0000
@@ -103,7 +103,7 @@
get_strategy(Strategy, !ModuleInfo, !IO),
% Gather the pred-ids of the preds that need to be analysed.
- module_info_predids(!.ModuleInfo, AllPredIds),
+ module_info_predids(AllPredIds, !ModuleInfo),
list.filter(pred_requires_analysis(!.ModuleInfo), AllPredIds,
ToBeAnalysedPredIds),
Index: compiler/structure_reuse.domain.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_reuse.domain.m,v
retrieving revision 1.6
diff -u -b -r1.6 structure_reuse.domain.m
--- compiler/structure_reuse.domain.m 17 Oct 2006 19:02:20 -0000 1.6
+++ compiler/structure_reuse.domain.m 17 Jan 2007 07:08:06 -0000
@@ -707,7 +707,7 @@
reuse_as_short_description(ReuseAs) ++ "\n", !IO).
load_structure_reuse_table(ModuleInfo) = ReuseTable :-
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.foldl(load_structure_reuse_table_2(ModuleInfo), PredIds,
reuse_as_table_init, ReuseTable).
Index: compiler/structure_sharing.analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.analysis.m,v
retrieving revision 1.20
diff -u -b -r1.20 structure_sharing.analysis.m
--- compiler/structure_sharing.analysis.m 6 Jan 2007 09:23:53 -0000 1.20
+++ compiler/structure_sharing.analysis.m 17 Jan 2007 07:08:06 -0000
@@ -111,7 +111,7 @@
:- pred process_imported_sharing(module_info::in, module_info::out) is det.
process_imported_sharing(!ModuleInfo):-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl(process_imported_sharing_in_pred, PredIds, !ModuleInfo).
:- pred process_imported_sharing_in_pred(pred_id::in, module_info::in,
@@ -603,7 +603,7 @@
(
OptFileRes = ok(OptFile),
io.set_output_stream(OptFile, OldStream, !IO),
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.foldl(write_pred_sharing_info(ModuleInfo), PredIds, !IO),
io.set_output_stream(OldStream, _, !IO),
io.close_output(OptFile, !IO),
Index: compiler/structure_sharing.domain.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/structure_sharing.domain.m,v
retrieving revision 1.19
diff -u -b -r1.19 structure_sharing.domain.m
--- compiler/structure_sharing.domain.m 15 Jan 2007 10:30:35 -0000 1.19
+++ compiler/structure_sharing.domain.m 17 Jan 2007 07:08:06 -0000
@@ -848,7 +848,7 @@
%-----------------------------------------------------------------------------%
load_structure_sharing_table(ModuleInfo) = SharingTable :-
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.foldl(load_structure_sharing_table_2(ModuleInfo), PredIds,
sharing_as_table_init, SharingTable).
Index: compiler/superhomogeneous.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/superhomogeneous.m,v
retrieving revision 1.25
diff -u -b -r1.25 superhomogeneous.m
--- compiler/superhomogeneous.m 6 Jan 2007 09:23:53 -0000 1.25
+++ compiler/superhomogeneous.m 17 Jan 2007 07:08:06 -0000
@@ -555,14 +555,14 @@
term.coerce(HeadTerm0, HeadTerm1),
parse_purity_annotation(HeadTerm1, LambdaPurity, HeadTerm),
( parse_pred_expression(HeadTerm, EvalMethod0, Vars0, Modes0, Det0) ->
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
EvalMethod = EvalMethod0,
Vars1 = Vars0,
Modes1 = Modes0,
Det1 = Det0
;
parse_func_expression(HeadTerm, EvalMethod, Vars1, Modes1, Det1),
- PredOrFunc = function
+ PredOrFunc = pf_function
)
->
qualify_lambda_mode_list_if_not_opt_imported(Modes1, Modes, Context,
@@ -602,7 +602,7 @@
MaybeParsedGoal = ok1(ParsedGoal),
Vars1 = Vars0 ++
[term.variable(DCG0, Context), term.variable(DCGn, Context)],
- build_lambda_expression(X, Purity, DCGLambdaPurity, predicate,
+ build_lambda_expression(X, Purity, DCGLambdaPurity, pf_predicate,
EvalMethod, Vars1, Modes, Det, ParsedGoal, Context, MainContext,
SubContext, Goal0, NumAdded, !VarSet, !ModuleInfo, !QualInfo,
!.SInfo, !Specs),
@@ -933,10 +933,10 @@
% Figure out which variables we need to explicitly existentially
% quantify.
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
QuantifiedArgs = Args
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Args, QuantifiedArgs, _ReturnValTerm)
),
term.vars_list(QuantifiedArgs, QuantifiedVars0),
@@ -1023,7 +1023,7 @@
arg_context_to_unify_context(ac_head(PredOrFunc, Arity), ArgNum,
ArgContext, []) :-
- ( PredOrFunc = function, ArgNum = Arity ->
+ ( PredOrFunc = pf_function, ArgNum = Arity ->
% It's the function result term in the head.
ArgContext = umc_head_result
;
Index: compiler/switch_detection.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/switch_detection.m,v
retrieving revision 1.133
diff -u -b -r1.133 switch_detection.m
--- compiler/switch_detection.m 6 Jan 2007 09:23:53 -0000 1.133
+++ compiler/switch_detection.m 17 Jan 2007 07:08:06 -0000
@@ -87,7 +87,7 @@
detect_switches(!ModuleInfo, !IO) :-
% Traverse the module structure, calling `detect_switches_in_goal'
% for each procedure body.
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
detect_switches_in_preds(PredIds, !ModuleInfo, !IO).
:- pred detect_switches_in_preds(list(pred_id)::in,
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.131
diff -u -b -r1.131 table_gen.m
--- compiler/table_gen.m 15 Jan 2007 02:23:50 -0000 1.131
+++ compiler/table_gen.m 17 Jan 2007 07:29:59 -0000
@@ -2973,7 +2973,7 @@
;
Features = Features0
),
- goal_util.generate_simple_call(BuiltinModule, PredName, predicate,
+ goal_util.generate_simple_call(BuiltinModule, PredName, pf_predicate,
only_mode, Detism, Purity, Args, Features, InstMapSrc, ModuleInfo,
Context, Goal).
@@ -2997,7 +2997,7 @@
),
BuiltinModule = mercury_table_builtin_module,
MaybeTraceRuntimCond = no,
- goal_util.generate_foreign_proc(BuiltinModule, PredName, predicate,
+ goal_util.generate_foreign_proc(BuiltinModule, PredName, pf_predicate,
only_mode, Detism, Purity, Attributes, Args, ExtraArgs,
MaybeTraceRuntimCond, Code, Features, InstMapSrc, ModuleInfo,
Context, Goal).
Index: compiler/tabling_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/tabling_analysis.m,v
retrieving revision 1.8
diff -u -b -r1.8 tabling_analysis.m
--- compiler/tabling_analysis.m 6 Jan 2007 09:23:54 -0000 1.8
+++ compiler/tabling_analysis.m 17 Jan 2007 07:08:06 -0000
@@ -792,7 +792,7 @@
OptFileRes = ok(OptFile),
io.set_output_stream(OptFile, OldStream, !IO),
module_info_get_mm_tabling_info(ModuleInfo, TablingInfo),
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.foldl(write_pragma_mm_tabling_info(ModuleInfo, TablingInfo),
PredIds, !IO),
io.set_output_stream(OldStream, _, !IO),
Index: compiler/term_constr_initial.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_initial.m,v
retrieving revision 1.16
diff -u -b -r1.16 term_constr_initial.m
--- compiler/term_constr_initial.m 1 Dec 2006 15:04:23 -0000 1.16
+++ compiler/term_constr_initial.m 17 Jan 2007 07:08:06 -0000
@@ -106,7 +106,7 @@
% cases the constraints should that |HeadVar__1| = |HeadVar__2|.
preprocess_module(!ModuleInfo, !IO) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
process_builtin_preds(PredIds, !ModuleInfo, !IO),
process_imported_preds(PredIds, !ModuleInfo).
Index: compiler/term_constr_main.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/term_constr_main.m,v
retrieving revision 1.12
diff -u -b -r1.12 term_constr_main.m
--- compiler/term_constr_main.m 1 Dec 2006 15:04:23 -0000 1.12
+++ compiler/term_constr_main.m 17 Jan 2007 07:30:08 -0000
@@ -476,10 +476,12 @@
maybe_make_optimization_interface(ModuleInfo, !IO) :-
globals.io_lookup_bool_option(make_optimization_interface, MakeOptInt,
!IO),
- module_info_predids(ModuleInfo, PredIds),
- ( if MakeOptInt = yes
- then make_opt_int(PredIds, ModuleInfo, !IO)
- else true
+ (
+ MakeOptInt = yes,
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
+ make_opt_int(PredIds, ModuleInfo, !IO)
+ ;
+ MakeOptInt = no
).
:- pred make_opt_int(list(pred_id)::in, module_info::in, io::di, io::uo) is det.
@@ -582,11 +584,11 @@
HeadVars, !IO) :-
io.write_string(":- pragma termination2_info(", !IO),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
mercury_output_pred_mode_subdecl(varset.init, SymName,
ModeList, no, Context, !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ModeList, FuncModeList, RetMode),
mercury_output_func_mode_subdecl(varset.init, SymName,
FuncModeList, RetMode, no, Context, !IO)
Index: compiler/termination.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/termination.m,v
retrieving revision 1.72
diff -u -b -r1.72 termination.m
--- compiler/termination.m 6 Jan 2007 09:23:55 -0000 1.72
+++ compiler/termination.m 17 Jan 2007 07:08:06 -0000
@@ -99,7 +99,7 @@
% Process builtin and compiler-generated predicates, and user-supplied
% pragmas.
%
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
check_preds(PredIds, !ModuleInfo, !IO),
%
% Process all the SCCs of the call graph in a bottom-up order.
Index: compiler/trailing_analysis.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trailing_analysis.m,v
retrieving revision 1.24
diff -u -b -r1.24 trailing_analysis.m
--- compiler/trailing_analysis.m 6 Jan 2007 09:23:55 -0000 1.24
+++ compiler/trailing_analysis.m 17 Jan 2007 07:30:19 -0000
@@ -576,8 +576,10 @@
:- pred known_procedure(pred_or_func::in, string::in, string::in, int::in,
trailing_status::out) is semidet.
-known_procedure(predicate, "require", "error", 1, trail_will_not_modify).
-known_procedure(function, "require", "func_error", 1, trail_will_not_modify).
+known_procedure(pf_predicate, "require", "error", 1,
+ trail_will_not_modify).
+known_procedure(pf_function, "require", "func_error", 1,
+ trail_will_not_modify).
known_procedure(_, "exception", "throw", 1, trail_will_not_modify).
known_procedure(_, "exception", "rethrow", 1, trail_will_not_modify).
@@ -1018,7 +1020,7 @@
OptFileRes = ok(OptFile),
io.set_output_stream(OptFile, OldStream, !IO),
module_info_get_trailing_info(ModuleInfo, TrailingInfo),
- module_info_predids(ModuleInfo, PredIds),
+ module_info_predids(PredIds, ModuleInfo, _ModuleInfo),
list.foldl(write_pragma_trailing_info(ModuleInfo, TrailingInfo),
PredIds, !IO),
io.set_output_stream(OldStream, _, !IO),
Index: compiler/trans_opt.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.44
diff -u -b -r1.44 trans_opt.m
--- compiler/trans_opt.m 1 Dec 2006 15:04:25 -0000 1.44
+++ compiler/trans_opt.m 17 Jan 2007 15:58:37 -0000
@@ -67,14 +67,14 @@
% Open the file "<module-name>.trans_opt.tmp", and write out the
% declarations.
%
-:- pred write_optfile(module_info::in, io::di, io::uo) is det.
+:- pred write_trans_opt_file(module_info::in, io::di, io::uo) is det.
% grab_optfiles(ModuleList, !ModuleImports, Error, !IO):
%
% Add the items from each of the modules in ModuleList.trans_opt to
% the items in ModuleImports.
%
-:- pred grab_optfiles(list(module_name)::in,
+:- pred grab_trans_opt_files(list(module_name)::in,
module_imports::in, module_imports::out, bool::out, io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
@@ -110,7 +110,7 @@
%-----------------------------------------------------------------------------%
-write_optfile(Module, !IO) :-
+write_trans_opt_file(Module, !IO) :-
module_info_get_name(Module, ModuleName),
module_name_to_file_name(ModuleName, ".trans_opt.tmp", yes, TmpOptName,
!IO),
@@ -120,8 +120,7 @@
io.error_message(Error, Msg),
io.progname_base("trans_opt.m", ProgName, !IO),
io.write_string(ProgName, !IO),
- io.write_string(
- ": cannot open transitive optimisation file `", !IO),
+ io.write_string(": cannot open transitive optimisation file `", !IO),
io.write_string(TmpOptName, !IO),
io.write_string("' \n", !IO),
io.write_string(ProgName, !IO),
@@ -143,7 +142,7 @@
% Select all the predicates for which something should be writting
% into the .trans_opt file.
%
- module_info_predids(Module, PredIds),
+ module_info_predids(PredIds, Module, _Module),
module_info_get_structure_reuse_map(Module, ReuseMap),
map.values(ReuseMap, ReuseResults),
list.map(fst, ReuseResults, ReusePredProcIds),
@@ -192,7 +191,7 @@
% Read and process the transitive optimization interfaces.
%
-grab_optfiles(TransOptDeps, !Module, FoundError, !IO) :-
+grab_trans_opt_files(TransOptDeps, !Module, FoundError, !IO) :-
globals.io_lookup_bool_option(verbose, Verbose, !IO),
maybe_write_string(Verbose, "% Reading .trans_opt files..\n", !IO),
maybe_flush_output(Verbose, !IO),
@@ -227,7 +226,7 @@
maybe_write_string(VeryVerbose, " done.\n", !IO),
- intermod.update_error_status(trans_opt, FileName, ModuleError,
+ intermod.update_error_status(trans_opt_file, FileName, ModuleError,
Messages, !Error, !IO),
list.append(!.Items, NewItems, !:Items),
read_trans_opt_files(Imports, !Items, !Error, !IO).
Index: compiler/transform_llds.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/transform_llds.m,v
retrieving revision 1.31
diff -u -b -r1.31 transform_llds.m
--- compiler/transform_llds.m 6 Jan 2007 09:23:56 -0000 1.31
+++ compiler/transform_llds.m 17 Jan 2007 07:08:06 -0000
@@ -113,7 +113,7 @@
ProcId = hlds_pred.initial_proc_id,
PredId = hlds_pred.initial_pred_id,
PredName = "ACCURATE_GC_END_LABEL",
- ProcLabel = ordinary_proc_label(ModuleName, predicate, ModuleName,
+ ProcLabel = ordinary_proc_label(ModuleName, pf_predicate, ModuleName,
PredName, Arity, proc_id_to_int(ProcId)),
Instrs = [llds_instr(label(entry_label(entry_label_local, ProcLabel)),
"label to indicate end of previous procedure")],
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.86
diff -u -b -r1.86 type_ctor_info.m
--- compiler/type_ctor_info.m 5 Jan 2007 02:19:39 -0000 1.86
+++ compiler/type_ctor_info.m 17 Jan 2007 07:08:06 -0000
@@ -250,7 +250,7 @@
Compare = proc(ComparePredId, CompareProcId)
;
lookup_builtin_pred_proc_id(ModuleInfo, mercury_private_builtin_module,
- "unused", predicate, 0, only_mode, PredId, ProcId),
+ "unused", pf_predicate, 0, only_mode, PredId, ProcId),
Unused = proc(PredId, ProcId),
Unify = Unused,
Compare = Unused
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.418
diff -u -b -r1.418 typecheck.m
--- compiler/typecheck.m 6 Jan 2007 10:56:18 -0000 1.418
+++ compiler/typecheck.m 17 Jan 2007 07:08:06 -0000
@@ -148,13 +148,13 @@
%-----------------------------------------------------------------------------%
typecheck_module(!ModuleInfo, Specs, ExceededIterationLimit) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
module_info_get_globals(!.ModuleInfo, Globals),
globals.lookup_int_option(Globals, type_inference_iteration_limit,
MaxIterations),
typecheck_to_fixpoint(1, MaxIterations, PredIds, !ModuleInfo,
CheckSpecs, ExceededIterationLimit),
- construct_type_inference_messages(PredIds, !.ModuleInfo, [], InferSpecs),
+ construct_type_inference_messages(PredIds, !ModuleInfo, [], InferSpecs),
Specs = InferSpecs ++ CheckSpecs.
% Repeatedly typecheck the code for a group of predicates
@@ -180,7 +180,7 @@
globals.lookup_bool_option(Globals, debug_types, DebugTypes),
(
DebugTypes = yes,
- construct_type_inference_messages(PredIds, !.ModuleInfo,
+ construct_type_inference_messages(PredIds, !ModuleInfo,
[], ProgressSpecs),
trace [io(!IO)] (
write_error_specs(ProgressSpecs, Globals, 0, _, 0, _, !IO)
@@ -200,16 +200,17 @@
% Write out the inferred `pred' or `func' declarations for a list of
% predicates. Don't write out the inferred types for assertions.
%
-:- pred construct_type_inference_messages(list(pred_id)::in, module_info::in,
+:- pred construct_type_inference_messages(list(pred_id)::in,
+ module_info::in, module_info::out,
list(error_spec)::in, list(error_spec)::out) is det.
-construct_type_inference_messages([], _, !Specs).
-construct_type_inference_messages([PredId | PredIds], ModuleInfo, !Specs) :-
- module_info_pred_info(ModuleInfo, PredId, PredInfo),
+construct_type_inference_messages([], !ModuleInfo, !Specs).
+construct_type_inference_messages([PredId | PredIds], !ModuleInfo, !Specs) :-
+ module_info_pred_info(!.ModuleInfo, PredId, PredInfo),
pred_info_get_markers(PredInfo, Markers),
(
check_marker(Markers, marker_infer_type),
- module_info_predids(ModuleInfo, ValidPredIds),
+ module_info_predids(ValidPredIds, !ModuleInfo),
list.member(PredId, ValidPredIds),
\+ pred_info_get_goal_type(PredInfo, goal_type_promise(_))
->
@@ -218,7 +219,7 @@
;
true
),
- construct_type_inference_messages(PredIds, ModuleInfo, !Specs).
+ construct_type_inference_messages(PredIds, !ModuleInfo, !Specs).
% Construct a message containing the inferred `pred' or `func' declaration
% for a single predicate.
@@ -237,11 +238,11 @@
MaybeDet = no,
AppendVarNums = no,
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
TypeStr = mercury_pred_type_to_string(VarSet, ExistQVars, Name, Types,
MaybeDet, Purity, ClassContext, Context, AppendVarNums)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(Types, ArgTypes, RetType),
TypeStr = mercury_func_type_to_string(VarSet, ExistQVars, Name,
ArgTypes, RetType, MaybeDet, Purity, ClassContext, Context,
@@ -678,7 +679,7 @@
),
pred_info_context(!.PredInfo, Context),
generate_simple_call(mercury_private_builtin_module, CalleeName,
- predicate, only_mode, detism_det, purity_pure, [PredNameVar], [], [],
+ pf_predicate, only_mode, detism_det, purity_pure, [PredNameVar], [], [],
ModuleInfo, Context, CallGoal),
% Combine the unification and call into a conjunction.
@@ -889,7 +890,7 @@
FuncModule = pred_info_module(!.PredInfo),
FuncName = pred_info_name(!.PredInfo),
PredArity = pred_info_orig_arity(!.PredInfo),
- adjust_func_arity(function, FuncArity, PredArity),
+ adjust_func_arity(pf_function, FuncArity, PredArity),
FuncSymName = qualified(FuncModule, FuncName),
create_pure_atomic_complicated_unification(FuncRetVal,
rhs_functor(cons(FuncSymName, FuncArity), no, FuncArgs),
@@ -1344,7 +1345,7 @@
type_checkpoint("call", !.Info, !IO)
),
list.length(Args, Arity),
- CurCall = simple_call_id(predicate, Name, Arity),
+ CurCall = simple_call_id(pf_predicate, Name, Arity),
typecheck_info_set_called_predid(plain_call_id(CurCall), !Info),
goal_info_get_goal_path(GoalInfo, GoalPath),
typecheck_call_pred(CurCall, Args, GoalPath, PredId, !Info),
@@ -1488,7 +1489,7 @@
varset.new_vars(TypeVarSet0, Arity, ArgTypeVars, TypeVarSet),
% Argument types always have kind `star'.
prog_type.var_list_to_type_list(map.init, ArgTypeVars, ArgTypes),
- construct_higher_order_type(Purity, predicate, EvalMethod, ArgTypes,
+ construct_higher_order_type(Purity, pf_predicate, EvalMethod, ArgTypes,
PredType).
:- pred higher_order_func_type(purity::in, int::in, lambda_eval_method::in,
@@ -2479,7 +2480,7 @@
CompleteArgTypes),
pred_info_get_purity(PredInfo, Purity),
(
- IsPredOrFunc = predicate,
+ IsPredOrFunc = pf_predicate,
PredArity >= FuncArity,
% We don't support first-class polymorphism, so you can't take the
% address of an existentially quantified predicate.
@@ -2500,7 +2501,7 @@
unexpected(this_file, "make_pred_cons_info: split_list failed")
)
;
- IsPredOrFunc = function,
+ IsPredOrFunc = pf_function,
PredAsFuncArity = PredArity - 1,
PredAsFuncArity >= FuncArity,
% We don't support first-class polymorphism, so you can't take
Index: compiler/typecheck_errors.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck_errors.m,v
retrieving revision 1.36
diff -u -b -r1.36 typecheck_errors.m
--- compiler/typecheck_errors.m 27 Dec 2006 03:49:22 -0000 1.36
+++ compiler/typecheck_errors.m 17 Jan 2007 07:08:06 -0000
@@ -135,8 +135,8 @@
;
UndefMsg = report_error_undef_pred(Info, PredCallId),
(
- ( PredOrFunc0 = predicate, PredOrFunc = function
- ; PredOrFunc0 = function, PredOrFunc = predicate
+ ( PredOrFunc0 = pf_predicate, PredOrFunc = pf_function
+ ; PredOrFunc0 = pf_function, PredOrFunc = pf_predicate
),
predicate_table_search_pf_sym(PredicateTable,
calls_are_fully_qualified(Info ^ pred_markers),
@@ -179,13 +179,13 @@
report_error_func_instead_of_pred(Info, PredOrFunc) = Msg :-
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
Pieces = [words("(There is a"),
prefix("*"), p_or_f(PredOrFunc), suffix("*"),
words("with that name, however."), nl,
words("Perhaps you forgot to add"), fixed("` = ...'?)"), nl]
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Pieces = [words("(There is a"),
prefix("*"), p_or_f(PredOrFunc), suffix("*"),
words("with that name, however.)"), nl]
@@ -525,12 +525,12 @@
Pieces1 = [words("type error in unification of")] ++
argument_name_to_pieces(VarSet, Var) ++ [nl],
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
Pieces2 = [words("and"), prefix("pred("),
words(mercury_vars_to_string(VarSet, no, ArgVars)),
suffix(")"), words(":- ...':"), nl]
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgVars, FuncArgs, RetVar),
Pieces2 = [words("and"), prefix("func("),
words(mercury_vars_to_string(VarSet, no, FuncArgs)),
@@ -545,7 +545,7 @@
LambdaExprStr = "lambda expression has type",
Pieces4a = [words(LambdaExprStr), prefix("`")],
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
(
ArgVars = [],
Pieces4b = [words("pred")]
@@ -557,7 +557,7 @@
Pieces4b = [words("pred(_" ++ JoinedString ++ ")")]
)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
pred_args_to_func_args(ArgVars, FuncArgVars, _),
(
FuncArgVars = [],
@@ -1639,11 +1639,11 @@
error_num_args_to_pieces(MaybePredOrFunc, Arity0, Arities0) = Pieces :-
% Adjust arities for functions.
- ( MaybePredOrFunc = yes(function) ->
- adjust_func_arity(function, Arity, Arity0),
+ ( MaybePredOrFunc = yes(pf_function) ->
+ adjust_func_arity(pf_function, Arity, Arity0),
ReverseAdjust =
( pred(OtherArity0::in, OtherArity::out) is det :-
- adjust_func_arity(function, OtherArity, OtherArity0)
+ adjust_func_arity(pf_function, OtherArity, OtherArity0)
),
list.map(ReverseAdjust, Arities0, Arities)
;
Index: compiler/typecheck_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/typecheck_info.m,v
retrieving revision 1.21
diff -u -b -r1.21 typecheck_info.m
--- compiler/typecheck_info.m 19 Dec 2006 03:09:34 -0000 1.21
+++ compiler/typecheck_info.m 17 Jan 2007 07:08:06 -0000
@@ -377,7 +377,8 @@
typecheck_info_init(ModuleInfo, PredId, IsFieldAccessFunction,
TypeVarSet, VarSet, VarTypes, HeadTypeParams,
Constraints, Status, Markers, Errors, Info) :-
- CallPredId = plain_call_id(simple_call_id(predicate, unqualified(""), 0)),
+ CallPredId =
+ plain_call_id(simple_call_id(pf_predicate, unqualified(""), 0)),
term.context_init(Context),
map.init(TypeBindings),
map.init(Proofs),
Index: compiler/unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.178
diff -u -b -r1.178 unify_gen.m
--- compiler/unify_gen.m 15 Jan 2007 10:30:35 -0000 1.178
+++ compiler/unify_gen.m 18 Jan 2007 02:04:04 -0000
@@ -416,17 +416,15 @@
Var, Args, Modes, TakeAddr, MaybeSize, GoalInfo, Code, !CI)
;
ConsTag = unshared_tag(Ptag),
- code_info.get_module_info(!.CI, ModuleInfo),
var_types(!.CI, Args, ArgTypes),
- generate_cons_args(Args, ArgTypes, Modes, 0, 1, TakeAddr, ModuleInfo,
+ generate_cons_args(Args, ArgTypes, Modes, 0, 1, TakeAddr, !.CI,
MaybeRvals, FieldAddrs, MayUseAtomic),
construct_cell(Var, Ptag, MaybeRvals, MaybeSize, FieldAddrs,
MayUseAtomic, Code, !CI)
;
ConsTag = shared_remote_tag(Ptag, Sectag),
- code_info.get_module_info(!.CI, ModuleInfo),
var_types(!.CI, Args, ArgTypes),
- generate_cons_args(Args, ArgTypes, Modes, 1, 1, TakeAddr, ModuleInfo,
+ generate_cons_args(Args, ArgTypes, Modes, 1, 1, TakeAddr, !.CI,
MaybeRvals0, FieldAddrs, MayUseAtomic),
% The first field holds the secondary tag.
MaybeRvals = [yes(const(llconst_int(Sectag))) | MaybeRvals0],
@@ -700,7 +698,7 @@
yes(const(llconst_int(NumArgs)))
| PredArgs
],
- code_info.assign_cell_to_var(Var, no, 0, Vector, no, "closure",
+ code_info.assign_cell_to_var(Var, no, 0, Vector, no, [], "closure",
MayUseAtomic, Code, !CI)
).
@@ -747,16 +745,17 @@
!MayUseAtomic).
:- pred generate_cons_args(list(prog_var)::in, list(mer_type)::in,
- list(uni_mode)::in, int::in, int::in, list(int)::in, module_info::in,
+ list(uni_mode)::in, int::in, int::in, list(int)::in, code_info::in,
list(maybe(rval))::out, assoc_list(int, prog_var)::out,
may_use_atomic_alloc::out) is det.
generate_cons_args(Vars, Types, Modes, FirstOffset, FirstArgNum, TakeAddr,
- ModuleInfo, !:Args, !:FieldAddrs, !:MayUseAtomic) :-
+ CI, !:Args, !:FieldAddrs, !:MayUseAtomic) :-
+ code_info.get_module_info(CI, ModuleInfo),
!:MayUseAtomic = initial_may_use_atomic(ModuleInfo),
(
generate_cons_args_2(Vars, Types, Modes, FirstOffset, FirstArgNum,
- TakeAddr, ModuleInfo, !:Args, !:FieldAddrs, !MayUseAtomic)
+ TakeAddr, CI, !:Args, !:FieldAddrs, !MayUseAtomic)
->
true
;
@@ -769,20 +768,28 @@
% we just produce `no', meaning don't generate an assignment to that field.
%
:- pred generate_cons_args_2(list(prog_var)::in, list(mer_type)::in,
- list(uni_mode)::in, int::in, int::in, list(int)::in, module_info::in,
+ list(uni_mode)::in, int::in, int::in, list(int)::in, code_info::in,
list(maybe(rval))::out, assoc_list(int, prog_var)::out,
may_use_atomic_alloc::in, may_use_atomic_alloc::out) is semidet.
generate_cons_args_2([], [], [], _, _, [], _, [], [], !MayUseAtomic).
generate_cons_args_2([Var | Vars], [Type | Types], [UniMode | UniModes],
- FirstOffset, CurArgNum, !.TakeAddr, ModuleInfo, [Rval | Rvals],
+ FirstOffset, CurArgNum, !.TakeAddr, CI, [MaybeRval | MaybeRvals],
FieldAddrs, !MayUseAtomic) :-
+ code_info.get_module_info(CI, ModuleInfo),
update_type_may_use_atomic_alloc(ModuleInfo, Type, !MayUseAtomic),
( !.TakeAddr = [CurArgNum | !:TakeAddr] ->
- Rval = no,
+ code_info.get_lcmc_null(CI, LCMCNull),
+ (
+ LCMCNull = no,
+ MaybeRval = no
+ ;
+ LCMCNull = yes,
+ MaybeRval = yes(const(llconst_int(0)))
+ ),
!:MayUseAtomic = may_not_use_atomic_alloc,
generate_cons_args_2(Vars, Types, UniModes, FirstOffset, CurArgNum + 1,
- !.TakeAddr, ModuleInfo, Rvals, FieldAddrs1, !MayUseAtomic),
+ !.TakeAddr, CI, MaybeRvals, FieldAddrs1, !MayUseAtomic),
% Whereas CurArgNum starts numbering the arguments from 1, offsets
% into fields start from zero. However, if FirstOffset = 1, then the
% first word in the cell is the secondary tag.
@@ -793,15 +800,15 @@
mode_to_arg_mode(ModuleInfo, (RI -> RF), Type, ArgMode),
(
ArgMode = top_in,
- Rval = yes(var(Var))
+ MaybeRval = yes(var(Var))
;
( ArgMode = top_out
; ArgMode = top_unused
),
- Rval = no
+ MaybeRval = no
),
generate_cons_args_2(Vars, Types, UniModes, FirstOffset, CurArgNum + 1,
- !.TakeAddr, ModuleInfo, Rvals, FieldAddrs, !MayUseAtomic)
+ !.TakeAddr, CI, MaybeRvals, FieldAddrs, !MayUseAtomic)
).
:- func initial_may_use_atomic(module_info) = may_use_atomic_alloc.
@@ -842,8 +849,9 @@
;
ReserveWordAtStart = no
),
+ FieldNums = list.map(fst, FieldAddrs),
code_info.assign_cell_to_var(Var, ReserveWordAtStart, Ptag, MaybeRvals,
- MaybeSize, VarTypeMsg, MayUseAtomic, CellCode, !CI),
+ MaybeSize, FieldNums, VarTypeMsg, MayUseAtomic, CellCode, !CI),
(
FieldAddrs = [],
% Optimize common case.
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.183
diff -u -b -r1.183 unify_proc.m
--- compiler/unify_proc.m 6 Jan 2007 09:23:57 -0000 1.183
+++ compiler/unify_proc.m 17 Jan 2007 07:08:06 -0000
@@ -389,7 +389,7 @@
% XXX inefficient! This is O(N*M).
%
PredProcId = proc(PredId, _ProcId),
- module_info_predids(!.ModuleInfo, ValidPredIds),
+ module_info_predids(ValidPredIds, !ModuleInfo),
( list.member(PredId, ValidPredIds) ->
queued_proc_progress_message(PredProcId, HowToCheckGoal,
!.ModuleInfo, !IO),
@@ -672,7 +672,7 @@
info_extract(!.Info, VarSet, Types)
),
map.init(TVarNameMap),
- ArgVec = proc_arg_vector_init(predicate, Args),
+ ArgVec = proc_arg_vector_init(pf_predicate, Args),
set_clause_list(Clauses, ClausesRep),
rtti_varmaps_init(RttiVarMaps),
HasForeignClauses = yes,
@@ -1857,9 +1857,9 @@
;
MercuryBuiltin = mercury_private_builtin_module
),
- goal_util.generate_simple_call(MercuryBuiltin, Name, predicate, mode_no(0),
- detism_erroneous, purity_pure, ArgVars, [], [], ModuleInfo, Context,
- Goal).
+ goal_util.generate_simple_call(MercuryBuiltin, Name, pf_predicate,
+ mode_no(0), detism_erroneous, purity_pure, ArgVars, [], [],
+ ModuleInfo, Context, Goal).
:- pred build_specific_call(mer_type::in, special_pred_id::in,
list(prog_var)::in, instmap_delta::in, determinism::in,
Index: compiler/untupling.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/untupling.m,v
retrieving revision 1.25
diff -u -b -r1.25 untupling.m
--- compiler/untupling.m 6 Jan 2007 09:23:58 -0000 1.25
+++ compiler/untupling.m 17 Jan 2007 07:08:06 -0000
@@ -163,7 +163,7 @@
transform_map::out) is det.
expand_args_in_module(!ModuleInfo, TransformMap) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl3(expand_args_in_pred, PredIds,
!ModuleInfo, map.init, TransformMap, counter.init(0), _).
@@ -460,7 +460,7 @@
module_info::out) is det.
fix_calls_to_expanded_procs(TransformMap, !ModuleInfo) :-
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
list.foldl(fix_calls_in_pred(TransformMap), PredIds, !ModuleInfo).
:- pred fix_calls_in_pred(transform_map::in, pred_id::in, module_info::in,
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.141
diff -u -b -r1.141 unused_args.m
--- compiler/unused_args.m 6 Jan 2007 09:23:58 -0000 1.141
+++ compiler/unused_args.m 17 Jan 2007 07:08:06 -0000
@@ -319,7 +319,7 @@
init_var_usage(VarUsage, PredProcList, ProcCallInfo, !ModuleInfo, !IO) :-
map.init(ProcCallInfo0),
map.init(VarUsage0),
- module_info_predids(!.ModuleInfo, PredIds),
+ module_info_predids(PredIds, !ModuleInfo),
setup_local_var_usage(PredIds, VarUsage0, VarUsage, [], PredProcList,
ProcCallInfo0, ProcCallInfo, !ModuleInfo, !IO).
Index: compiler/var_locn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/var_locn.m,v
retrieving revision 1.49
diff -u -b -r1.49 var_locn.m
--- compiler/var_locn.m 15 Jan 2007 10:30:36 -0000 1.49
+++ compiler/var_locn.m 18 Jan 2007 02:01:51 -0000
@@ -167,24 +167,24 @@
var_locn_info::in, var_locn_info::out) is det.
% var_locn_assign_cell_to_var(ModuleInfo, Var, ReserveWordAtStart, Ptag,
- % Vector, SizeInfo, TypeMsg, MayUseAtomic, Code, !StaticCellInfo,
- % !VarLocnInfo):
+ % MaybeRvals, MaybeSize, FieldAddrs, TypeMsg, MayUseAtomic, Code,
+ % !StaticCellInfo, !VarLocnInfo):
%
% Generates code to assign to Var a pointer, tagged by Ptag, to the cell
% whose contents are given by the other arguments, and updates the state
% of !VarLocnInfo accordingly. If ReserveWordAtStart is yes, and the cell
% is allocated on the heap (rather than statically), then reserve an extra
% word immediately before the allocated object, for the garbage collector
- % to use to hold a forwarding pointer. If SizeInfo is yes(SizeVal), then
+ % to use to hold a forwarding pointer. If MaybeSize is yes(SizeVal), then
% reserve an extra word immediately before the allocated object (regardless
% of whether it is allocated statically or dynamically), and initialize
% this word with the value determined by SizeVal. (NOTE: ReserveWordAtStart
- % and SizeInfo should not be yes / yes(_), because that will cause an
+ % and MaybeSize should not be yes / yes(_), because that will cause an
% obvious conflict.)
%
:- pred var_locn_assign_cell_to_var(module_info::in, prog_var::in, bool::in,
- tag::in, list(maybe(rval))::in, maybe(term_size_value)::in, string::in,
- may_use_atomic_alloc::in, code_tree::out,
+ tag::in, list(maybe(rval))::in, maybe(term_size_value)::in, list(int)::in,
+ string::in, may_use_atomic_alloc::in, code_tree::out,
static_cell_info::in, static_cell_info::out,
var_locn_info::in, var_locn_info::out) is det.
@@ -818,10 +818,10 @@
%----------------------------------------------------------------------------%
var_locn_assign_cell_to_var(ModuleInfo, Var, ReserveWordAtStart, Ptag,
- MaybeRvals0, SizeInfo, TypeMsg, MayUseAtomic, Code, !StaticCellInfo,
- !VLI) :-
+ MaybeRvals0, MaybeSize, FieldAddrs, TypeMsg, MayUseAtomic, Code,
+ !StaticCellInfo, !VLI) :-
(
- SizeInfo = yes(SizeSource),
+ MaybeSize = yes(SizeSource),
(
SizeSource = known_size(Size),
SizeRval = const(llconst_int(Size))
@@ -832,13 +832,18 @@
MaybeRvals = [yes(SizeRval) | MaybeRvals0],
MaybeOffset = yes(1)
;
- SizeInfo = no,
+ MaybeSize = no,
MaybeRvals = MaybeRvals0,
MaybeOffset = no
),
var_locn_get_var_state_map(!.VLI, VarStateMap),
var_locn_get_exprn_opts(!.VLI, ExprnOpts),
- ( cell_is_constant(VarStateMap, ExprnOpts, MaybeRvals, RvalsTypes) ->
+ % We can make the cell a constant only if all its fields are filled in,
+ % and they are all constants.
+ (
+ FieldAddrs = [],
+ cell_is_constant(VarStateMap, ExprnOpts, MaybeRvals, RvalsTypes)
+ ->
add_scalar_static_cell(RvalsTypes, DataAddr, !StaticCellInfo),
CellPtrConst = const(llconst_data_addr(DataAddr, MaybeOffset)),
CellPtrRval = mkword(Ptag, CellPtrConst),
Index: compiler/xml_documentation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/xml_documentation.m,v
retrieving revision 1.11
diff -u -b -r1.11 xml_documentation.m
--- compiler/xml_documentation.m 11 Dec 2006 03:02:24 -0000 1.11
+++ compiler/xml_documentation.m 17 Jan 2007 07:08:06 -0000
@@ -461,10 +461,10 @@
pred_info_get_class_context(PredInfo, Constraints),
pred_info_context(PredInfo, Context),
(
- IsPredOrFunc = predicate,
+ IsPredOrFunc = pf_predicate,
Tag = "predicate"
;
- IsPredOrFunc = function,
+ IsPredOrFunc = pf_function,
Tag = "function"
),
Id = sym_name_and_arity_to_id(Tag, PredName, Arity),
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
Index: doc/user_guide.texi
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/doc/user_guide.texi,v
retrieving revision 1.508
diff -u -b -r1.508 user_guide.texi
--- doc/user_guide.texi 19 Jan 2007 04:42:41 -0000 1.508
+++ doc/user_guide.texi 19 Jan 2007 04:51:24 -0000
@@ -6142,12 +6142,14 @@
@findex --debug-opt-pred-id
Output detailed debugging traces of the optimization process
only for the predicate/function with the specified pred id.
+May be given more than once.
@sp 1
@item --debug-opt-pred-name @var{name}
@findex --debug-opt-pred-name
Output detailed debugging traces of the optimization process
only for the predicate/function with the specified name.
+May be given more than once.
@sp 1
@item --debug-pd
@@ -6518,6 +6520,7 @@
t - results of termination analysis,
u - unification categories and other implementation details of unifications,
v - variable numbers in variable names,
+z - purity annotations on impure and semipure goals
A - argument passing information,
B - mode constraint information,
C - clause information,
@@ -6534,6 +6537,7 @@
@findex --dump-hlds-pred-id
With @samp{--dump-hlds}, restrict the output
to the HLDS of the predicate or function with the specified pred id.
+May be given more than once.
@sp 1
@item --dump-mlds @var{stage}
@@ -7816,6 +7820,13 @@
Enable the optimization of ``last'' calls that are followed by
constructor application.
+ at c @sp 1
+ at c @item --optimize-constructor-last-call-null
+ at c @findex --optimize-constructor-last-call-null
+ at c When --optimize-constructor-last-call is enabled,
+ at c put NULL in uninitialized fields (to prevent the garbage collector
+ at c from looking at and following a random bit pattern).
+
@sp 1
@item --optimize-dead-procs
@findex --optimize-dead-procs
cvs diff: Diffing extras
cvs diff: Diffing extras/base64
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/fixed
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/log4m
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/mopenssl
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/net
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/stream/tests
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/sparse_bitset.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/sparse_bitset.m,v
retrieving revision 1.34
diff -u -b -r1.34 sparse_bitset.m
--- library/sparse_bitset.m 27 Dec 2006 03:59:27 -0000 1.34
+++ library/sparse_bitset.m 5 Jan 2007 12:42:04 -0000
@@ -850,11 +850,11 @@
:- func insert_bitset_elem(bitset_elem, bitset_impl) = bitset_impl.
insert_bitset_elem(Data, []) = [Data].
-insert_bitset_elem(Data0, [Data1 | Rest]) = List :-
- ( Data0 ^ offset < Data1 ^ offset ->
- List = [Data0, Data1 | Rest]
+insert_bitset_elem(Data, [Head | Tail]) = List :-
+ ( Data ^ offset < Head ^ offset ->
+ List = [Data, Head | Tail]
;
- List = [Data1 | insert_bitset_elem(Data0, Rest)]
+ List = [Head | insert_bitset_elem(Data, Tail)]
).
%-----------------------------------------------------------------------------%
cvs diff: Diffing mdbcomp
Index: mdbcomp/prim_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/prim_data.m,v
retrieving revision 1.18
diff -u -b -r1.18 prim_data.m
--- mdbcomp/prim_data.m 3 Jan 2007 07:20:46 -0000 1.18
+++ mdbcomp/prim_data.m 17 Jan 2007 06:02:43 -0000
@@ -22,8 +22,8 @@
% in runtime/mercury_stack_layout.h, and in the same order, since the
% code (in browser) assumes the representation is the same.
:- type pred_or_func
- ---> predicate
- ; function.
+ ---> pf_predicate
+ ; pf_function.
% The kinds of events with which MR_trace may be called, either
% by compiler-generated code, or by code in the standard library
Index: mdbcomp/slice_and_dice.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/slice_and_dice.m,v
retrieving revision 1.13
diff -u -b -r1.13 slice_and_dice.m
--- mdbcomp/slice_and_dice.m 6 Jan 2007 10:56:24 -0000 1.13
+++ mdbcomp/slice_and_dice.m 17 Jan 2007 06:03:05 -0000
@@ -883,11 +883,11 @@
ModeNo),
Module = sym_name_to_string(SymModule),
(
- PredOrFunc = function,
+ PredOrFunc = pf_function,
ArityStr = int_to_string(Arity - 1),
PredOrFuncStr = "func"
;
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
ArityStr = int_to_string(Arity),
PredOrFuncStr = "pred"
),
Index: mdbcomp/trace_counts.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/mdbcomp/trace_counts.m,v
retrieving revision 1.19
diff -u -b -r1.19 trace_counts.m
--- mdbcomp/trace_counts.m 6 Jan 2007 10:56:24 -0000 1.19
+++ mdbcomp/trace_counts.m 17 Jan 2007 06:03:38 -0000
@@ -548,7 +548,7 @@
token_cons(integer(Arity), _,
token_cons(integer(Mode), _,
token_nil))),
- ProcLabel = ordinary_proc_label(CurModuleNameSym, predicate,
+ ProcLabel = ordinary_proc_label(CurModuleNameSym, pf_predicate,
CurModuleNameSym, Name, Arity, Mode)
;
TokenName = "fproc",
@@ -557,7 +557,7 @@
token_cons(integer(Arity), _,
token_cons(integer(Mode), _,
token_nil))),
- ProcLabel = ordinary_proc_label(CurModuleNameSym, function,
+ ProcLabel = ordinary_proc_label(CurModuleNameSym, pf_function,
CurModuleNameSym, Name, Arity, Mode)
;
TokenName = "pprocdecl",
@@ -568,7 +568,7 @@
token_cons(integer(Mode), _,
token_nil)))),
DeclModuleNameSym = string_to_sym_name(DeclModuleName),
- ProcLabel = ordinary_proc_label(CurModuleNameSym, predicate,
+ ProcLabel = ordinary_proc_label(CurModuleNameSym, pf_predicate,
DeclModuleNameSym, Name, Arity, Mode)
;
TokenName = "fprocdecl",
@@ -579,7 +579,7 @@
token_cons(integer(Mode), _,
token_nil)))),
DeclModuleNameSym = string_to_sym_name(DeclModuleName),
- ProcLabel = ordinary_proc_label(CurModuleNameSym, function,
+ ProcLabel = ordinary_proc_label(CurModuleNameSym, pf_function,
DeclModuleNameSym, Name, Arity, Mode)
)
->
@@ -854,7 +854,7 @@
ProcLabel = ordinary_proc_label(DefModuleSym, PredOrFunc,
DeclModuleSym, Name, Arity, Mode),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
( DeclModuleSym = DefModuleSym ->
io.write_string("pproc ", !IO)
;
@@ -864,7 +864,7 @@
io.write_string(" ", !IO)
)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
( DeclModuleSym = DefModuleSym ->
io.write_string("fproc ", !IO)
;
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 slice
Index: slice/mcov.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/slice/mcov.m,v
retrieving revision 1.4
diff -u -b -r1.4 mcov.m
--- slice/mcov.m 6 Jan 2007 10:56:25 -0000 1.4
+++ slice/mcov.m 17 Jan 2007 12:32:11 -0000
@@ -315,10 +315,10 @@
ProcLabel = ordinary_proc_label(_DefModuleSym, PredOrFunc,
_DeclModuleSym, Name, Arity, Mode),
(
- PredOrFunc = predicate,
+ PredOrFunc = pf_predicate,
io.write_string("pred ", !IO)
;
- PredOrFunc = function,
+ PredOrFunc = pf_function,
io.write_string("func ", !IO)
),
term_io.quote_atom(Name, !IO),
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