[m-rev.] diff: fix a bug reported by Samrith
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue Jan 31 16:01:55 AEDT 2006
Fix a bug reported by Samrith, which is that some of the files in
benchmarks/progs/icfp2000, e.g. eval.m, got a compiler abort when compiled
with -O0 --optimize-repeat=0 --optimize-saved-vars. This was because
--optimize-saved-vars relied on jump optimization being done, but
--optimize-repeat=0 disables jump optimization.
compiler/handle_options.m:
Make --optimize-repeat at least one if some other optimization
requires the optimizations controlled by --optimize-repeat.
compiler/optimize.m:
compiler/use_local_vars.m:
Rename some predicates to make their unqualified names more meaningful.
Delete unnecessary module qualifications. Switch to using . instead of
__ as module qualifier.
compiler/mercury_compile.m:
Conform to the change to optimize.m.
compiler/modules.m:
Rename a predicate to avoid a confusing overloading.
compiler/compile_target_code.m:
Conform to the change to modules.m.
tests/valid/eval.m:
New test case to check the fix.
tests/valid/Mmakefile:
Enable the new test case.
Zoltan.
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/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.78
diff -u -b -r1.78 compile_target_code.m
--- compiler/compile_target_code.m 5 Dec 2005 02:17:20 -0000 1.78
+++ compiler/compile_target_code.m 30 Jan 2006 04:08:02 -0000
@@ -865,7 +865,7 @@
io__close_output(InitFileStream, !IO),
module_name_to_file_name(MainModuleName, ".init", yes, InitFileName,
!IO),
- update_interface(InitFileName, Succeeded1, !IO),
+ update_interface_return_succeeded(InitFileName, Succeeded1, !IO),
Succeeded = Succeeded0 `and` Succeeded1
;
InitFileRes = error(Error),
@@ -1071,7 +1071,7 @@
maybe_report_stats(Stats, !IO),
(
MkInitOK0 = yes,
- update_interface(InitCFileName, MkInitOK1, !IO),
+ update_interface_return_succeeded(InitCFileName, MkInitOK1, !IO),
(
MkInitOK1 = yes,
(
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.250
diff -u -b -r1.250 handle_options.m
--- compiler/handle_options.m 27 Jan 2006 05:52:04 -0000 1.250
+++ compiler/handle_options.m 30 Jan 2006 03:57:22 -0000
@@ -1707,7 +1707,25 @@
option_implies(optimize_frames, optimize_jumps, bool(yes), !Globals),
% --optimize-proc-dups is implemented only with --trad-passes.
- option_implies(optimize_proc_dups, trad_passes, bool(yes), !Globals).
+ option_implies(optimize_proc_dups, trad_passes, bool(yes), !Globals),
+
+ globals.lookup_bool_option(!.Globals, optimize_frames, OptFrames),
+ globals.lookup_bool_option(!.Globals, use_local_vars, OptLocalVars),
+ globals.lookup_int_option(!.Globals, optimize_repeat, OptRepeat),
+ (
+ ( OptFrames = yes
+ ; OptLocalVars = yes
+ ),
+ OptRepeat < 1
+ ->
+ % The frame optimization and the local vars optimization depend on
+ % the jump and label optimization having been done. They are turned
+ % on above, but they still won't be executed unless optimize_repeat
+ % is at least one.
+ globals__set_option(optimize_repeat, int(1), !Globals)
+ ;
+ true
+ ).
% option_implies(SourceBoolOption, ImpliedOption, ImpliedOptionValue):
% If the SourceBoolOption is set to yes, then the ImpliedOption is set
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.372
diff -u -b -r1.372 mercury_compile.m
--- compiler/mercury_compile.m 25 Jan 2006 03:27:35 -0000 1.372
+++ compiler/mercury_compile.m 30 Jan 2006 03:57:03 -0000
@@ -2735,7 +2735,7 @@
globals__lookup_bool_option(Globals, optimize, Optimize),
(
Optimize = yes,
- optimize__proc(!.GlobalData, ProcCode0, ProcCode, !IO)
+ optimize_proc(!.GlobalData, ProcCode0, ProcCode, !IO)
;
Optimize = no,
ProcCode = ProcCode0
@@ -4041,7 +4041,7 @@
Optimize = yes,
maybe_write_string(Verbose, "% Doing optimizations...\n", !IO),
maybe_flush_output(Verbose, !IO),
- optimize_main(GlobalData, !LLDS, !IO),
+ optimize_procs(GlobalData, !LLDS, !IO),
maybe_write_string(Verbose, "% done.\n", !IO),
maybe_report_stats(Stats, !IO)
;
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.369
diff -u -b -r1.369 modules.m
--- compiler/modules.m 25 Jan 2006 03:27:36 -0000 1.369
+++ compiler/modules.m 30 Jan 2006 04:13:00 -0000
@@ -692,12 +692,13 @@
%
:- pred touch_datestamp(file_name::in, io::di, io::uo) is det.
- % update_interface(FileName, Succeeded):
+ % update_interface_return_succeeded(FileName, Succeeded):
%
% Call the shell script mercury_update_interface to update the
% interface file FileName if it has changed.
%
-:- pred update_interface(file_name::in, bool::out, io::di, io::uo) is det.
+:- pred update_interface_return_succeeded(file_name::in, bool::out,
+ io::di, io::uo) is det.
:- pred update_interface(file_name::in, io::di, io::uo) is det.
@@ -2242,7 +2243,7 @@
% update <Module>.int from <Module>.int.tmp if necessary
update_interface(OutputFileName, !IO) :-
- update_interface(OutputFileName, Succeeded, !IO),
+ update_interface_return_succeeded(OutputFileName, Succeeded, !IO),
(
Succeeded = no,
report_error("problem updating interface files.", !IO)
@@ -2250,7 +2251,7 @@
Succeeded = yes
).
-update_interface(OutputFileName, Succeeded, !IO) :-
+update_interface_return_succeeded(OutputFileName, Succeeded, !IO) :-
globals__io_lookup_bool_option(verbose, Verbose, !IO),
maybe_write_string(Verbose, "% Updating interface:\n", !IO),
TmpOutputFileName = OutputFileName ++ ".tmp",
Index: compiler/optimize.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/optimize.m,v
retrieving revision 1.52
diff -u -b -r1.52 optimize.m
--- compiler/optimize.m 17 Nov 2005 15:57:26 -0000 1.52
+++ compiler/optimize.m 30 Jan 2006 02:51:15 -0000
@@ -13,7 +13,7 @@
%-----------------------------------------------------------------------------%
-:- module ll_backend__optimize.
+:- module ll_backend.optimize.
:- interface.
:- import_module ll_backend.global_data.
@@ -24,10 +24,10 @@
%-----------------------------------------------------------------------------%
-:- pred optimize_main(global_data::in,
+:- pred optimize_procs(global_data::in,
list(c_procedure)::in, list(c_procedure)::out, io::di, io::uo) is det.
-:- pred optimize__proc(global_data::in, c_procedure::in, c_procedure::out,
+:- pred optimize_proc(global_data::in, c_procedure::in, c_procedure::out,
io::di, io::uo) is det.
%-----------------------------------------------------------------------------%
@@ -71,35 +71,35 @@
%-----------------------------------------------------------------------------%
-optimize_main(GlobalData, !Procs, !IO) :-
- list__map_foldl(optimize__proc(GlobalData), !Procs, !IO).
+optimize_procs(GlobalData, !Procs, !IO) :-
+ list.map_foldl(optimize_proc(GlobalData), !Procs, !IO).
-optimize__proc(GlobalData, CProc0, CProc, !IO) :-
+optimize_proc(GlobalData, CProc0, CProc, !IO) :-
some [!OptDebugInfo, !C, !Instrs] (
CProc0 = c_procedure(Name, Arity, PredProcId, !:Instrs,
ProcLabel, !:C, MayAlterRtti),
- optimize__init_opt_debug_info(Name, Arity, PredProcId, ProcLabel,
+ init_opt_debug_info(Name, Arity, PredProcId, ProcLabel,
!.Instrs, !.C, !:OptDebugInfo, !IO),
- globals__io_lookup_int_option(optimize_repeat, Repeat, !IO),
+ globals.io_lookup_int_option(optimize_repeat, Repeat, !IO),
(
global_data_maybe_get_proc_layout(GlobalData,
PredProcId, ProcLayout)
->
LabelMap = ProcLayout ^ internal_map,
- map__sorted_keys(LabelMap, LayoutLabelNums),
- LayoutLabels = list__map(make_internal_label(ProcLabel),
+ map.sorted_keys(LabelMap, LayoutLabelNums),
+ LayoutLabels = list.map(make_internal_label(ProcLabel),
LayoutLabelNums),
- set__sorted_list_to_set(LayoutLabels, LayoutLabelSet)
+ set.sorted_list_to_set(LayoutLabels, LayoutLabelSet)
;
- set__init(LayoutLabelSet)
+ set.init(LayoutLabelSet)
),
- optimize__initial(LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
+ optimize_initial(LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
!OptDebugInfo, !Instrs, !IO),
- optimize__repeat(Repeat, LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
+ optimize_repeat(Repeat, LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
!OptDebugInfo, !Instrs, !IO),
- optimize__middle(yes, LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
+ optimize_middle(yes, LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
!OptDebugInfo, !Instrs, !IO),
- optimize__last(LayoutLabelSet, ProcLabel, !.C, !.OptDebugInfo, !Instrs,
+ optimize_last(LayoutLabelSet, ProcLabel, !.C, !.OptDebugInfo, !Instrs,
!IO),
CProc = c_procedure(Name, Arity, PredProcId, !.Instrs, ProcLabel,
!.C, MayAlterRtti)
@@ -123,14 +123,14 @@
)
; no_opt_debug_info.
-:- pred optimize__init_opt_debug_info(string::in, int::in, pred_proc_id::in,
+:- pred init_opt_debug_info(string::in, int::in, pred_proc_id::in,
proc_label::in, list(instruction)::in, counter::in, opt_debug_info::out,
io::di, io::uo) is det.
-optimize__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),
+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),
PredProcId = proc(PredId, ProcId),
pred_id_to_int(PredId, PredIdInt),
proc_id_to_int(ProcId, ProcIdInt),
@@ -144,21 +144,21 @@
++ ".proc" ++ int_to_string(ProcIdInt),
OptDebugInfo = opt_debug_info(BaseName, 0, 0, Instrs0),
- io__call_system("mkdir -p " ++ opt_subdir_name, MkdirRes, !IO),
+ io.call_system("mkdir -p " ++ opt_subdir_name, MkdirRes, !IO),
( MkdirRes = ok(0) ->
true
;
unexpected(this_file, "cannot make " ++ opt_subdir_name)
),
FileName = BaseName ++ ".opt0",
- io__open_output(FileName, Res, !IO),
+ io.open_output(FileName, Res, !IO),
( Res = ok(FileStream) ->
- io__set_output_stream(FileStream, OutputStream, !IO),
- counter__allocate(NextLabel, Counter, _),
- opt_debug__msg(yes, NextLabel, "before optimization", !IO),
- opt_debug__maybe_dump_instrs(yes, ProcLabel, Instrs0, !IO),
- io__set_output_stream(OutputStream, _, !IO),
- io__close_output(FileStream, !IO)
+ io.set_output_stream(FileStream, OutputStream, !IO),
+ counter.allocate(NextLabel, Counter, _),
+ opt_debug.msg(yes, NextLabel, "before optimization", !IO),
+ opt_debug.maybe_dump_instrs(yes, ProcLabel, Instrs0, !IO),
+ io.set_output_stream(OutputStream, _, !IO),
+ io.close_output(FileStream, !IO)
;
unexpected(this_file, "cannot open " ++ FileName)
)
@@ -170,12 +170,11 @@
opt_subdir_name = "OptSubdir".
-:- pred optimize__maybe_opt_debug(list(instruction)::in, counter::in,
- string::in, proc_label::in, opt_debug_info::in, opt_debug_info::out,
- io::di, io::uo) is det.
+:- pred maybe_opt_debug(list(instruction)::in, counter::in, string::in,
+ proc_label::in, opt_debug_info::in, opt_debug_info::out, io::di, io::uo)
+ is det.
-optimize__maybe_opt_debug(Instrs, Counter, Msg, ProcLabel, !OptDebugInfo,
- !IO) :-
+maybe_opt_debug(Instrs, Counter, Msg, ProcLabel, !OptDebugInfo, !IO) :-
(
!.OptDebugInfo = opt_debug_info(BaseName, OptNum0, PrevNum,
PrevInstrs),
@@ -185,25 +184,25 @@
Same = no
),
OptNum = OptNum0 + 1,
- string__int_to_string(PrevNum, PrevNumStr),
- string__int_to_string(OptNum, OptNumStr),
+ string.int_to_string(PrevNum, PrevNumStr),
+ string.int_to_string(OptNum, OptNumStr),
PrevFileName = BaseName ++ ".opt" ++ PrevNumStr,
OptFileName = BaseName ++ ".opt" ++ OptNumStr,
DiffFileName = BaseName ++ ".diff" ++ OptNumStr,
- io__open_output(OptFileName, Res, !IO),
+ io.open_output(OptFileName, Res, !IO),
( Res = ok(FileStream) ->
- io__set_output_stream(FileStream, OutputStream, !IO),
- counter__allocate(NextLabel, Counter, _),
- opt_debug__msg(yes, NextLabel, Msg, !IO),
+ io.set_output_stream(FileStream, OutputStream, !IO),
+ counter.allocate(NextLabel, Counter, _),
+ opt_debug.msg(yes, NextLabel, Msg, !IO),
(
Same = yes,
- io__write_string("same as previous version\n", !IO)
+ io.write_string("same as previous version\n", !IO)
;
Same = no,
- opt_debug__maybe_dump_instrs(yes, ProcLabel, Instrs, !IO)
+ opt_debug.maybe_dump_instrs(yes, ProcLabel, Instrs, !IO)
),
- io__set_output_stream(OutputStream, _, !IO),
- io__close_output(FileStream, !IO)
+ io.set_output_stream(OutputStream, _, !IO),
+ io.close_output(FileStream, !IO)
;
ErrorMsg = "cannot open " ++ OptFileName,
unexpected(this_file, ErrorMsg)
@@ -218,7 +217,7 @@
% of --debug-opt (zs) strongly prefers -u to -c.
DiffCommand = "diff -u '" ++ PrevFileName ++ "' '" ++ OptFileName
++ "' > '" ++ DiffFileName ++ "'",
- io__call_system(DiffCommand, _, !IO),
+ io.call_system(DiffCommand, _, !IO),
!:OptDebugInfo = opt_debug_info(BaseName, OptNum, OptNum, Instrs)
)
;
@@ -227,29 +226,29 @@
%-----------------------------------------------------------------------------%
-:- pred optimize__initial(set(label)::in, proc_label::in, may_alter_rtti::in,
+:- pred optimize_initial(set(label)::in, proc_label::in, may_alter_rtti::in,
counter::in, counter::out, opt_debug_info::in, opt_debug_info::out,
list(instruction)::in, list(instruction)::out, io::di, io::uo) is det.
-optimize__initial(LayoutLabelSet, ProcLabel, MayAlterRtti, !C, !OptDebugInfo,
+optimize_initial(LayoutLabelSet, ProcLabel, MayAlterRtti, !C, !OptDebugInfo,
!Instrs, !IO) :-
- globals__io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
- LabelStr = opt_util__format_proc_label(ProcLabel),
+ globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+ LabelStr = opt_util.format_proc_label(ProcLabel),
- globals__io_lookup_bool_option(optimize_frames, FrameOpt, !IO),
+ globals.io_lookup_bool_option(optimize_frames, FrameOpt, !IO),
(
FrameOpt = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing nondet frames for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing nondet frames for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
frameopt_nondet(ProcLabel, LayoutLabelSet, MayAlterRtti, !C, !Instrs,
_Mod),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after nondet frame opt",
+ maybe_opt_debug(!.Instrs, !.C, "after nondet frame opt",
ProcLabel, !OptDebugInfo, !IO)
;
FrameOpt = no
@@ -257,12 +256,12 @@
%-----------------------------------------------------------------------------%
-:- pred optimize__repeat(int::in, set(label)::in, proc_label::in,
+:- pred optimize_repeat(int::in, set(label)::in, proc_label::in,
may_alter_rtti::in, counter::in, counter::out,
opt_debug_info::in, opt_debug_info::out,
list(instruction)::in, list(instruction)::out, io::di, io::uo) is det.
-optimize__repeat(CurIter, LayoutLabelSet, ProcLabel, MayAlterRtti,
+optimize_repeat(CurIter, LayoutLabelSet, ProcLabel, MayAlterRtti,
!C, !OptDebugInfo, !Instrs, !IO) :-
( CurIter > 0 ->
NextIter = CurIter - 1,
@@ -271,11 +270,11 @@
;
Final = no
),
- optimize__repeated(Final, LayoutLabelSet, ProcLabel, MayAlterRtti,
+ optimize_repeated(Final, LayoutLabelSet, ProcLabel, MayAlterRtti,
!C, !OptDebugInfo, !Instrs, Mod, !IO),
(
Mod = yes,
- optimize__repeat(NextIter, LayoutLabelSet, ProcLabel, MayAlterRtti,
+ optimize_repeat(NextIter, LayoutLabelSet, ProcLabel, MayAlterRtti,
!C, !OptDebugInfo, !Instrs, !IO)
;
Mod = no
@@ -287,92 +286,92 @@
% We short-circuit jump sequences before normal peepholing
% to create more opportunities for use of the tailcall macro.
%
-:- pred optimize__repeated(bool::in, set(label)::in, proc_label::in,
+:- pred optimize_repeated(bool::in, set(label)::in, proc_label::in,
may_alter_rtti::in, counter::in, counter::out,
opt_debug_info::in, opt_debug_info::out,
list(instruction)::in, list(instruction)::out, bool::out,
io::di, io::uo) is det.
-optimize__repeated(Final, LayoutLabelSet, ProcLabel, MayAlterRtti,
+optimize_repeated(Final, LayoutLabelSet, ProcLabel, MayAlterRtti,
!C, !OptDebugInfo, !Instrs, Mod, !IO) :-
InstrsAtStart = !.Instrs,
- LabelStr = opt_util__format_proc_label(ProcLabel),
- globals__io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
- globals__io_lookup_bool_option(optimize_jumps, Jumpopt, !IO),
- globals__io_lookup_bool_option(optimize_fulljumps, FullJumpopt, !IO),
- globals__io_lookup_bool_option(pessimize_tailcalls,
+ LabelStr = opt_util.format_proc_label(ProcLabel),
+ globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+ globals.io_lookup_bool_option(optimize_jumps, Jumpopt, !IO),
+ globals.io_lookup_bool_option(optimize_fulljumps, FullJumpopt, !IO),
+ globals.io_lookup_bool_option(pessimize_tailcalls,
PessimizeTailCalls, !IO),
- globals__io_lookup_bool_option(checked_nondet_tailcalls,
+ globals.io_lookup_bool_option(checked_nondet_tailcalls,
CheckedNondetTailCalls, !IO),
(
Jumpopt = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing jumps for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing jumps for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
jumpopt_main(LayoutLabelSet, MayAlterRtti, ProcLabel, FullJumpopt,
Final, PessimizeTailCalls, CheckedNondetTailCalls, !C, !Instrs,
Mod1),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after jump opt",
+ maybe_opt_debug(!.Instrs, !.C, "after jump opt",
ProcLabel, !OptDebugInfo, !IO)
;
Jumpopt = no,
Mod1 = no
),
- globals__io_lookup_bool_option(optimize_peep, Peephole, !IO),
+ globals.io_lookup_bool_option(optimize_peep, Peephole, !IO),
(
Peephole = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing locally for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing locally for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
- globals__io_get_gc_method(GC_Method, !IO),
- peephole__optimize(GC_Method, !Instrs, Mod2),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after peephole",
+ globals.io_get_gc_method(GC_Method, !IO),
+ peephole.optimize(GC_Method, !Instrs, Mod2),
+ maybe_opt_debug(!.Instrs, !.C, "after peephole",
ProcLabel, !OptDebugInfo, !IO)
;
Peephole = no,
Mod2 = no
),
- globals__io_lookup_bool_option(optimize_labels, LabelElim, !IO),
+ globals.io_lookup_bool_option(optimize_labels, LabelElim, !IO),
(
LabelElim = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing labels for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing labels for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
labelopt_main(Final, LayoutLabelSet, !Instrs, Mod3),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after label opt",
+ maybe_opt_debug(!.Instrs, !.C, "after label opt",
ProcLabel, !OptDebugInfo, !IO)
;
LabelElim = no,
Mod3 = no
),
- globals__io_lookup_bool_option(optimize_dups, DupElim, !IO),
+ globals.io_lookup_bool_option(optimize_dups, DupElim, !IO),
(
DupElim = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing duplicates for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing duplicates for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
dupelim_main(ProcLabel, !C, !Instrs),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after duplicates",
+ maybe_opt_debug(!.Instrs, !.C, "after duplicates",
ProcLabel, !OptDebugInfo, !IO)
;
DupElim = no
@@ -382,38 +381,38 @@
;
Mod = yes
),
- globals__io_lookup_bool_option(detailed_statistics, Statistics, !IO),
+ globals.io_lookup_bool_option(detailed_statistics, Statistics, !IO),
maybe_report_stats(Statistics, !IO).
-:- pred optimize__middle(bool::in, set(label)::in, proc_label::in,
+:- pred optimize_middle(bool::in, set(label)::in, proc_label::in,
may_alter_rtti::in, counter::in, counter::out,
opt_debug_info::in, opt_debug_info::out,
list(instruction)::in, list(instruction)::out, io::di, io::uo) is det.
-optimize__middle(Final, LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
+optimize_middle(Final, LayoutLabelSet, ProcLabel, MayAlterRtti, !C,
!OptDebugInfo, !Instrs, !IO) :-
- globals__io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
- LabelStr = opt_util__format_proc_label(ProcLabel),
+ globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+ LabelStr = opt_util.format_proc_label(ProcLabel),
- globals__io_lookup_bool_option(optimize_frames, FrameOpt, !IO),
+ globals.io_lookup_bool_option(optimize_frames, FrameOpt, !IO),
(
FrameOpt = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing frames for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing frames for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
- globals__io_get_globals(Globals, !IO),
+ globals.io_get_globals(Globals, !IO),
frameopt_main(ProcLabel, !C, !Instrs, Globals, Mod1),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after frame opt",
+ maybe_opt_debug(!.Instrs, !.C, "after frame opt",
ProcLabel, !OptDebugInfo, !IO),
- globals__io_lookup_bool_option(optimize_fulljumps, FullJumpopt, !IO),
- globals__io_lookup_bool_option(pessimize_tailcalls,
+ globals.io_lookup_bool_option(optimize_fulljumps, FullJumpopt, !IO),
+ globals.io_lookup_bool_option(pessimize_tailcalls,
PessimizeTailCalls, !IO),
- globals__io_lookup_bool_option(checked_nondet_tailcalls,
+ globals.io_lookup_bool_option(checked_nondet_tailcalls,
CheckedNondetTailCalls, !IO),
(
( FullJumpopt = yes
@@ -422,16 +421,16 @@
->
(
VeryVerbose = yes,
- io__write_string("% Optimizing jumps for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing jumps for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
jumpopt_main(LayoutLabelSet, MayAlterRtti, ProcLabel, FullJumpopt,
Final, PessimizeTailCalls, CheckedNondetTailCalls, !C, !Instrs,
_Mod2),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after jumps",
+ maybe_opt_debug(!.Instrs, !.C, "after jumps",
ProcLabel, !OptDebugInfo, !IO)
;
true
@@ -440,14 +439,14 @@
Mod1 = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing labels for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing labels for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
labelopt_main(Final, LayoutLabelSet, !Instrs, _Mod3),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after labels",
+ maybe_opt_debug(!.Instrs, !.C, "after labels",
ProcLabel, !OptDebugInfo, !IO)
;
Mod1 = no
@@ -455,40 +454,40 @@
;
FrameOpt = no
),
- globals__io_lookup_bool_option(use_local_vars, UseLocalVars, !IO),
+ globals.io_lookup_bool_option(use_local_vars, UseLocalVars, !IO),
(
UseLocalVars = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing local vars for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing local vars for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
- globals__io_lookup_int_option(num_real_r_regs, NumRealRRegs, !IO),
- globals__io_lookup_int_option(local_var_access_threshold,
+ globals.io_lookup_int_option(num_real_r_regs, NumRealRRegs, !IO),
+ globals.io_lookup_int_option(local_var_access_threshold,
AccessThreshold, !IO),
- globals__io_lookup_bool_option(auto_comments, AutoComments, !IO),
- use_local_vars__main(!Instrs, NumRealRRegs, AccessThreshold,
+ globals.io_lookup_bool_option(auto_comments, AutoComments, !IO),
+ use_local_vars_proc(!Instrs, NumRealRRegs, AccessThreshold,
AutoComments, ProcLabel, !C),
- optimize__maybe_opt_debug(!.Instrs, !.C, "after use_local_vars",
+ maybe_opt_debug(!.Instrs, !.C, "after use_local_vars",
ProcLabel, !OptDebugInfo, !IO)
;
UseLocalVars = no
).
-:- pred optimize__last(set(label)::in, proc_label::in, counter::in,
+:- pred optimize_last(set(label)::in, proc_label::in, counter::in,
opt_debug_info::in, list(instruction)::in, list(instruction)::out,
io::di, io::uo) is det.
-optimize__last(LayoutLabelSet, ProcLabel, C, !.OptDebugInfo, !Instrs, !IO) :-
- globals__io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
- LabelStr = opt_util__format_proc_label(ProcLabel),
-
- globals__io_lookup_bool_option(optimize_reassign, Reassign, !IO),
- globals__io_lookup_bool_option(optimize_delay_slot, DelaySlot, !IO),
- globals__io_lookup_bool_option(use_local_vars, UseLocalVars, !IO),
+optimize_last(LayoutLabelSet, ProcLabel, C, !.OptDebugInfo, !Instrs, !IO) :-
+ globals.io_lookup_bool_option(very_verbose, VeryVerbose, !IO),
+ LabelStr = opt_util.format_proc_label(ProcLabel),
+
+ globals.io_lookup_bool_option(optimize_reassign, Reassign, !IO),
+ globals.io_lookup_bool_option(optimize_delay_slot, DelaySlot, !IO),
+ globals.io_lookup_bool_option(use_local_vars, UseLocalVars, !IO),
(
( Reassign = yes
; DelaySlot = yes
@@ -499,14 +498,14 @@
% since they can confuse reassign, wrap_blocks and delay_slot.
(
VeryVerbose = yes,
- io__write_string("% Optimizing labels for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing labels for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
labelopt_main(no, LayoutLabelSet, !Instrs, _Mod1),
- optimize__maybe_opt_debug(!.Instrs, C, "after label opt",
+ maybe_opt_debug(!.Instrs, C, "after label opt",
ProcLabel, !OptDebugInfo, !IO)
;
true
@@ -515,14 +514,14 @@
Reassign = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing reassign for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing reassign for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
remove_reassign(!Instrs),
- optimize__maybe_opt_debug(!.Instrs, C, "after reassign",
+ maybe_opt_debug(!.Instrs, C, "after reassign",
ProcLabel, !OptDebugInfo, !IO)
;
Reassign = no
@@ -531,41 +530,41 @@
DelaySlot = yes,
(
VeryVerbose = yes,
- io__write_string("% Optimizing delay slot for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing delay slot for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
fill_branch_delay_slot(!Instrs),
- optimize__maybe_opt_debug(!.Instrs, C, "after delay slots",
+ maybe_opt_debug(!.Instrs, C, "after delay slots",
ProcLabel, !OptDebugInfo, !IO)
;
DelaySlot = no
),
(
VeryVerbose = yes,
- io__write_string("% Optimizing returns for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Optimizing returns for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
combine_decr_sp(!Instrs),
- optimize__maybe_opt_debug(!.Instrs, C, "after combine decr_sp",
+ maybe_opt_debug(!.Instrs, C, "after combine decr_sp",
ProcLabel, !OptDebugInfo, !IO),
(
UseLocalVars = yes,
(
VeryVerbose = yes,
- io__write_string("% Wrapping blocks for ", !IO),
- io__write_string(LabelStr, !IO),
- io__write_string("\n", !IO)
+ io.write_string("% Wrapping blocks for ", !IO),
+ io.write_string(LabelStr, !IO),
+ io.write_string("\n", !IO)
;
VeryVerbose = no
),
wrap_blocks(!Instrs),
- optimize__maybe_opt_debug(!.Instrs, C, "after wrap blocks",
+ maybe_opt_debug(!.Instrs, C, "after wrap blocks",
ProcLabel, !.OptDebugInfo, _OptDebugInfo, !IO)
;
UseLocalVars = no
@@ -579,12 +578,12 @@
:- func mangle_name_as_filename(string) = string.
mangle_name_as_filename(Str0) = Str :-
- string__foldl(escape_dir_char, Str0, "", Str).
+ string.foldl(escape_dir_char, Str0, "", Str).
:- pred escape_dir_char(char::in, string::in, string::out) is det.
escape_dir_char(Char, !Str) :-
- ( dir__is_directory_separator(Char) ->
+ ( dir.is_directory_separator(Char) ->
!:Str = !.Str ++ "_slash_"
;
!:Str = !.Str ++ char_to_string(Char)
Index: compiler/use_local_vars.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/use_local_vars.m,v
retrieving revision 1.20
diff -u -b -r1.20 use_local_vars.m
--- compiler/use_local_vars.m 28 Nov 2005 04:11:59 -0000 1.20
+++ compiler/use_local_vars.m 30 Jan 2006 02:45:26 -0000
@@ -58,7 +58,7 @@
%-----------------------------------------------------------------------------%
-:- module ll_backend__use_local_vars.
+:- module ll_backend.use_local_vars.
:- interface.
:- import_module ll_backend.llds.
@@ -70,7 +70,7 @@
%-----------------------------------------------------------------------------%
-:- pred use_local_vars__main(list(instruction)::in, list(instruction)::out,
+:- pred use_local_vars_proc(list(instruction)::in, list(instruction)::out,
int::in, int::in, bool::in, proc_label::in, counter::in, counter::out)
is det.
@@ -96,12 +96,12 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-use_local_vars__main(Instrs0, Instrs, NumRealRRegs, AccessThreshold,
+use_local_vars_proc(Instrs0, Instrs, NumRealRRegs, AccessThreshold,
AutoComments, ProcLabel, !C) :-
create_basic_blocks(Instrs0, Comments0, ProcLabel, !C, NewLabels,
LabelSeq, BlockMap0),
flatten_basic_blocks(LabelSeq, BlockMap0, TentativeInstrs),
- livemap__build(TentativeInstrs, MaybeLiveMap),
+ livemap.build(TentativeInstrs, MaybeLiveMap),
(
% Instrs0 must have contained C code which cannot be analyzed
MaybeLiveMap = no,
@@ -110,7 +110,7 @@
MaybeLiveMap = yes(LiveMap),
extend_basic_blocks(LabelSeq, EBBLabelSeq, BlockMap0, EBBBlockMap0,
NewLabels),
- list__foldl(use_local_vars_block(LiveMap, NumRealRRegs,
+ list.foldl(use_local_vars_block(LiveMap, NumRealRRegs,
AccessThreshold), EBBLabelSeq, EBBBlockMap0, EBBBlockMap),
flatten_basic_blocks(EBBLabelSeq, EBBBlockMap, Instrs1),
(
@@ -129,10 +129,10 @@
use_local_vars_block(LiveMap, NumRealRRegs, AccessThreshold, Label,
!BlockMap) :-
- map__lookup(!.BlockMap, Label, BlockInfo0),
+ map.lookup(!.BlockMap, Label, BlockInfo0),
BlockInfo0 = block_info(BlockLabel, LabelInstr, RestInstrs0,
FallInto, JumpLabels, MaybeFallThrough),
- counter__init(1, TempCounter0),
+ counter.init(1, TempCounter0),
use_local_vars_instrs(RestInstrs0, RestInstrs, TempCounter0, TempCounter,
NumRealRRegs, AccessThreshold, LiveMap, MaybeFallThrough),
( TempCounter = TempCounter0 ->
@@ -140,7 +140,7 @@
;
BlockInfo = block_info(BlockLabel, LabelInstr, RestInstrs, FallInto,
JumpLabels, MaybeFallThrough),
- map__det_update(!.BlockMap, Label, BlockInfo, !:BlockMap)
+ map.det_update(!.BlockMap, Label, BlockInfo, !:BlockMap)
).
%-----------------------------------------------------------------------------%
@@ -155,7 +155,7 @@
MaybeFallThrough),
( AccessThreshold >= 1 ->
opt_access(!RestInstrs, !TempCounter, NumRealRRegs,
- set__init, AccessThreshold)
+ set.init, AccessThreshold)
;
true
).
@@ -180,19 +180,19 @@
find_compulsory_lvals(TailInstrs0, LiveMap, MaybeFallThrough,
no, MaybeCompulsoryLvals),
MaybeCompulsoryLvals = known(CompulsoryLvals),
- not set__member(ToLval, CompulsoryLvals)
+ not set.member(ToLval, CompulsoryLvals)
->
- counter__allocate(TempNum, !TempCounter),
+ counter.allocate(TempNum, !TempCounter),
NewLval = temp(r, TempNum),
substitute_lval_in_defn(ToLval, NewLval, Instr0, Instr),
- list__map_foldl(
- exprn_aux__substitute_lval_in_instr(ToLval, NewLval),
+ list.map_foldl(
+ exprn_aux.substitute_lval_in_instr(ToLval, NewLval),
TailInstrs0, TailInstrs1, 0, _),
opt_assign(TailInstrs1, TailInstrs, !TempCounter, NumRealRRegs,
LiveMap, MaybeFallThrough),
Instrs = [Instr | TailInstrs]
;
- counter__allocate(TempNum, !TempCounter),
+ counter.allocate(TempNum, !TempCounter),
NewLval = temp(r, TempNum),
substitute_lval_in_instr_until_defn(ToLval, NewLval,
TailInstrs0, TailInstrs1, 0, NumSubst),
@@ -227,7 +227,7 @@
MaybeCompulsoryLvals) :-
(
MaybeFallThrough = yes(FallThrough),
- map__lookup(LiveMap, FallThrough, CompulsoryLvals),
+ map.lookup(LiveMap, FallThrough, CompulsoryLvals),
MaybeCompulsoryLvals = known(CompulsoryLvals)
;
MaybeFallThrough = no,
@@ -249,14 +249,14 @@
this_file, "find_compulsory_lvals: call without livevals"),
% The livevals instruction will include all the live lvals
% in MaybeCompulsoryLvals after we return.
- !:MaybeCompulsoryLvals = known(set__init)
+ !:MaybeCompulsoryLvals = known(set.init)
;
Uinstr = goto(_Target),
PrevLivevals = yes
->
% The livevals instruction will include all the live lvals
% in MaybeCompulsoryLvals after we return.
- !:MaybeCompulsoryLvals = known(set__init)
+ !:MaybeCompulsoryLvals = known(set.init)
;
possible_targets(Uinstr, Labels, NonLabelCodeAddrs),
(
@@ -268,8 +268,8 @@
no, !:MaybeCompulsoryLvals)
;
Labels = [_ | _],
- list__map(map__lookup(LiveMap), Labels, LabelsLiveLvals),
- AllLabelsLiveLvals = set__union_list(LabelsLiveLvals),
+ list.map(map.lookup(LiveMap), Labels, LabelsLiveLvals),
+ AllLabelsLiveLvals = set.union_list(LabelsLiveLvals),
find_compulsory_lvals(Instrs, LiveMap, MaybeFallThrough,
no, !:MaybeCompulsoryLvals),
union_maybe_compulsory_lvals(AllLabelsLiveLvals,
@@ -287,7 +287,7 @@
union_maybe_compulsory_lvals(New, !MaybeCompulsoryLvals) :-
(
!.MaybeCompulsoryLvals = known(OldCompulsoryLvals),
- set__union(New, OldCompulsoryLvals, AllCompulsoryLvals),
+ set.union(New, OldCompulsoryLvals, AllCompulsoryLvals),
!:MaybeCompulsoryLvals = known(AllCompulsoryLvals)
;
!.MaybeCompulsoryLvals = unknown_must_assume_all
@@ -306,21 +306,21 @@
Uinstr0 = assign(ToLval, FromRval),
lvals_in_lval(ToLval, ToSubLvals),
lvals_in_rval(FromRval, FromSubLvals),
- list__append(ToSubLvals, FromSubLvals, SubLvals),
- list__filter(
+ list.append(ToSubLvals, FromSubLvals, SubLvals),
+ list.filter(
base_lval_worth_replacing_not_tried(AlreadyTried0, NumRealRRegs),
SubLvals, ReplaceableSubLvals),
ReplaceableSubLvals = [ChosenLval | ChooseableRvals]
->
OrigTempCounter = !.TempCounter,
- counter__allocate(TempNum, !TempCounter),
+ counter.allocate(TempNum, !TempCounter),
TempLval = temp(r, TempNum),
lvals_in_lval(ChosenLval, SubChosenLvals),
expect(unify(SubChosenLvals, []),
this_file, "opt_access: nonempty SubChosenLvals"),
substitute_lval_in_instr_until_defn(ChosenLval, TempLval,
[Instr0 | TailInstrs0], Instrs1, 0, NumReplacements),
- set__insert(AlreadyTried0, ChosenLval, AlreadyTried1),
+ set.insert(AlreadyTried0, ChosenLval, AlreadyTried1),
( NumReplacements >= AccessThreshold ->
TempAssign = assign(TempLval, lval(ChosenLval))
- "factor out common sub lval",
@@ -334,12 +334,12 @@
;
!:TempCounter = OrigTempCounter,
opt_access(TailInstrs0, TailInstrs, !TempCounter, NumRealRRegs,
- set__init, AccessThreshold),
+ set.init, AccessThreshold),
Instrs = [Instr0 | TailInstrs]
)
;
opt_access(TailInstrs0, TailInstrs, !TempCounter, NumRealRRegs,
- set__init, AccessThreshold),
+ set.init, AccessThreshold),
Instrs = [Instr0 | TailInstrs]
).
@@ -361,7 +361,7 @@
is semidet.
base_lval_worth_replacing_not_tried(AlreadyTried, NumRealRRegs, Lval) :-
- \+ set__member(Lval, AlreadyTried),
+ \+ set.member(Lval, AlreadyTried),
base_lval_worth_replacing(NumRealRRegs, Lval).
%-----------------------------------------------------------------------------%
@@ -460,7 +460,7 @@
% contains is itself.
true
;
- exprn_aux__substitute_lval_in_instr(OldLval, NewLval, !Instr, !N),
+ exprn_aux.substitute_lval_in_instr(OldLval, NewLval, !Instr, !N),
substitute_lval_in_instr_until_defn(OldLval, NewLval, !Instrs, !N)
)
;
@@ -473,10 +473,10 @@
Uinstr0 = goto(_)
;
Uinstr0 = computed_goto(_, _),
- exprn_aux__substitute_lval_in_instr(OldLval, NewLval, !Instr, !N)
+ exprn_aux.substitute_lval_in_instr(OldLval, NewLval, !Instr, !N)
;
Uinstr0 = if_val(_, _),
- exprn_aux__substitute_lval_in_instr(OldLval, NewLval, !Instr, !N)
+ exprn_aux.substitute_lval_in_instr(OldLval, NewLval, !Instr, !N)
;
Uinstr0 = save_maxfr(_)
;
@@ -489,7 +489,7 @@
% contains is itself.
true
;
- exprn_aux__substitute_lval_in_instr(OldLval, NewLval, !Instr, !N),
+ exprn_aux.substitute_lval_in_instr(OldLval, NewLval, !Instr, !N),
substitute_lval_in_instr_until_defn(OldLval, NewLval, !Instrs, !N)
)
;
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing debian/patches
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/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/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/solver_types
cvs diff: Diffing extras/solver_types/library
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/windows_installer_generator
cvs diff: Diffing extras/windows_installer_generator/sample
cvs diff: Diffing extras/windows_installer_generator/sample/images
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
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
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/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/trailing
cvs diff: Diffing tests/valid
Index: tests/valid/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/valid/Mmakefile,v
retrieving revision 1.162
diff -u -b -r1.162 Mmakefile
--- tests/valid/Mmakefile 21 Dec 2005 23:20:00 -0000 1.162
+++ tests/valid/Mmakefile 31 Jan 2006 01:05:54 -0000
@@ -87,6 +87,7 @@
empty_bound_inst_list \
empty_switch \
error \
+ eval \
existential_cons \
explicit_quant \
export_before_func \
Index: tests/valid/eval.m
===================================================================
RCS file: tests/valid/eval.m
diff -N tests/valid/eval.m
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/valid/eval.m 31 Jan 2006 01:05:39 -0000
@@ -0,0 +1,66 @@
+% This is a regression test. The compiler on 29 January, 2006 aborted with
+% the message "Software Error: basic_block.m: Unexpected: extend_basic_blocks:
+% fall through mismatch" when invoked with -O0 --optimize-repeat=0
+% --optimize-saved-vars on this file.
+%
+% The contents of this file are an extract from eval.m in the CVS directory
+% benchmarks/progs/icfp2000.
+
+:- module eval.
+:- interface.
+
+:- import_module bool.
+:- import_module list.
+:- import_module io.
+
+:- type token_list == list(token_group).
+
+:- type token_group
+ ---> single_token(token)
+ ; function(token_list)
+ ; array(token_list).
+
+:- type token
+ ---> identifier(string)
+ ; binder(string)
+ ; boolean(bool)
+ ; number(int)
+ ; string(string).
+
+:- type code == token_list.
+
+:- pred interpret(code::in, io__state::di, io__state::uo) is det.
+
+%-----------------------------------------------------------------------------%
+
+:- implementation.
+
+:- import_module map.
+:- import_module array.
+
+:- type value
+ ---> boolean(bool)
+ ; int(int)
+ ; real(float)
+ ; string(string).
+
+:- type id == string.
+
+:- type env == map(id, value).
+
+:- type stack == list(value).
+
+interpret(Code) -->
+ initial_setup(Env0, Stack0),
+ interpret(Code, Env0, Stack0, _Env, _Stack).
+
+:- pred initial_setup(env::out, stack::out,
+ io__state::di, io__state::uo) is det.
+
+initial_setup(Env, []) -->
+ { map__init(Env) }.
+
+:- pred interpret(code::in, env::in, stack::in,
+ env::out, stack::out, io__state::di, io__state::uo) is det.
+
+interpret(_, Env, Stack, Env, Stack) --> [].
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: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list