[m-rev.] for review: implement region cleanup at model_non if-then-elses

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Sep 28 16:57:28 AEST 2007


This is for review by anyone, and for Quan to check whether the code
it generates is the right code.

Zoltan.

Implement (at least a first draft of) the handling of regions for
if-then-elses with model_non conditions.

The diff should have no effect outside rbmm grades.

compiler/code_info.m:
	Allow model_non disjunctions to clean up the embedded stack frame
	created for region operations.

	Fix some old documentation rot.

compiler/ite_gen.m:
	Get the information needed by code_info.m to it.

compiler/continuation_info.m:
	Add a slot kind needed by the new code.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/libatomic_ops-1.2
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/gcc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/hpc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ibmc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/icc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/msftc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/sunc
cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing boehm_gc/windows-untested
cvs diff: Diffing boehm_gc/windows-untested/vc60
cvs diff: Diffing boehm_gc/windows-untested/vc70
cvs diff: Diffing boehm_gc/windows-untested/vc71
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.349
diff -u -b -r1.349 code_info.m
--- compiler/code_info.m	7 Aug 2007 07:09:47 -0000	1.349
+++ compiler/code_info.m	28 Sep 2007 06:11:16 -0000
@@ -61,6 +61,7 @@
 :- implementation.
 
 :- import_module backend_libs.proc_label.
+:- import_module backend_libs.builtin_ops.
 :- import_module check_hlds.type_util.
 :- import_module hlds.arg_info.
 :- import_module hlds.hlds_code_util.
@@ -1296,8 +1297,11 @@
     % slot of the top frame to point to this frame. Our caller
     % will then override the redoip slot to point to the start of
     % the else part before generating the code of the condition.
+    % The maybe(lval) argument, if set to `yes', specifies the slot
+    % holding the success record to use in deciding whether to execute
+    % a region_ite_nondet_cond_fail operation at the start of the else branch.
     %
-    % `ite_enter_then', which should be called generating code for
+    % `ite_enter_then', which should be called after generating code for
     % the condition, sets up the failure state of the code generator
     % for generating the then-part, and returns the code sequences
     % to be used at the starts of the then-part and the else-part
@@ -1305,10 +1309,11 @@
     %
 :- type ite_hijack_info.
 
-:- pred prepare_for_ite_hijack(code_model::in, ite_hijack_info::out,
-    code_tree::out, code_info::in, code_info::out) is det.
+:- pred prepare_for_ite_hijack(code_model::in,
+    maybe(embedded_stack_frame_id)::in, ite_hijack_info::out, code_tree::out,
+    code_info::in, code_info::out) is det.
 
-:- pred ite_enter_then(ite_hijack_info::in,
+:- pred ite_enter_then(ite_hijack_info::in, resume_point_info::in,
     code_tree::out, code_tree::out, code_info::in, code_info::out) is det.
 
     % `enter_simple_neg' and `leave_simple_neg' should be called before
@@ -1317,8 +1322,7 @@
     % specially, because it occurs frequently and should not require
     % a flushing of the expression cache, whereas the general way of
     % handling negations does require a flush. These two predicates
-    % handle all aspects of the negation except for the unification
-    % itself.
+    % handle all aspects of the negation except for the unification itself.
     %
 :- type simple_neg_info.
 
@@ -1330,7 +1334,7 @@
 
     % `prepare_for_det_commit' and `generate_det_commit' should be
     % called before and after generating the code for the multi goal
-    % being cut across. If the goal succeeds, the commit will cut
+    % being cut across. If the goal succeeds, the commit will cut away
     % any choice points generated in the goal.
     %
     % The set(prog_var) should be the set of variables live before
@@ -1470,8 +1474,9 @@
     % in the positions expected by the label.
     %
     % The only time when a code_addr in a resume_point info is not a label
-    % is when the code_addr is do_fail, which indicates that the resumption
-    % point is not in (this invocation of) this procedure.
+    % is when the code_addr is do_redo or do_fail, which indicate that
+    % the resumption point is either unknown or not in (this invocation of)
+    % this procedure.
     %
 :- type resume_point_info
     --->    orig_only(resume_map, code_addr)
@@ -1654,11 +1659,23 @@
 
 %---------------------------------------------------------------------------%
 
+    % For model_non if-then-elses, we need to clean up the embedded stack frame
+    % we create for the if-then-else when the condition fails after succeeding.
+    % For such if-then-elses, we record the id of the embedded frame we need to
+    % clean up, and the id of the slot that is initialized to false, and set to
+    % true each time the condition succeeds.
+:- type ite_region_info
+    --->    ite_region_info(
+                embedded_stack_frame_id,
+                lval
+            ).
+
 :- type ite_hijack_info
     --->    ite_info(
                 resume_point_known,
                 condition_env,
-                ite_hijack_type
+                ite_hijack_type,
+                maybe(ite_region_info)
             ).
 
 :- type ite_hijack_type
@@ -1681,18 +1698,29 @@
                             % the value of maxfr.
             ).
 
-prepare_for_ite_hijack(EffCodeModel, HijackInfo, Code, !CI) :-
+prepare_for_ite_hijack(EffCodeModel, MaybeEmbeddedFrameId, HijackInfo, Code,
+        !CI) :-
     get_fail_info(!.CI, FailInfo),
     FailInfo = fail_info(_, ResumeKnown, CurfrMaxfr, CondEnv, Allow),
     (
-        EffCodeModel \= model_non
-    ->
+        EffCodeModel = model_det,
+        unexpected(this_file, "prepare_for_ite_hijack: model_det")
+    ;
+        EffCodeModel = model_semi,
+        expect(unify(MaybeEmbeddedFrameId, no), this_file,
+            "prepare_for_ite_hijack: MaybeEmbeddedFrameId in model_semi"),
         HijackType = ite_no_hijack,
         Code = node([
             llds_instr(comment("ite no hijack"), "")
-        ])
+        ]),
+        MaybeRegionInfo = no
     ;
-        ( Allow = not_allowed ; CondEnv = inside_non_condition )
+        EffCodeModel = model_non,
+        (
+            ( Allow = not_allowed
+            ; CondEnv = inside_non_condition
+            ; MaybeEmbeddedFrameId = yes(_)
+            )
     ->
         acquire_temp_slot(slot_lval(maxfr), non_persistent_temp_slot,
             MaxfrSlot, !CI),
@@ -1701,64 +1729,95 @@
         MaxfrCode = node([
             llds_instr(assign(MaxfrSlot, lval(maxfr)), "prepare for ite")
         ]),
-        Code = tree(TempFrameCode, MaxfrCode)
+            (
+                MaybeEmbeddedFrameId = yes(EmbeddedFrameId),
+                % Note that this slot is intentionally not released anywhere.
+                acquire_temp_slot(slot_success_record, persistent_temp_slot,
+                    SuccessRecordSlot, !CI),
+                InitSuccessCode = node([
+                    llds_instr(
+                        assign(SuccessRecordSlot, const(llconst_false)),
+                        "record no success of the condition yes")
+                ]),
+                MaybeRegionInfo =
+                    yes(ite_region_info(EmbeddedFrameId, SuccessRecordSlot))
+            ;
+                MaybeEmbeddedFrameId = no,
+                InitSuccessCode = empty,
+                MaybeRegionInfo = no
+            ),
+            Code = tree_list([
+                TempFrameCode,
+                MaxfrCode,
+                InitSuccessCode
+            ])
     ;
+            (
         CurfrMaxfr = must_be_equal,
-        ResumeKnown = resume_point_known(_)
-    ->
+                (
+                    ResumeKnown = resume_point_known(_),
         HijackType = ite_quarter_hijack,
         Code = node([
             llds_instr(comment("ite quarter hijack"), "")
         ])
     ;
-        CurfrMaxfr = must_be_equal
-    ->
-        % Here ResumeKnown must be resume_point_unknown.
+                    ResumeKnown = resume_point_unknown,
         acquire_temp_slot(slot_lval(redoip_slot(lval(curfr))),
             non_persistent_temp_slot, RedoipSlot, !CI),
         HijackType = ite_half_hijack(RedoipSlot),
         Code = node([
-            llds_instr(assign(RedoipSlot, lval(redoip_slot(lval(curfr)))),
+                        llds_instr(
+                            assign(RedoipSlot, lval(redoip_slot(lval(curfr)))),
                 "prepare for half ite hijack")
         ])
+                )
     ;
-        % Here CurfrMaxfr must be may_be_different.
+                CurfrMaxfr = may_be_different,
         acquire_temp_slot(slot_lval(redoip_slot(lval(maxfr))),
             non_persistent_temp_slot, RedoipSlot, !CI),
         acquire_temp_slot(slot_lval(redofr_slot(lval(maxfr))),
             non_persistent_temp_slot, RedofrSlot, !CI),
         acquire_temp_slot(slot_lval(maxfr),
             non_persistent_temp_slot, MaxfrSlot, !CI),
-        HijackType = ite_full_hijack(RedoipSlot, RedofrSlot, MaxfrSlot),
+                HijackType = ite_full_hijack(RedoipSlot, RedofrSlot,
+                    MaxfrSlot),
         Code = node([
-            llds_instr(assign(MaxfrSlot, lval(maxfr)),
+                    llds_instr(
+                        assign(MaxfrSlot, lval(maxfr)),
                 "prepare for full ite hijack"),
-            llds_instr(assign(RedoipSlot, lval(redoip_slot(lval(maxfr)))),
+                    llds_instr(
+                        assign(RedoipSlot, lval(redoip_slot(lval(maxfr)))),
                 "prepare for full ite hijack"),
-            llds_instr(assign(RedofrSlot, lval(redofr_slot(lval(maxfr)))),
+                    llds_instr(
+                        assign(RedofrSlot, lval(redofr_slot(lval(maxfr)))),
                 "prepare for full ite hijack"),
-            llds_instr(assign(redofr_slot(lval(maxfr)), lval(curfr)),
+                    llds_instr(
+                        assign(redofr_slot(lval(maxfr)), lval(curfr)),
                 "prepare for full ite hijack")
         ])
     ),
-    HijackInfo = ite_info(ResumeKnown, CondEnv, HijackType),
-    ( EffCodeModel = model_non ->
+            MaybeRegionInfo = no
+        ),
         inside_non_condition(!CI)
-    ;
-        true
-    ).
+    ),
+    HijackInfo = ite_info(ResumeKnown, CondEnv, HijackType, MaybeRegionInfo).
 
-ite_enter_then(HijackInfo, ThenCode, ElseCode, !CI) :-
+ite_enter_then(HijackInfo, ITEResumePoint, ThenCode, ElseCode, !CI) :-
     get_fail_info(!.CI, FailInfo0),
     FailInfo0 = fail_info(ResumePoints0, ResumeKnown0, CurfrMaxfr, _, Allow),
     stack.pop_det(ResumePoints0, _, ResumePoints),
-    HijackInfo = ite_info(HijackResumeKnown, OldCondEnv, HijackType),
+    HijackInfo = ite_info(HijackResumeKnown, OldCondEnv, HijackType, 
+        MaybeRegionInfo),
     (
         HijackType = ite_no_hijack,
+        expect(unify(MaybeRegionInfo, no), this_file,
+            "ite_enter_then: MaybeRegionInfo ite_no_hijack"),
         ThenCode = empty,
-        ElseCode = ThenCode
+        ElseCode = empty
     ;
         HijackType = ite_temp_frame(MaxfrSlot),
+        (
+            MaybeRegionInfo = no,
         ThenCode = node([
             % We can't remove the frame, it may not be on top.
             llds_instr(assign(redoip_slot(lval(MaxfrSlot)),
@@ -1771,7 +1830,38 @@
                 "restore maxfr for temp frame ite")
         ])
     ;
+            MaybeRegionInfo = yes(RegionInfo),
+            RegionInfo = ite_region_info(EmbeddedStackFrameId,
+                SuccessRecordSlot),
+            % XXX replace do_fail with ref to ResumePoint stack label
+            resume_point_stack_addr(ITEResumePoint, ITEStackResumeCodeAddr),
+            ThenCode = node([
+                llds_instr(assign(SuccessRecordSlot, const(llconst_true)),
+                    "record success of the condition"),
+                llds_instr(assign(redoip_slot(lval(MaxfrSlot)),
+                    const(llconst_code_addr(ITEStackResumeCodeAddr))),
+                    "redirect to cut for temp frame ite")
+            ]),
+            get_next_label(AfterRegionOp, !CI),
+            ElseCode = node([
+                llds_instr(assign(maxfr, lval(prevfr_slot(lval(MaxfrSlot)))),
+                    "restore maxfr for temp frame ite"),
+                llds_instr(if_val(unop(logical_not, lval(SuccessRecordSlot)),
+                    code_label(AfterRegionOp)),
+                    "jump around if the condition never succeeded"),
+                llds_instr(use_and_maybe_pop_region_frame(
+                    region_ite_nondet_cond_fail, EmbeddedStackFrameId),
+                    "cleanup after the post-success failure of the condition"),
+                llds_instr(goto(do_fail),
+                    "the condition succeeded, so don't execute else branch"),
+                llds_instr(label(AfterRegionOp),
+                    "after region op")
+            ])
+        )
+    ;
         HijackType = ite_quarter_hijack,
+        expect(unify(MaybeRegionInfo, no), this_file,
+            "ite_enter_then: MaybeRegionInfo ite_quarter_hijack"),
         stack.top_det(ResumePoints, ResumePoint),
         ( maybe_pick_stack_resume_point(ResumePoint, _, StackLabel) ->
             LabelConst = const(llconst_code_addr(StackLabel)),
@@ -1786,6 +1876,8 @@
         ElseCode = ThenCode
     ;
         HijackType = ite_half_hijack(RedoipSlot),
+        expect(unify(MaybeRegionInfo, no), this_file,
+            "ite_enter_then: MaybeRegionInfo ite_half_hijack"),
         ThenCode = node([
             llds_instr(assign(redoip_slot(lval(curfr)), lval(RedoipSlot)),
                 "restore redoip for half ite hijack")
@@ -1793,6 +1885,8 @@
         ElseCode = ThenCode
     ;
         HijackType = ite_full_hijack(RedoipSlot, RedofrSlot, MaxfrSlot),
+        expect(unify(MaybeRegionInfo, no), this_file,
+            "ite_enter_then: MaybeRegionInfo ite_full_hijack"),
         ThenCode = node([
             llds_instr(assign(redoip_slot(lval(MaxfrSlot)), lval(RedoipSlot)),
                 "restore redoip for full ite hijack"),
Index: compiler/continuation_info.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/continuation_info.m,v
retrieving revision 1.91
diff -u -b -r1.91 continuation_info.m
--- compiler/continuation_info.m	12 Sep 2007 06:21:06 -0000	1.91
+++ compiler/continuation_info.m	27 Sep 2007 08:03:15 -0000
@@ -339,6 +339,8 @@
     ;       slot_region_ite
     ;       slot_region_disj
     ;       slot_region_commit
+    ;       slot_success_record     % A record of whether a piece of code
+                                    % has ever succeeded.
     ;       slot_lval(lval).
 
     % Call maybe_process_proc_llds on the code of every procedure in the list.
@@ -925,6 +927,7 @@
 live_value_type(slot_lval(framevar(_)), live_value_unwanted).
 live_value_type(slot_lval(mem_ref(_)), live_value_unwanted). % XXX
 live_value_type(slot_lval(global_var_ref(_)), live_value_unwanted).
+live_value_type(slot_success_record, live_value_unwanted).
 live_value_type(slot_ticket, live_value_unwanted).
     % XXX we may need to modify this, if the GC is going to garbage-collect
     % the trail.
Index: compiler/ite_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ite_gen.m,v
retrieving revision 1.101
diff -u -b -r1.101 ite_gen.m
--- compiler/ite_gen.m	27 Sep 2007 10:42:05 -0000	1.101
+++ compiler/ite_gen.m	28 Sep 2007 05:30:20 -0000
@@ -145,11 +145,13 @@
     IteRegionOps = AddRegionOps,
     goal_to_conj_list(ElseGoal, ElseGoals),
     maybe_create_ite_region_frame(IteRegionOps, CondInfo, ElseGoals,
-        RegionCondCode, RegionThenCode, RegionElseCode, RegionStackVars, !CI),
+        RegionCondCode, RegionThenCode, RegionElseCode, RegionStackVars,
+        MaybeEmbeddedStackFrameId, !CI),
 
     remember_position(!.CI, BranchStart),
 
-    prepare_for_ite_hijack(EffCodeModel, HijackInfo, PrepareHijackCode, !CI),
+    prepare_for_ite_hijack(CondCodeModel, MaybeEmbeddedStackFrameId,
+        HijackInfo, PrepareHijackCode, !CI),
 
     make_resume_point(ResumeVars, ResumeLocs, ResumeMap, ResumePoint, !CI),
     effect_resume_point(ResumePoint, EffCodeModel, EffectResumeCode, !CI),
@@ -159,7 +161,7 @@
         !CI),
     generate_goal(CondCodeModel, CondGoal, CondCode, !CI),
 
-    ite_enter_then(HijackInfo, ThenNeckCode, ElseNeckCode, !CI),
+    ite_enter_then(HijackInfo, ResumePoint, ThenNeckCode, ElseNeckCode, !CI),
 
     % Kill again any variables that have become zombies.
     pickup_zombies(Zombies, !CI),
@@ -364,9 +366,15 @@
     IteRegionOps = AddRegionOps,
     Goal = hlds_goal(_, GoalInfo),
     maybe_create_ite_region_frame(IteRegionOps, GoalInfo, [],
-        RegionCondCode, RegionThenCode, RegionElseCode, RegionStackVars, !CI),
+        RegionCondCode, RegionThenCode, RegionElseCode, RegionStackVars,
+        MaybeRegionSuccRecordSlot, !CI),
+    % MaybeRegionSuccRecordSlot should be yes only for nondet conditions,
+    % and a negated goal can't be nondet.
+    expect(unify(MaybeRegionSuccRecordSlot, no), this_file,
+        "generate_negation_general: MaybeRegionSuccRecordSlot = yes(_)"),
 
-    prepare_for_ite_hijack(CodeModel, HijackInfo, PrepareHijackCode, !CI),
+    prepare_for_ite_hijack(CodeModel, MaybeRegionSuccRecordSlot, HijackInfo,
+        PrepareHijackCode, !CI),
 
     make_resume_point(ResumeVars, ResumeLocs, ResumeMap, ResumePoint, !CI),
     effect_resume_point(ResumePoint, CodeModel, EffectResumeCode, !CI),
@@ -376,7 +384,7 @@
     maybe_generate_internal_event_code(Goal, NotGoalInfo, EnterTraceCode, !CI),
     code_gen.generate_goal(model_semi, Goal, GoalCode, !CI),
 
-    ite_enter_then(HijackInfo, ThenNeckCode, ElseNeckCode, !CI),
+    ite_enter_then(HijackInfo, ResumePoint, ThenNeckCode, ElseNeckCode, !CI),
 
     % Kill again any variables that have become zombies.
     pickup_zombies(Zombies, !CI),
@@ -534,16 +542,18 @@
 :- pred maybe_create_ite_region_frame(add_region_ops::in,
     hlds_goal_info::in, list(hlds_goal)::in,
     code_tree::out, code_tree::out, code_tree::out, list(lval)::out,
-    code_info::in, code_info::out) is det.
+    maybe(embedded_stack_frame_id)::out, code_info::in, code_info::out) is det.
 
 maybe_create_ite_region_frame(IteRegionOps, CondGoalInfo, ElseGoals,
-        CondCode, ThenCode, ElseCode, StackVars, !CI) :-
+        CondCode, ThenCode, ElseCode, StackVars, MaybeEmbeddedStackFrameId,
+        !CI) :-
     (
         IteRegionOps = do_not_add_region_ops,
         CondCode = empty,
         ThenCode = empty,
         ElseCode = empty,
-        StackVars = []
+        StackVars = [],
+        MaybeEmbeddedStackFrameId = no
     ;
         IteRegionOps = add_region_ops,
         get_forward_live_vars(!.CI, ForwardLiveVars),
@@ -607,16 +617,16 @@
         Items = list.duplicate(FrameSize, slot_region_ite),
         acquire_several_temp_slots(Items, non_persistent_temp_slot,
             StackVars, MainStackId, FirstSlotNum, LastSlotNum, !CI),
-        EmbeddedStackFrame = embedded_stack_frame_id(MainStackId,
+        EmbeddedStackFrameId = embedded_stack_frame_id(MainStackId,
             FirstSlotNum, LastSlotNum),
         FirstNonFixedAddr =
-            first_nonfixed_embedded_slot_addr(EmbeddedStackFrame, FixedSize),
+            first_nonfixed_embedded_slot_addr(EmbeddedStackFrameId, FixedSize),
         acquire_reg(reg_r, ProtectNumRegLval, !CI),
         acquire_reg(reg_r, SnapshotNumRegLval, !CI),
         acquire_reg(reg_r, AddrRegLval, !CI),
         PushInitCode = node([
             llds_instr(
-                push_region_frame(region_stack_ite, EmbeddedStackFrame),
+                push_region_frame(region_stack_ite, EmbeddedStackFrameId),
                 "Save stack pointer of embedded region ite stack"),
             llds_instr(
                 assign(ProtectNumRegLval, const(llconst_int(0))),
@@ -629,18 +639,19 @@
                 "Initialize pointer to nonfixed part of embedded frame")
         ]),
         ite_protect_regions(ProtectNumRegLval, AddrRegLval,
-            EmbeddedStackFrame, ProtectRegionVarList, ProtectRegionCode, !CI),
+            EmbeddedStackFrameId, ProtectRegionVarList, ProtectRegionCode,
+            !CI),
         ite_alloc_snapshot_regions(SnapshotNumRegLval, AddrRegLval,
-            EmbeddedStackFrame, RemovedAtStartOfElse, SnapshotRegionVarList,
+            EmbeddedStackFrameId, RemovedAtStartOfElse, SnapshotRegionVarList,
             SnapshotRegionCode, !CI),
         SetCode = node([
             llds_instr(
                 region_set_fixed_slot(region_set_ite_num_protects,
-                    EmbeddedStackFrame, lval(ProtectNumRegLval)),
+                    EmbeddedStackFrameId, lval(ProtectNumRegLval)),
                 "Store the number of protect_infos"),
             llds_instr(
                 region_set_fixed_slot(region_set_ite_num_snapshots,
-                    EmbeddedStackFrame, lval(SnapshotNumRegLval)),
+                    EmbeddedStackFrameId, lval(SnapshotNumRegLval)),
                 "Store the number of snapshot_infos")
         ]),
         release_reg(ProtectNumRegLval, !CI),
@@ -650,10 +661,12 @@
         CondCodeModel = goal_info_get_code_model(CondGoalInfo),
         (
             CondCodeModel = model_non,
-            CondKind = region_ite_nondet_cond
+            CondKind = region_ite_nondet_cond,
+            MaybeEmbeddedStackFrameId = yes(EmbeddedStackFrameId)
         ;
             CondCodeModel = model_semi,
-            CondKind = region_ite_semidet_cond
+            CondKind = region_ite_semidet_cond,
+            MaybeEmbeddedStackFrameId = no
         ;
             CondCodeModel = model_det,
             unexpected(this_file, "maybe_create_ite_region_frame: det cond")
@@ -668,13 +681,13 @@
         ThenCode = node([
             llds_instr(
                 use_and_maybe_pop_region_frame(region_ite_then(CondKind),
-                    EmbeddedStackFrame),
+                    EmbeddedStackFrameId),
                 "region enter then")
         ]),
         ElseCode = node([
             llds_instr(
                 use_and_maybe_pop_region_frame(region_ite_else(CondKind),
-                    EmbeddedStackFrame),
+                    EmbeddedStackFrameId),
                 "region enter else")
         ])
 
@@ -712,17 +725,17 @@
     list(prog_var)::in, code_tree::out, code_info::in, code_info::out) is det.
 
 ite_protect_regions(_, _, _, [], empty, !CI).
-ite_protect_regions(NumLval, AddrLval, EmbeddedStackFrame,
+ite_protect_regions(NumLval, AddrLval, EmbeddedStackFrameId,
         [RegionVar | RegionVars], tree(Code, Codes), !CI) :-
     produce_variable(RegionVar, ProduceVarCode, RegionVarRval, !CI),
     SaveCode = node([
         llds_instr(
             region_fill_frame(region_fill_ite_protect,
-                EmbeddedStackFrame, RegionVarRval, NumLval, AddrLval),
+                EmbeddedStackFrameId, RegionVarRval, NumLval, AddrLval),
             "ite protect the region if needed")
     ]),
     Code = tree(ProduceVarCode, SaveCode),
-    ite_protect_regions(NumLval, AddrLval, EmbeddedStackFrame,
+    ite_protect_regions(NumLval, AddrLval, EmbeddedStackFrameId,
         RegionVars, Codes, !CI).
 
 :- pred ite_alloc_snapshot_regions(lval::in, lval::in,
@@ -730,7 +743,7 @@
     list(prog_var)::in, code_tree::out, code_info::in, code_info::out) is det.
 
 ite_alloc_snapshot_regions(_, _, _, _, [], empty, !CI).
-ite_alloc_snapshot_regions(NumLval, AddrLval, EmbeddedStackFrame,
+ite_alloc_snapshot_regions(NumLval, AddrLval, EmbeddedStackFrameId,
         RemovedVars, [RegionVar | RegionVars], tree(Code, Codes), !CI) :-
     produce_variable(RegionVar, ProduceVarCode, RegionVarRval, !CI),
     ( set.member(RegionVar, RemovedVars) ->
@@ -741,11 +754,11 @@
     SaveCode = node([
         llds_instr(
             region_fill_frame(region_fill_ite_snapshot(RemovedAtStartOfElse),
-                EmbeddedStackFrame, RegionVarRval, NumLval, AddrLval),
+                EmbeddedStackFrameId, RegionVarRval, NumLval, AddrLval),
             "take alloc snapshot of the region")
     ]),
     Code = tree(ProduceVarCode, SaveCode),
-    ite_alloc_snapshot_regions(NumLval, AddrLval, EmbeddedStackFrame,
+    ite_alloc_snapshot_regions(NumLval, AddrLval, EmbeddedStackFrameId,
         RemovedVars, RegionVars, Codes, !CI).
 
 %-----------------------------------------------------------------------------%
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/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_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_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/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/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/diff
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 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