[m-rev.] diff: compile zm_enums.m with deep-profiled compiler

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon Jul 18 15:08:11 AEST 2011


Make it possible to compile zm_enums.m, a Mercury source file generated
automatically by the Zinc compiler, with debugging enabled, EVEN IF the
compiler doing the compilation is in a deep profiling grade, which disables
most forms of tail recursion.

In most cases, the problem was that iterating over long lists exhausts the
stack unless we do something to free up stack frames. The standard solution
of this problem is two-level iteration: after processing a bunch of items
(say 1000) with the inner loop, we free up the 1000 stack frames used by this,
replacing them with only one stack frame of the predicate implementing
the outer loop.

The overall performance impact of this change on tools/speedtest is a
slight speedup (0.7%).

compiler/code_gen.m:
	Apply the solution above to long lists of conjuncts.

compiler/code_info.m:
	Replace a model_non loop with a model_det loop. This helps because
	the default nondet stack size is *much* smaller than the default
	det stack size.

	We were using filter in a way that asked it to construct
	lists of variables of dummy types, which we then ignored.
	Ask filter to construct just the lists we want.

compiler/hlds_pred.m:
	Add a utility predicate that tests for non-dummy types, for use
	by code_info.m.

compiler/layout_out.m:
	Apply the solution at the top to the code that prints lists of
	pseudo-typeinfos. For zm_enums.m, the list is so huge that even
	list.length runs out of stack space!

	Also, specialize that code for the value of the autocomments option.

compiler/llds_out_data.m:
	Apply the solution at the top to the code that prints the declarations
	of lists of rvals.

compiler/llds_out_instr.m:
	Avoid mutual recursion between two predicates. This should allow
	--deep-profile-tail-recursion to apply to both.

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/extra
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/extra
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/doc
cvs diff: Diffing boehm_gc/libatomic_ops/src
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/armcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops/tests
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/tests
cvs diff: Diffing boehm_gc/m4
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.184
diff -u -b -r1.184 code_gen.m
--- compiler/code_gen.m	25 May 2011 08:01:23 -0000	1.184
+++ compiler/code_gen.m	18 Jul 2011 00:10:26 -0000
@@ -59,6 +59,7 @@
 
 :- import_module bool.
 :- import_module cord.
+:- import_module int.
 :- import_module io.
 :- import_module list.
 :- import_module map.
@@ -123,7 +124,7 @@
             )
         ),
 
-        generate_goal_2(GoalExpr, GoalInfo, CodeModel,
+        generate_goal_expr(GoalExpr, GoalInfo, CodeModel,
             ForwardLiveVarsBeforeGoal, GoalCode, !CI),
         Features = goal_info_get_features(GoalInfo),
         get_proc_info(!.CI, ProcInfo),
@@ -227,11 +228,11 @@
 
 %---------------------------------------------------------------------------%
 
-:- pred generate_goal_2(hlds_goal_expr::in, hlds_goal_info::in,
+:- pred generate_goal_expr(hlds_goal_expr::in, hlds_goal_info::in,
     code_model::in, set(prog_var)::in, llds_code::out,
     code_info::in, code_info::out) is det.
 
-generate_goal_2(GoalExpr, GoalInfo, CodeModel, ForwardLiveVarsBeforeGoal,
+generate_goal_expr(GoalExpr, GoalInfo, CodeModel, ForwardLiveVarsBeforeGoal,
         Code, !CI) :-
     (
         GoalExpr = unify(_, _, _, Uni, _),
@@ -240,7 +241,7 @@
         GoalExpr = conj(ConjType, Goals),
         (
             ConjType = plain_conj,
-            generate_goals(Goals, CodeModel, cord.init, Code, !CI)
+            generate_conj(Goals, CodeModel, cord.init, Code, !CI)
         ;
             ConjType = parallel_conj,
             par_conj_gen.generate_par_conj(Goals, GoalInfo, CodeModel, Code,
@@ -313,18 +314,37 @@
     % Generate a conjoined series of goals. State information flows directly
     % from one conjunct to the next.
     %
-:- pred generate_goals(list(hlds_goal)::in, code_model::in,
+    % We call generate_goals to generate code for up to 1000 goals.
+    % If there are any more goals left after that, we let generate_goals
+    % give up all its stack frames before calling it again. This allows us
+    % to generate code for *very* long sequences of goals even if the compiler
+    % is compiled in a grade that does not allow tail recursion.
+    %
+:- pred generate_conj(list(hlds_goal)::in, code_model::in,
     llds_code::in, llds_code::out, code_info::in, code_info::out) is det.
 
-generate_goals([], _, !Code, !CI).
-generate_goals([Goal | Goals], CodeModel, !Code, !CI) :-
+generate_conj([], _, !Code, !CI).
+generate_conj(Goals @ [_ | _], CodeModel, !Code, !CI) :-
+    generate_goals(Goals, 1000, CodeModel, LeftOverGoals, !Code, !CI),
+    generate_conj(LeftOverGoals, CodeModel, !Code, !CI).
+
+:- pred generate_goals(list(hlds_goal)::in, int::in, code_model::in,
+    list(hlds_goal)::out, llds_code::in, llds_code::out,
+    code_info::in, code_info::out) is det.
+
+generate_goals([], _, _, [], !Code, !CI).
+generate_goals([Goal | Goals], N, CodeModel, LeftOverGoals, !Code, !CI) :-
+    ( N > 0 ->
     generate_goal(CodeModel, Goal, GoalCode, !CI),
     !:Code = !.Code ++ GoalCode,
     get_instmap(!.CI, Instmap),
     ( instmap_is_unreachable(Instmap) ->
-        true
+            LeftOverGoals = []
+        ;
+            generate_goals(Goals, N - 1, CodeModel, LeftOverGoals, !Code, !CI)
+        )
     ;
-        generate_goals(Goals, CodeModel, !Code, !CI)
+        LeftOverGoals = [Goal | Goals]
     ).
 
 %---------------------------------------------------------------------------%
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.390
diff -u -b -r1.390 code_info.m
--- compiler/code_info.m	5 Jul 2011 03:34:30 -0000	1.390
+++ compiler/code_info.m	18 Jul 2011 00:10:26 -0000
@@ -2809,14 +2809,16 @@
     set.list_to_set(KeyList, Keys),
     map.select(Locations0, Keys, Locations),
     map.to_assoc_list(Locations, List),
-    (
-        list.member(Var - Actual, List)
-    =>
-        (
+    all_vars_match_resume_map(Map, List).
+
+:- pred all_vars_match_resume_map(resume_map::in,
+    assoc_list(prog_var, set(lval))::in) is semidet.
+
+all_vars_match_resume_map(_Map, []).
+all_vars_match_resume_map(Map, [Var - Actual | VarsActuals]) :-
             map.search(Map, Var, Lvals),
-            set.subset(Lvals, Actual)
-        )
-    ).
+    set.subset(Lvals, Actual),
+    all_vars_match_resume_map(Map, VarsActuals).
 
 :- pred pick_first_resume_point(resume_point_info::in,
     resume_map::out, code_addr::out) is det.
@@ -4061,8 +4063,8 @@
             RealStackVarLocs, DummyStackVarLocs)
     ),
     get_var_locn_info(!.CI, VarLocnInfo0),
-    list.filter(key_var_is_of_dummy_type(ModuleInfo, VarTypes), InArgInfos,
-        _DummyInArgInfos, RealInArgInfos),
+    list.filter(key_var_is_of_non_dummy_type(ModuleInfo, VarTypes),
+        InArgInfos, RealInArgInfos),
     var_arg_info_to_lval(RealInArgInfos, RealInArgLocs),
     AllRealLocs = RealStackVarLocs ++ RealInArgLocs,
     AllLocs = DummyStackVarLocs ++ AllRealLocs,
@@ -4071,11 +4073,11 @@
     assoc_list.values(AllRealLocs, LiveLocList),
     set.list_to_set(LiveLocList, LiveLocs).
 
-:- pred key_var_is_of_dummy_type(module_info::in, vartypes::in,
+:- pred key_var_is_of_non_dummy_type(module_info::in, vartypes::in,
     pair(prog_var, arg_info)::in) is semidet.
 
-key_var_is_of_dummy_type(ModuleInfo, VarTypes, Var - _ArgInfo) :-
-    var_is_of_dummy_type(ModuleInfo, VarTypes, Var).
+key_var_is_of_non_dummy_type(ModuleInfo, VarTypes, Var - _ArgInfo) :-
+    var_is_of_non_dummy_type(ModuleInfo, VarTypes, Var).
 
 :- pred valid_stack_slot(module_info::in, vartypes::in,
     pair(prog_var, lval)::in) is semidet.
@@ -4241,8 +4243,8 @@
     get_known_variables(CI, KnownVarList0),
     get_module_info(CI, ModuleInfo),
     VarTypes = get_var_types(CI),
-    list.filter(var_is_of_dummy_type(ModuleInfo, VarTypes), KnownVarList0,
-        _, KnownVarList),
+    list.filter(var_is_of_non_dummy_type(ModuleInfo, VarTypes),
+        KnownVarList0, KnownVarList),
     set.list_to_set(KnownVarList, KnownVars),
     set.difference(KnownVars, OutputArgs, LiveVars),
     set.to_sorted_list(LiveVars, LiveVarList),
@@ -4284,7 +4286,7 @@
     get_known_variables(CI, Vars0),
     get_module_info(CI, ModuleInfo),
     VarTypes = get_var_types(CI),
-    list.filter(var_is_of_dummy_type(ModuleInfo, VarTypes), Vars0, _, Vars),
+    list.filter(var_is_of_non_dummy_type(ModuleInfo, VarTypes), Vars0, Vars),
     get_active_temps_data(CI, Temps),
     get_proc_info(CI, ProcInfo),
     get_globals(CI, Globals),
Index: compiler/hlds_pred.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_pred.m,v
retrieving revision 1.272
diff -u -b -r1.272 hlds_pred.m
--- compiler/hlds_pred.m	5 Jul 2011 21:16:55 -0000	1.272
+++ compiler/hlds_pred.m	18 Jul 2011 00:10:26 -0000
@@ -2251,6 +2251,9 @@
 :- pred var_is_of_dummy_type(module_info::in, vartypes::in, prog_var::in)
     is semidet.
 
+:- pred var_is_of_non_dummy_type(module_info::in, vartypes::in, prog_var::in)
+    is semidet.
+
 :- implementation.
 
 :- type proc_info
@@ -3050,6 +3053,10 @@
     map.lookup(VarTypes, Var, Type),
     check_dummy_type(ModuleInfo, Type) = is_dummy_type.
 
+var_is_of_non_dummy_type(ModuleInfo, VarTypes, Var) :-
+    map.lookup(VarTypes, Var, Type),
+    check_dummy_type(ModuleInfo, Type) = is_not_dummy_type.
+
 %-----------------------------------------------------------------------------%
 
     % Predicates to deal with record syntax.
Index: compiler/layout_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/layout_out.m,v
retrieving revision 1.120
diff -u -b -r1.120 layout_out.m
--- compiler/layout_out.m	4 Jul 2011 02:27:32 -0000	1.120
+++ compiler/layout_out.m	18 Jul 2011 02:37:19 -0000
@@ -521,30 +521,58 @@
 
 output_pseudo_type_info_array_defn(Info, PTIs, !IO) :-
     ModuleName = Info ^ lout_mangled_module_name,
-    list.length(PTIs, NumPTIs),
+    long_length(PTIs, NumPTIs),
     Name = pseudo_type_info_array,
     output_layout_array_name_storage_type_name(ModuleName, Name,
         being_defined, !IO),
     io.format("[%d] = {", [i(NumPTIs)], !IO),
-    list.chunk(PTIs, 10, PTIChunks),
-    list.foldl2(output_pti_chunk(Info), PTIChunks, 0, _, !IO),
-    io.write_string("\n};\n\n", !IO).
-
-:- pred output_pti_chunk(llds_out_info::in, list(rval)::in, int::in, int::out,
-    io::di, io::uo) is det.
-
-output_pti_chunk(Info, ChunkPTIs, !Slot, !IO) :-
-    list.length(ChunkPTIs, NumChunkPTIs),
     AutoComments = Info ^ lout_auto_comments,
     (
         AutoComments = yes,
-        io.format("\n/* slots %d+ */ MR_cast_to_pti%d(\n\t",
-            [i(!.Slot), i(NumChunkPTIs)], !IO)
+        output_ptis_outer_loop_ac(Info, PTIs, 0, _, !IO)
     ;
         AutoComments = no,
-        io.format("\nMR_cast_to_pti%d(",
-            [i(NumChunkPTIs)], !IO)
+        output_ptis_outer_loop_noac(Info, PTIs, 0, _, !IO)
     ),
+    io.write_string("\n};\n\n", !IO).
+
+:- pred output_ptis_outer_loop_ac(llds_out_info::in, list(rval)::in,
+    int::in, int::out, io::di, io::uo) is det.
+
+output_ptis_outer_loop_ac(_Info, [], !Slot, !IO).
+output_ptis_outer_loop_ac(Info, PTIs @ [_ | _], !Slot, !IO) :-
+    list.split_upto(1000, PTIs, StartPTIs, LaterPTIs),
+    list.chunk(StartPTIs, 10, PTIChunks),
+    list.foldl2(output_pti_chunk_ac(Info), PTIChunks, !Slot, !IO),
+    output_ptis_outer_loop_ac(Info, LaterPTIs, !Slot, !IO).
+
+:- pred output_ptis_outer_loop_noac(llds_out_info::in, list(rval)::in,
+    int::in, int::out, io::di, io::uo) is det.
+
+output_ptis_outer_loop_noac(_Info, [], !Slot, !IO).
+output_ptis_outer_loop_noac(Info, PTIs @ [_ | _], !Slot, !IO) :-
+    list.split_upto(1000, PTIs, StartPTIs, LaterPTIs),
+    list.chunk(StartPTIs, 10, PTIChunks),
+    list.foldl2(output_pti_chunk_noac(Info), PTIChunks, !Slot, !IO),
+    output_ptis_outer_loop_noac(Info, LaterPTIs, !Slot, !IO).
+
+:- pred output_pti_chunk_ac(llds_out_info::in, list(rval)::in,
+    int::in, int::out, io::di, io::uo) is det.
+
+output_pti_chunk_ac(Info, ChunkPTIs, !Slot, !IO) :-
+    list.length(ChunkPTIs, NumChunkPTIs),
+    io.format("\n/* slots %d+ */ MR_cast_to_pti%d(\n\t",
+        [i(!.Slot), i(NumChunkPTIs)], !IO),
+    io.write_list(ChunkPTIs, ",\n\t", output_rval(Info), !IO),
+    io.write_string(")", !IO),
+    !:Slot = !.Slot + NumChunkPTIs.
+
+:- pred output_pti_chunk_noac(llds_out_info::in, list(rval)::in,
+    int::in, int::out, io::di, io::uo) is det.
+
+output_pti_chunk_noac(Info, ChunkPTIs, !Slot, !IO) :-
+    list.length(ChunkPTIs, NumChunkPTIs),
+    io.format("\nMR_cast_to_pti%d(", [i(NumChunkPTIs)], !IO),
     io.write_list(ChunkPTIs, ",\n\t", output_rval(Info), !IO),
     io.write_string(")", !IO),
     !:Slot = !.Slot + NumChunkPTIs.
@@ -559,7 +587,7 @@
 
 output_hlds_var_nums_array_defn(Info, VarNums, !IO) :-
     ModuleName = Info ^ lout_mangled_module_name,
-    list.length(VarNums, NumVarNums),
+    long_length(VarNums, NumVarNums),
     Name = hlds_var_nums_array,
     output_layout_array_name_storage_type_name(ModuleName, Name,
         being_defined, !IO),
@@ -3311,6 +3339,30 @@
         io.write_string("MR_FUNCTION", !IO)
     ).
 
+:- pred long_length(list(T)::in, int::out) is det.
+
+long_length(List, Length) :-
+    long_length_outer_loop(List, 0, Length).
+
+:- pred long_length_outer_loop(list(T)::in, int::in, int::out) is det.
+
+long_length_outer_loop([], !Length).
+long_length_outer_loop(List @ [_ | _], !Length) :-
+    long_length_inner_loop(List, 5000, LeftOver, !Length),
+    long_length_outer_loop(LeftOver, !Length).
+
+:- pred long_length_inner_loop(list(T)::in, int::in, list(T)::out,
+    int::in, int::out) is det.
+
+long_length_inner_loop([], _, [], !Length).
+long_length_inner_loop([H | T], Count, LeftOver, !Length) :-
+    ( Count > 0 ->
+        !:Length = !.Length + 1,
+        long_length_inner_loop(T, Count - 1, LeftOver, !Length)
+    ;
+        LeftOver = [H | T]
+    ).
+
 %-----------------------------------------------------------------------------%
 :- end_module ll_backend.layout_out.
 %-----------------------------------------------------------------------------%
Index: compiler/llds_out_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out_data.m,v
retrieving revision 1.4
diff -u -b -r1.4 llds_out_data.m
--- compiler/llds_out_data.m	23 May 2011 05:08:04 -0000	1.4
+++ compiler/llds_out_data.m	18 Jul 2011 02:37:19 -0000
@@ -739,13 +739,36 @@
     decl_set::out, io::di, io::uo) is det.
 
 output_record_rvals_decls_format(_, [], _, _, !N, !DeclSet, !IO).
-output_record_rvals_decls_format(Info, [Rval | Rvals],
+output_record_rvals_decls_format(Info, Rvals @ [_ | _],
         FirstIndent, LaterIndent, !N, !DeclSet, !IO) :-
-    output_record_rval_decls_format(Info, Rval,
+    output_record_rvals_decls_format_count(Info, Rvals, LeftOverRvals, 1000,
         FirstIndent, LaterIndent, !N, !DeclSet, !IO),
-    output_record_rvals_decls_format(Info, Rvals,
+    output_record_rvals_decls_format(Info, LeftOverRvals,
         FirstIndent, LaterIndent, !N, !DeclSet, !IO).
 
+    % We use this predicate to output the declarations of up to Count rvals.
+    % It is separate from output_record_rvals_decls_format so that in grades
+    % that do not permit tail recursion, we can free up the stack frames
+    % occupied by a bunch of loop iterations before the declarations of *all*
+    % the rvals have been output.
+    % 
+:- pred output_record_rvals_decls_format_count(llds_out_info::in,
+    list(rval)::in, list(rval)::out, int::in,
+    string::in, string::in, int::in, int::out, decl_set::in,
+    decl_set::out, io::di, io::uo) is det.
+
+output_record_rvals_decls_format_count(_, [], [], _, _, _, !N, !DeclSet, !IO).
+output_record_rvals_decls_format_count(Info, [Rval | Rvals], LeftOverRvals,
+        Count, FirstIndent, LaterIndent, !N, !DeclSet, !IO) :-
+    ( Count > 0 ->
+        output_record_rval_decls_format(Info, Rval,
+            FirstIndent, LaterIndent, !N, !DeclSet, !IO),
+        output_record_rvals_decls_format_count(Info, Rvals, LeftOverRvals,
+            Count - 1, FirstIndent, LaterIndent, !N, !DeclSet, !IO)
+    ;
+        LeftOverRvals = [Rval | Rvals]
+    ).
+
 :- pred output_record_mem_ref_decls_format(llds_out_info::in, mem_ref::in,
     string::in, string::in, int::in, int::out, decl_set::in, decl_set::out,
     io::di, io::uo) is det.
Index: compiler/llds_out_instr.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/llds_out_instr.m,v
retrieving revision 1.9
diff -u -b -r1.9 llds_out_instr.m
--- compiler/llds_out_instr.m	17 Jun 2011 07:51:18 -0000	1.9
+++ compiler/llds_out_instr.m	18 Jul 2011 02:45:30 -0000
@@ -259,11 +259,11 @@
         output_instruction_and_comment(Info, Uinstr, Comment, ProfInfo, !IO),
         ( set_tree234.contains(WhileSet, Label) ->
             io.write_string("\twhile (1) {\n", !IO),
-            output_instruction_list_while(Info, Instrs, Label, ProfInfo,
-                WhileSet, !IO)
-            % The matching close brace is printed in output_instruction_list
-            % when before the next label, before a goto that closes the loop,
-            % or when we get to the end of Instrs.
+            output_instruction_list_while(Info, Label, Instrs,
+                AfterWhileInstrs, ProfInfo, WhileSet, !IO),
+            io.write_string("\t} /* end while */\n", !IO),
+            output_instruction_list(Info, AfterWhileInstrs, ProfInfo, WhileSet,
+                not_after_layout_label, !IO)
         ;
             output_instruction_list(Info, Instrs, ProfInfo, WhileSet,
                 AfterLayoutLabel, !IO)
@@ -280,23 +280,22 @@
             AfterLayoutLabel, !IO)
     ).
 
-:- pred output_instruction_list_while(llds_out_info::in,
-    list(instruction)::in, label::in, pair(label,
-    set_tree234(label))::in, set_tree234(label)::in, io::di, io::uo) is det.
-
-output_instruction_list_while(_, [], _, _, _, !IO) :-
-    io.write_string("\tbreak; } /* end while */\n", !IO).
-output_instruction_list_while(Info, [Instr | Instrs], Label, ProfInfo,
-        WhileSet, !IO) :-
+:- pred output_instruction_list_while(llds_out_info::in, label::in,
+    list(instruction)::in, list(instruction)::out,
+    pair(label, set_tree234(label))::in, set_tree234(label)::in,
+    io::di, io::uo) is det.
+
+output_instruction_list_while(_, _, [], [], _, _, !IO) :-
+    io.write_string("\tbreak;\n", !IO).
+output_instruction_list_while(Info, Label, [Instr | Instrs], AfterWhileInstrs,
+        ProfInfo, WhileSet, !IO) :-
     Instr = llds_instr(Uinstr, Comment),
     ( Uinstr = label(_) ->
-        io.write_string("\tbreak; } /* end while */\n", !IO),
-        output_instruction_list(Info, [Instr | Instrs],
-            ProfInfo, WhileSet, not_after_layout_label, !IO)
+        io.write_string("\tbreak;\n", !IO),
+        AfterWhileInstrs = [Instr | Instrs]
     ; Uinstr = goto(code_label(Label)) ->
-        io.write_string("\t/* continue */ } /* end while */\n", !IO),
-        output_instruction_list(Info, Instrs, ProfInfo, WhileSet,
-            not_after_layout_label, !IO)
+        io.write_string("\t/* continue */\n", !IO),
+        AfterWhileInstrs = Instrs
     ; Uinstr = if_val(Rval, code_label(Label)) ->
         io.write_string("\tif (", !IO),
         output_test_rval(Info, Rval, !IO),
@@ -312,19 +311,19 @@
         ;
             true
         ),
-        output_instruction_list_while(Info, Instrs, Label, ProfInfo,
-            WhileSet, !IO)
+        output_instruction_list_while(Info, Label, Instrs, AfterWhileInstrs,
+            ProfInfo, WhileSet, !IO)
     ; Uinstr = block(TempR, TempF, BlockInstrs) ->
         output_block_start(TempR, TempF, !IO),
         output_instruction_list_while_block(Info, BlockInstrs, Label,
             ProfInfo, !IO),
         output_block_end(!IO),
-        output_instruction_list_while(Info, Instrs, Label, ProfInfo,
-            WhileSet, !IO)
+        output_instruction_list_while(Info, Label, Instrs, AfterWhileInstrs,
+            ProfInfo, WhileSet, !IO)
     ;
         output_instruction_and_comment(Info, Uinstr, Comment, ProfInfo, !IO),
-        output_instruction_list_while(Info, Instrs, Label, ProfInfo,
-            WhileSet, !IO)
+        output_instruction_list_while(Info, Label, Instrs, AfterWhileInstrs,
+            ProfInfo, WhileSet, !IO)
     ).
 
 :- pred output_instruction_list_while_block(llds_out_info::in,
cvs diff: Diffing compiler/notes
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
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/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_allegro
cvs diff: Diffing extras/graphics/mercury_allegro/examples
cvs diff: Diffing extras/graphics/mercury_allegro/samples
cvs diff: Diffing extras/graphics/mercury_allegro/samples/demo
cvs diff: Diffing extras/graphics/mercury_allegro/samples/mandel
cvs diff: Diffing extras/graphics/mercury_allegro/samples/pendulum2
cvs diff: Diffing extras/graphics/mercury_allegro/samples/speed
cvs diff: Diffing extras/graphics/mercury_cairo
cvs diff: Diffing extras/graphics/mercury_cairo/samples
cvs diff: Diffing extras/graphics/mercury_cairo/samples/data
cvs diff: Diffing extras/graphics/mercury_cairo/tutorial
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/monte
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/posix/samples
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/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/appengine
cvs diff: Diffing samples/appengine/war
cvs diff: Diffing samples/appengine/war/WEB-INF
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/c_interface/standalone_c
cvs diff: Diffing samples/concurrency
cvs diff: Diffing samples/concurrency/dining_philosophers
cvs diff: Diffing samples/concurrency/midimon
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/java_interface
cvs diff: Diffing samples/java_interface/java_calls_mercury
cvs diff: Diffing samples/java_interface/mercury_calls_java
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/solver_types
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 ssdb
cvs diff: Diffing tests
cvs diff: Diffing tests/analysis
cvs diff: Diffing tests/analysis/ctgc
cvs diff: Diffing tests/analysis/excp
cvs diff: Diffing tests/analysis/ext
cvs diff: Diffing tests/analysis/sharing
cvs diff: Diffing tests/analysis/table
cvs diff: Diffing tests/analysis/trail
cvs diff: Diffing tests/analysis/unused_args
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/stm
cvs diff: Diffing tests/stm/orig
cvs diff: Diffing tests/stm/orig/stm-compiler
cvs diff: Diffing tests/stm/orig/stm-compiler/test1
cvs diff: Diffing tests/stm/orig/stm-compiler/test10
cvs diff: Diffing tests/stm/orig/stm-compiler/test2
cvs diff: Diffing tests/stm/orig/stm-compiler/test3
cvs diff: Diffing tests/stm/orig/stm-compiler/test4
cvs diff: Diffing tests/stm/orig/stm-compiler/test5
cvs diff: Diffing tests/stm/orig/stm-compiler/test6
cvs diff: Diffing tests/stm/orig/stm-compiler/test7
cvs diff: Diffing tests/stm/orig/stm-compiler/test8
cvs diff: Diffing tests/stm/orig/stm-compiler/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/bm2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/stmqueue
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test10
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test11
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par/test9
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test1
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test2
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test3
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test4
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test5
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test6
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test7
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test8
cvs diff: Diffing tests/stm/orig/stm-compiler-par-asm_fast/test9
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