[m-dev.] diff: more trailing changes
Fergus Henderson
fjh at cs.mu.oz.au
Mon Aug 25 15:59:09 AEST 1997
Peter Schachte, you wrote:
> On Sun, 24 Aug 1997, Fergus Henderson wrote:
>
> > Peter Schachte, can you please review this one?
>
> Sure. Where's the diff?
Oops. I've attached it below.
> > Change the generated code for trailing to match the new trailing interface.
> >
> > compiler/code_gen.m:
> > When generating code for negations, ensure that we generate a
> > discard_ticket instruction to discard the current ticket before
> > failing.
> >
> > compiler/llds.m:
> > compiler/llds_out.m:
> > compiler/code_info.m:
> > Change the `restore_ticket(Rval)' instruction to
> > `reset_ticket(Rval, Reason)', where Reason is one of
> > undo, commit, exception, or gc, as per runtime/mercury_trail.h.
> > A reset with Reason = undo gives the old "restore" behaviour.
> >
> > compiler/frameopt.m:
> > compiler/livemap.m:
> > compiler/llds_common.m:
> > compiler/middle_rec.m:
> > compiler/opt_*.m:
> > compiler/peephole.m:
> > compiler/value_number.m:
> > compiler/vn_*.m:
> > Trivial changes to handle reset_ticket/2 instead of restore_ticket/1.
> >
> > compiler/code_gen.m:
> > compiler/ite_gen.m:
> > compiler/disj_gen.m:
> > Change the places that called code_gen__maybe_discard_ticket
> > to instead call code_gen__maybe_reset_and_discard_ticket(...commit...).
Index: compiler/code_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_gen.m,v
retrieving revision 1.31
diff -u -r1.31 code_gen.m
--- code_gen.m 1997/08/23 13:10:42 1.31
+++ code_gen.m 1997/08/24 00:31:05
@@ -955,26 +955,31 @@
code_gen__generate_goal(model_semi, Goal, GoalCode),
( { CodeModel = model_det } ->
+ { DiscardTicketCode = empty },
{ FailCode = empty }
;
code_info__grab_code_info(CodeInfo),
code_info__pop_failure_cont,
+ % Is this necessary? Must we reset things each step
+ % of the way, or can we just reset at the end?
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot,
+ commit, DiscardTicketCode),
code_info__generate_failure(FailCode),
code_info__slap_code_info(CodeInfo)
),
code_info__restore_failure_cont(RestoreContCode),
- code_info__maybe_restore_and_discard_ticket(MaybeTicketSlot,
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot, undo,
RestoreTicketCode),
code_info__maybe_restore_and_discard_hp(MaybeHpSlot, RestoreHpCode),
{ Code = tree(ModContCode,
tree(SaveHpCode,
tree(SaveTicketCode,
tree(GoalCode,
- % XXX don't we need `DiscardTicketCode' here?
+ tree(DiscardTicketCode, % is this necessary?
tree(FailCode,
tree(RestoreContCode,
tree(RestoreTicketCode,
- RestoreHpCode))))))) }.
+ RestoreHpCode)))))))) }.
%---------------------------------------------------------------------------%
%---------------------------------------------------------------------------%
Index: compiler/code_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/code_info.m,v
retrieving revision 1.208
diff -u -r1.208 code_info.m
--- code_info.m 1997/08/23 20:33:07 1.208
+++ code_info.m 1997/08/24 00:09:44
@@ -17,7 +17,7 @@
% - simple wrappers around access predicates
% - handling failure continuations
% - handling liveness issues
-% - saving and restoring heap pointers, tickets etc
+% - saving and restoring heap pointers, trail tickets etc
% - interfacing to code_exprn
% - managing the info required by garbage collection and value numbering
% - managing stack slots
@@ -2152,7 +2152,7 @@
%---------------------------------------------------------------------------%
% Submodule for handling the saving and restoration
- % of tickets, heap pointers, stack pointers etc.
+ % of trail tickets, heap pointers, stack pointers etc.
:- interface.
@@ -2187,12 +2187,13 @@
:- pred code_info__save_ticket(code_tree, lval, code_info, code_info).
:- mode code_info__save_ticket(out, out, in, out) is det.
-:- pred code_info__restore_ticket(lval, code_tree, code_info, code_info).
-:- mode code_info__restore_ticket(in, out, in, out) is det.
+:- pred code_info__reset_ticket(lval, reset_trail_reason, code_tree,
+ code_info, code_info).
+:- mode code_info__reset_ticket(in, in, out, in, out) is det.
-:- pred code_info__restore_and_discard_ticket(lval, code_tree,
+:- pred code_info__reset_and_discard_ticket(lval, reset_trail_reason, code_tree,
code_info, code_info).
-:- mode code_info__restore_and_discard_ticket(in, out, in, out) is det.
+:- mode code_info__reset_and_discard_ticket(in, in, out, in, out) is det.
:- pred code_info__discard_ticket(lval, code_tree, code_info, code_info).
:- mode code_info__discard_ticket(in, out, in, out) is det.
@@ -2201,13 +2202,13 @@
code_info, code_info).
:- mode code_info__maybe_save_ticket(in, out, out, in, out) is det.
-:- pred code_info__maybe_restore_ticket(maybe(lval), code_tree,
- code_info, code_info).
-:- mode code_info__maybe_restore_ticket(in, out, in, out) is det.
+:- pred code_info__maybe_reset_ticket(maybe(lval), reset_trail_reason,
+ code_tree, code_info, code_info).
+:- mode code_info__maybe_reset_ticket(in, in, out, in, out) is det.
-:- pred code_info__maybe_restore_and_discard_ticket(maybe(lval), code_tree,
- code_info, code_info).
-:- mode code_info__maybe_restore_and_discard_ticket(in, out, in, out) is det.
+:- pred code_info__maybe_reset_and_discard_ticket(maybe(lval),
+ reset_trail_reason, code_tree, code_info, code_info).
+:- mode code_info__maybe_reset_and_discard_ticket(in, in, out, in, out) is det.
:- pred code_info__maybe_discard_ticket(maybe(lval), code_tree,
code_info, code_info).
@@ -2264,19 +2265,17 @@
[]
).
-% ZZZ
-
code_info__save_ticket(Code, TicketSlot) -->
code_info__acquire_temp_slot(ticket, TicketSlot),
- { Code = node([store_ticket(TicketSlot) - "Save solver state"]) }.
+ { Code = node([store_ticket(TicketSlot) - "Save trail state"]) }.
-code_info__restore_ticket(TicketSlot, Code) -->
- { Code = node([restore_ticket(lval(TicketSlot)) - "Restore solver state"]) }.
+code_info__reset_ticket(TicketSlot, Reason, Code) -->
+ { Code = node([reset_ticket(lval(TicketSlot), Reason) - "Reset trail"]) }.
-code_info__restore_and_discard_ticket(TicketSlot, Code) -->
+code_info__reset_and_discard_ticket(TicketSlot, Reason, Code) -->
code_info__release_temp_slot(TicketSlot),
{ Code = node([
- restore_ticket(lval(TicketSlot)) - "Restore solver state",
+ reset_ticket(lval(TicketSlot), Reason) - "Restore trail",
discard_ticket - "Pop ticket stack"
]) }.
@@ -2293,16 +2292,16 @@
{ MaybeTicketSlot = no }
).
-code_info__maybe_restore_ticket(MaybeTicketSlot, Code) -->
+code_info__maybe_reset_ticket(MaybeTicketSlot, Reason, Code) -->
( { MaybeTicketSlot = yes(TicketSlot) } ->
- code_info__restore_ticket(TicketSlot, Code)
+ code_info__reset_ticket(TicketSlot, Reason, Code)
;
{ Code = empty }
).
-code_info__maybe_restore_and_discard_ticket(MaybeTicketSlot, Code) -->
+code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot, Reason, Code) -->
( { MaybeTicketSlot = yes(TicketSlot) } ->
- code_info__restore_and_discard_ticket(TicketSlot, Code)
+ code_info__reset_and_discard_ticket(TicketSlot, Reason, Code)
;
{ Code = empty }
).
Index: compiler/disj_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/disj_gen.m,v
retrieving revision 1.57
diff -u -r1.57 disj_gen.m
--- disj_gen.m 1997/08/23 13:10:44 1.57
+++ disj_gen.m 1997/08/23 23:17:30
@@ -137,7 +137,7 @@
RestoreHPCode),
% Reset the solver state if necessary
- code_info__maybe_restore_ticket(MaybeTicketSlot,
+ code_info__maybe_reset_ticket(MaybeTicketSlot, undo,
RestoreTicketCode)
;
{ RestoreHPCode = empty },
@@ -199,8 +199,8 @@
RestoreHPCode),
% Restore the solver state if necessary
- code_info__maybe_restore_and_discard_ticket(MaybeTicketSlot,
- RestorePopTicketCode),
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot,
+ undo, RestorePopTicketCode),
% Generate the goal
code_gen__generate_goal(CodeModel, Goal0, GoalCode),
@@ -299,7 +299,7 @@
RestoreHPCode),
% Reset the solver state if necessary
- code_info__maybe_restore_ticket(MaybeTicketSlot,
+ code_info__maybe_reset_ticket(MaybeTicketSlot, undo,
RestoreTicketCode)
;
{ RestoreHPCode = empty },
@@ -354,8 +354,8 @@
RestoreHPCode),
% Restore the solver state if necessary
- code_info__maybe_restore_and_discard_ticket(MaybeTicketSlot,
- RestorePopTicketCode),
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot,
+ undo, RestorePopTicketCode),
code_gen__generate_goal(model_non, Goal0, GoalCode),
code_info__generate_branch_end(model_non, StoreMap, SaveCode),
Index: compiler/frameopt.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/frameopt.m,v
retrieving revision 1.61
diff -u -r1.61 frameopt.m
--- frameopt.m 1997/07/27 15:00:20 1.61
+++ frameopt.m 1997/08/23 23:18:46
@@ -681,7 +681,7 @@
possible_targets(mark_hp(_), []).
possible_targets(restore_hp(_), []).
possible_targets(store_ticket(_), []).
-possible_targets(restore_ticket(_), []).
+possible_targets(reset_ticket(_, _), []).
possible_targets(discard_ticket, []).
possible_targets(incr_sp(_, _), []).
possible_targets(decr_sp(_), []).
@@ -1291,7 +1291,7 @@
substitute_labels_instr(mark_hp(Lval), _, mark_hp(Lval)).
substitute_labels_instr(restore_hp(Rval), _, restore_hp(Rval)).
substitute_labels_instr(store_ticket(Lval), _, store_ticket(Lval)).
-substitute_labels_instr(restore_ticket(Rval), _, restore_ticket(Rval)).
+substitute_labels_instr(reset_ticket(Rval, Rsn), _, reset_ticket(Rval, Rsn)).
substitute_labels_instr(discard_ticket, _, discard_ticket).
substitute_labels_instr(incr_sp(Size, Name), _, incr_sp(Size, Name)).
substitute_labels_instr(decr_sp(Size), _, decr_sp(Size)).
Index: compiler/ite_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/ite_gen.m,v
retrieving revision 1.45
diff -u -r1.45 ite_gen.m
--- ite_gen.m 1997/08/23 13:10:45 1.45
+++ ite_gen.m 1997/08/23 23:24:15
@@ -109,8 +109,9 @@
code_info__pop_failure_cont,
- % Discard hp and solver ticket if the condition succeeded
- code_info__maybe_discard_ticket(MaybeTicketSlot, DiscardTicketCode),
+ % Discard hp and trail ticket if the condition succeeded
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot, commit,
+ DiscardTicketCode),
code_info__maybe_discard_hp(MaybeHpSlot),
% Generate the then branch
@@ -120,7 +121,7 @@
% Generate the entry to the else branch
code_info__slap_code_info(CodeInfo),
code_info__restore_failure_cont(RestoreContCode),
- code_info__maybe_restore_and_discard_ticket(MaybeTicketSlot,
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot, undo,
RestoreTicketCode),
code_info__maybe_restore_and_discard_hp(MaybeHpSlot, RestoreHPCode),
@@ -234,18 +235,18 @@
code_info__pickup_zombies(Zombies),
code_info__make_vars_forward_dead(Zombies),
- % Discard hp and maybe solver ticket if the condition succeeded
+ % Discard hp and maybe trail ticket if the condition succeeded
code_info__maybe_discard_hp(MaybeHpSlot),
( { NondetCond = yes } ->
- % We cannot discard the solver ticket if the
+ % We cannot discard the trail ticket if the
% condition can be backtracked into.
% code_info__maybe_pop_stack(MaybeTicketSlot, DiscardTicketCode)
{ DiscardTicketCode = empty }
;
- % Discard the solver ticket if the condition succeeded
+ % Discard the trail ticket if the condition succeeded
% and we will not backtrack into the condition
- code_info__maybe_discard_ticket(MaybeTicketSlot,
- DiscardTicketCode)
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot,
+ commit, DiscardTicketCode)
),
% Generate the then branch
@@ -256,7 +257,7 @@
code_info__slap_code_info(CodeInfo),
code_info__restore_failure_cont(RestoreContCode),
code_info__maybe_restore_and_discard_hp(MaybeHpSlot, RestoreHPCode),
- code_info__maybe_restore_and_discard_ticket(MaybeTicketSlot,
+ code_info__maybe_reset_and_discard_ticket(MaybeTicketSlot, undo,
RestoreTicketCode),
% Generate the else branch
Index: compiler/livemap.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/livemap.m,v
retrieving revision 1.25
diff -u -r1.25 livemap.m
--- livemap.m 1997/07/27 15:00:47 1.25
+++ livemap.m 1997/08/23 23:24:31
@@ -280,7 +280,7 @@
Instrs = Instrs0,
Ccode = Ccode0
;
- Uinstr0 = restore_ticket(Rval),
+ Uinstr0 = reset_ticket(Rval, _Reason),
livemap__make_live_in_rvals([Rval], Livevals0, Livevals),
Livemap = Livemap0,
Instrs = Instrs0,
Index: compiler/llds.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds.m,v
retrieving revision 1.208
diff -u -r1.208 llds.m
--- llds.m 1997/07/27 15:00:50 1.208
+++ llds.m 1997/08/23 23:25:47
@@ -173,16 +173,21 @@
% was allocated since that call to mark_hp.
; store_ticket(lval)
- % Get a ticket from the constraint solver,
- % push it onto the ticket stack,
+ % Get a trail ticket from the constraint solver,
+ % (conceptually) push it onto the ticket stack
+ % [actually just increment the ticket counter]
% and store its address in the lval.
- ; restore_ticket(rval)
- % Restore the the constraint solver to the state
- % it was in when the ticket pointed to by the
- % specified rval was obtained with store_ticket().
+ ; reset_ticket(rval, reset_trail_reason)
% Reset the ticket stack so that the specified
% rval is now at the top of the ticket stack.
+ % (i.e. reset the trail back to the specified rval.)
+ % If undo_reason is `undo' (or `exception'), restore
+ % any global state to the state it was in when
+ % the ticket pointed to by the specified rval
+ % was obtained with store_ticket().
+ % If undo_reason is `commit', leave the state
+ % unchanged, just discard the trail entries.
; discard_ticket
% Pop the top ticket off the ticket stack.
@@ -229,6 +234,14 @@
---> pragma_c_output(lval, type, string).
% where to put the output val, type and name
% of variable containing the output val
+
+ % see runtime/mercury_trail.h
+:- type reset_trail_reason
+ ---> undo
+ ; commit
+ ; exception
+ ; gc
+ .
% Each call instruction has a list of liveinfo, which stores
% information about which variables are live after the call
Index: compiler/llds_common.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_common.m,v
retrieving revision 1.8
diff -u -r1.8 llds_common.m
--- llds_common.m 1997/07/27 15:00:51 1.8
+++ llds_common.m 1997/08/23 23:26:05
@@ -226,9 +226,9 @@
Info = Info0
;
% unlikely to find anything to share, but why not try?
- Instr0 = restore_ticket(Rval0),
+ Instr0 = reset_ticket(Rval0, Reason),
llds_common__process_rval(Rval0, Info0, Info, Rval),
- Instr = restore_ticket(Rval)
+ Instr = reset_ticket(Rval, Reason)
;
Instr0 = discard_ticket,
Instr = Instr0,
Index: compiler/llds_out.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/llds_out.m,v
retrieving revision 1.53
diff -u -r1.53 llds_out.m
--- llds_out.m 1997/07/29 01:03:37 1.53
+++ llds_out.m 1997/08/24 00:21:21
@@ -777,7 +777,7 @@
output_rval_decls(Rval, "", "", 0, _, DeclSet0, DeclSet).
output_instruction_decls(store_ticket(Lval), DeclSet0, DeclSet) -->
output_lval_decls(Lval, "", "", 0, _, DeclSet0, DeclSet).
-output_instruction_decls(restore_ticket(Rval), DeclSet0, DeclSet) -->
+output_instruction_decls(reset_ticket(Rval, _Reason), DeclSet0, DeclSet) -->
output_rval_decls(Rval, "", "", 0, _, DeclSet0, DeclSet).
output_instruction_decls(discard_ticket, DeclSet, DeclSet) --> [].
output_instruction_decls(incr_sp(_, _), DeclSet, DeclSet) --> [].
@@ -994,17 +994,19 @@
io__write_string(");\n").
output_instruction(store_ticket(Lval), _) -->
- io__write_string("\tstore_ticket("),
+ io__write_string("\tMR_store_ticket("),
output_lval_as_word(Lval),
io__write_string(");\n").
-output_instruction(restore_ticket(Rval), _) -->
- io__write_string("\trestore_ticket("),
+output_instruction(reset_ticket(Rval, Reason), _) -->
+ io__write_string("\tMR_reset_ticket("),
output_rval_as_type(Rval, word),
+ io__write_string(", "),
+ output_reset_trail_reason(Reason),
io__write_string(");\n").
output_instruction(discard_ticket, _) -->
- io__write_string("\tdiscard_ticket();\n").
+ io__write_string("\tMR_discard_ticket();\n").
output_instruction(incr_sp(N, Msg), _) -->
io__write_string("\tincr_sp_push_msg("),
@@ -1160,6 +1162,18 @@
),
io__write_string(";\n"),
output_pragma_outputs(Outputs).
+
+:- pred output_reset_trail_reason(reset_trail_reason, io__state, io__state).
+:- mode output_reset_trail_reason(in, di, uo) is det.
+
+output_reset_trail_reason(undo) -->
+ io__write_string("MR_undo").
+output_reset_trail_reason(commit) -->
+ io__write_string("MR_commit").
+output_reset_trail_reason(exception) -->
+ io__write_string("MR_exception").
+output_reset_trail_reason(gc) -->
+ io__write_string("MR_gc").
:- pred output_livevals(list(lval), io__state, io__state).
:- mode output_livevals(in, di, uo) is det.
Index: compiler/middle_rec.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/middle_rec.m,v
retrieving revision 1.64
diff -u -r1.64 middle_rec.m
--- middle_rec.m 1997/07/27 15:01:02 1.64
+++ middle_rec.m 1997/08/23 23:26:29
@@ -405,7 +405,7 @@
middle_rec__find_used_registers_rval(Rval, Used0, Used).
middle_rec__find_used_registers_instr(store_ticket(Lval), Used0, Used) :-
middle_rec__find_used_registers_lval(Lval, Used0, Used).
-middle_rec__find_used_registers_instr(restore_ticket(Rval), Used0, Used) :-
+middle_rec__find_used_registers_instr(reset_ticket(Rval, _Rsn), Used0, Used) :-
middle_rec__find_used_registers_rval(Rval, Used0, Used).
middle_rec__find_used_registers_instr(discard_ticket, Used, Used).
middle_rec__find_used_registers_instr(incr_sp(_, _), Used, Used).
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/opt_debug.m,v
retrieving revision 1.70
diff -u -r1.70 opt_debug.m
--- opt_debug.m 1997/07/27 15:01:14 1.70
+++ opt_debug.m 1997/08/23 23:27:44
@@ -318,9 +318,9 @@
opt_debug__dump_vninstr(vn_store_ticket(Vnlval), Str) :-
opt_debug__dump_vnlval(Vnlval, V_str),
string__append_list(["store_ticket(", V_str, ")"], Str).
-opt_debug__dump_vninstr(vn_restore_ticket(Vn), Str) :-
+opt_debug__dump_vninstr(vn_reset_ticket(Vn, _Reason), Str) :-
opt_debug__dump_vn(Vn, Vn_str),
- string__append_list(["restore_ticket(", Vn_str, ")"], Str).
+ string__append_list(["reset_ticket(", Vn_str, ", _)"], Str).
opt_debug__dump_vninstr(vn_discard_ticket, "discard_ticket").
opt_debug__dump_vninstr(vn_incr_sp(N, _), Str) :-
string__int_to_string(N, N_str),
@@ -848,9 +848,9 @@
opt_debug__dump_instr(store_ticket(Lval), Str) :-
opt_debug__dump_lval(Lval, L_str),
string__append_list(["store_ticket(", L_str, ")"], Str).
-opt_debug__dump_instr(restore_ticket(Rval), Str) :-
+opt_debug__dump_instr(reset_ticket(Rval, _Reason), Str) :-
opt_debug__dump_rval(Rval, R_str),
- string__append_list(["restore_ticket(", R_str, ")"], Str).
+ string__append_list(["reset_ticket(", R_str, ", _)"], Str).
opt_debug__dump_instr(discard_ticket, "discard_ticket").
opt_debug__dump_instr(incr_sp(Size, _), Str) :-
string__int_to_string(Size, S_str),
Index: compiler/opt_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/opt_util.m,v
retrieving revision 1.82
diff -u -r1.82 opt_util.m
--- opt_util.m 1997/07/27 15:01:15 1.82
+++ opt_util.m 1997/08/23 23:29:28
@@ -854,7 +854,7 @@
opt_util__block_refers_stackvars(Instrs0, Need)
)
;
- Uinstr0 = restore_ticket(Rval),
+ Uinstr0 = reset_ticket(Rval, _Reason),
opt_util__rval_refers_stackvars(Rval, Use),
( Use = yes ->
Need = yes
@@ -967,7 +967,7 @@
opt_util__can_instr_branch_away(mark_hp(_), no).
opt_util__can_instr_branch_away(restore_hp(_), no).
opt_util__can_instr_branch_away(store_ticket(_), no).
-opt_util__can_instr_branch_away(restore_ticket(_), no).
+opt_util__can_instr_branch_away(reset_ticket(_, _), no).
opt_util__can_instr_branch_away(discard_ticket, no).
opt_util__can_instr_branch_away(incr_sp(_, _), no).
opt_util__can_instr_branch_away(decr_sp(_), no).
@@ -990,7 +990,7 @@
opt_util__can_instr_fall_through(mark_hp(_), yes).
opt_util__can_instr_fall_through(restore_hp(_), yes).
opt_util__can_instr_fall_through(store_ticket(_), yes).
-opt_util__can_instr_fall_through(restore_ticket(_), yes).
+opt_util__can_instr_fall_through(reset_ticket(_, _), yes).
opt_util__can_instr_fall_through(discard_ticket, yes).
opt_util__can_instr_fall_through(incr_sp(_, _), yes).
opt_util__can_instr_fall_through(decr_sp(_), yes).
@@ -1029,7 +1029,7 @@
opt_util__can_use_livevals(mark_hp(_), no).
opt_util__can_use_livevals(restore_hp(_), no).
opt_util__can_use_livevals(store_ticket(_), no).
-opt_util__can_use_livevals(restore_ticket(_), no).
+opt_util__can_use_livevals(reset_ticket(_, _), no).
opt_util__can_use_livevals(discard_ticket, no).
opt_util__can_use_livevals(incr_sp(_, _), no).
opt_util__can_use_livevals(decr_sp(_), no).
@@ -1085,7 +1085,7 @@
opt_util__instr_labels_2(mark_hp(_), [], []).
opt_util__instr_labels_2(restore_hp(_), [], []).
opt_util__instr_labels_2(store_ticket(_), [], []).
-opt_util__instr_labels_2(restore_ticket(_), [], []).
+opt_util__instr_labels_2(reset_ticket(_, _), [], []).
opt_util__instr_labels_2(discard_ticket, [], []).
opt_util__instr_labels_2(incr_sp(_, _), [], []).
opt_util__instr_labels_2(decr_sp(_), [], []).
@@ -1113,7 +1113,7 @@
opt_util__instr_rvals_and_lvals(mark_hp(Lval), [], [Lval]).
opt_util__instr_rvals_and_lvals(restore_hp(Rval), [Rval], []).
opt_util__instr_rvals_and_lvals(store_ticket(Lval), [], [Lval]).
-opt_util__instr_rvals_and_lvals(restore_ticket(Rval), [Rval], []).
+opt_util__instr_rvals_and_lvals(reset_ticket(Rval, _Reason), [Rval], []).
opt_util__instr_rvals_and_lvals(discard_ticket, [], []).
opt_util__instr_rvals_and_lvals(incr_sp(_, _), [], []).
opt_util__instr_rvals_and_lvals(decr_sp(_), [], []).
@@ -1205,7 +1205,7 @@
opt_util__count_temps_rval(Rval, R0, R, F0, F).
opt_util__count_temps_instr(store_ticket(Lval), R0, R, F0, F) :-
opt_util__count_temps_lval(Lval, R0, R, F0, F).
-opt_util__count_temps_instr(restore_ticket(Rval), R0, R, F0, F) :-
+opt_util__count_temps_instr(reset_ticket(Rval, _Reason), R0, R, F0, F) :-
opt_util__count_temps_rval(Rval, R0, R, F0, F).
opt_util__count_temps_instr(discard_ticket, R, R, F, F).
opt_util__count_temps_instr(incr_sp(_, _), R, R, F, F).
Index: compiler/peephole.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/peephole.m,v
retrieving revision 1.68
diff -u -r1.68 peephole.m
--- peephole.m 1997/07/27 15:01:20 1.68
+++ peephole.m 1997/08/23 23:30:52
@@ -165,15 +165,15 @@
)
).
- % If a `store_ticket' is followed by a `restore_ticket',
- % we can delete the `restore_ticket'.
+ % If a `store_ticket' is followed by a `reset_ticket',
+ % we can delete the `reset_ticket'.
%
% store_ticket(Lval) => store_ticket(Lval)
- % restore_ticket(Lval)
+ % reset_ticket(Lval, _R)
peephole__match(store_ticket(Lval), Comment, Instrs0, Instrs) :-
opt_util__skip_comments(Instrs0, Instrs1),
- Instrs1 = [restore_ticket(lval(Lval)) - _Comment2 | Instrs2],
+ Instrs1 = [reset_ticket(lval(Lval), _Reason) - _Comment2 | Instrs2],
Instrs = [store_ticket(Lval) - Comment | Instrs2].
% If a `modframe' is followed by another, with the instructions
Index: compiler/value_number.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/value_number.m,v
retrieving revision 1.83
diff -u -r1.83 value_number.m
--- value_number.m 1997/07/27 15:01:57 1.83
+++ value_number.m 1997/08/23 23:31:03
@@ -1081,7 +1081,7 @@
value_number__boundary_instr(mark_hp(_), no).
value_number__boundary_instr(restore_hp(_), no).
value_number__boundary_instr(store_ticket(_), yes).
-value_number__boundary_instr(restore_ticket(_), yes).
+value_number__boundary_instr(reset_ticket(_, _), yes).
value_number__boundary_instr(discard_ticket, yes).
value_number__boundary_instr(incr_sp(_, _), yes).
value_number__boundary_instr(decr_sp(_), yes).
Index: compiler/vn_block.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_block.m,v
retrieving revision 1.46
diff -u -r1.46 vn_block.m
--- vn_block.m 1997/07/27 15:01:58 1.46
+++ vn_block.m 1997/08/24 00:25:18
@@ -314,11 +314,11 @@
vn_block__new_ctrl_node(vn_store_ticket(Vnlval), Livemap,
Params, VnTables1, VnTables,
Liveset0, Liveset, Tuple0, Tuple).
-vn_block__handle_instr(restore_ticket(Rval),
+vn_block__handle_instr(reset_ticket(Rval, Reason),
Livemap, Params, VnTables0, VnTables, Liveset0, Liveset,
SeenIncr, SeenIncr, Tuple0, Tuple) :-
vn_util__rval_to_vn(Rval, Vn, VnTables0, VnTables1),
- vn_block__new_ctrl_node(vn_restore_ticket(Vn), Livemap,
+ vn_block__new_ctrl_node(vn_reset_ticket(Vn, Reason), Livemap,
Params, VnTables1, VnTables,
Liveset0, Liveset, Tuple0, Tuple).
vn_block__handle_instr(discard_ticket,
@@ -443,7 +443,7 @@
LabelNo = LabelNo0,
Parallels = []
;
- VnInstr = vn_restore_ticket(_),
+ VnInstr = vn_reset_ticket(_, _),
VnTables = VnTables0,
Liveset = Liveset0,
FlushEntry = FlushEntry0,
@@ -845,7 +845,7 @@
vn_block__is_ctrl_instr(mark_hp(_), yes).
vn_block__is_ctrl_instr(restore_hp(_), yes).
vn_block__is_ctrl_instr(store_ticket(_), yes).
-vn_block__is_ctrl_instr(restore_ticket(_), yes).
+vn_block__is_ctrl_instr(reset_ticket(_, _), yes).
vn_block__is_ctrl_instr(discard_ticket, yes).
vn_block__is_ctrl_instr(incr_sp(_, _), yes).
vn_block__is_ctrl_instr(decr_sp(_), yes).
Index: compiler/vn_cost.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_cost.m,v
retrieving revision 1.26
diff -u -r1.26 vn_cost.m
--- vn_cost.m 1997/07/27 15:01:59 1.26
+++ vn_cost.m 1997/08/23 23:35:39
@@ -160,7 +160,7 @@
vn_cost__lval_cost(Lval, Params, LvalCost),
Cost = LvalCost
;
- Uinstr = restore_ticket(Rval),
+ Uinstr = reset_ticket(Rval, _Reason),
vn_cost__rval_cost(Rval, Params, RvalCost),
Cost = RvalCost
;
Index: compiler/vn_filter.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_filter.m,v
retrieving revision 1.9
diff -u -r1.9 vn_filter.m
--- vn_filter.m 1997/07/27 15:02:02 1.9
+++ vn_filter.m 1997/08/23 23:36:39
@@ -120,7 +120,7 @@
vn_filter__user_instr(mark_hp(_), no).
vn_filter__user_instr(restore_hp(Rval), yes(Rval)).
vn_filter__user_instr(store_ticket(_), no).
-vn_filter__user_instr(restore_ticket(Rval), yes(Rval)).
+vn_filter__user_instr(reset_ticket(Rval, _Reason), yes(Rval)).
vn_filter__user_instr(discard_ticket, no).
vn_filter__user_instr(incr_sp(_, _), no).
vn_filter__user_instr(decr_sp(_), no).
@@ -167,8 +167,8 @@
vn_filter__replace_in_rval(Rval0, Temp, Defn, Rval).
vn_filter__replace_in_user_instr(store_ticket(_), _, _, _) :-
error("non-user instruction in vn_filter__replace_in_user_instr").
-vn_filter__replace_in_user_instr(restore_ticket(Rval0), Temp, Defn,
- restore_ticket(Rval)) :-
+vn_filter__replace_in_user_instr(reset_ticket(Rval0, Reason), Temp, Defn,
+ reset_ticket(Rval, Reason)) :-
vn_filter__replace_in_rval(Rval0, Temp, Defn, Rval).
vn_filter__replace_in_user_instr(discard_ticket, _, _, _) :-
error("non-user instruction in vn_filter__replace_in_user_instr").
@@ -200,7 +200,7 @@
vn_filter__defining_instr(mark_hp(Lval), yes(Lval)).
vn_filter__defining_instr(restore_hp(_), no).
vn_filter__defining_instr(store_ticket(Lval), yes(Lval)).
-vn_filter__defining_instr(restore_ticket(_), no).
+vn_filter__defining_instr(reset_ticket(_, _), no).
vn_filter__defining_instr(discard_ticket, no).
vn_filter__defining_instr(incr_sp(_, _), no).
vn_filter__defining_instr(decr_sp(_), no).
@@ -246,7 +246,7 @@
vn_filter__replace_in_defining_instr(store_ticket(Lval0), Temp, Defn,
store_ticket(Lval)) :-
vn_filter__replace_in_lval(Lval0, Temp, Defn, Lval).
-vn_filter__replace_in_defining_instr(restore_ticket(_), _, _, _) :-
+vn_filter__replace_in_defining_instr(reset_ticket(_, _), _, _, _) :-
error("non-def instruction in vn_filter__replace_in_defining_instr").
vn_filter__replace_in_defining_instr(discard_ticket, _, _, _) :-
error("non-def instruction in vn_filter__replace_in_defining_instr").
Index: compiler/vn_flush.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_flush.m,v
retrieving revision 1.41
diff -u -r1.41 vn_flush.m
--- vn_flush.m 1997/07/27 15:02:05 1.41
+++ vn_flush.m 1997/08/23 23:36:59
@@ -250,10 +250,10 @@
Instr = store_ticket(Lval) - "",
list__append(FlushInstrs, [Instr], Instrs)
;
- Vn_instr = vn_restore_ticket(Vn),
+ Vn_instr = vn_reset_ticket(Vn, Reason),
vn_flush__vn(Vn, [src_ctrl(N)], [], Rval, VnTables0, VnTables,
Templocs0, Templocs, Params, FlushInstrs),
- Instr = restore_ticket(Rval) - "",
+ Instr = reset_ticket(Rval, Reason) - "",
list__append(FlushInstrs, [Instr], Instrs)
;
Vn_instr = vn_discard_ticket,
Index: compiler/vn_order.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_order.m,v
retrieving revision 1.40
diff -u -r1.40 vn_order.m
--- vn_order.m 1997/07/27 15:02:06 1.40
+++ vn_order.m 1997/08/23 23:37:19
@@ -370,7 +370,7 @@
VnTables0, VnTables1,
Succmap0, Succmap1, Predmap0, Predmap1)
;
- Vn_instr = vn_restore_ticket(Vn),
+ Vn_instr = vn_reset_ticket(Vn, _Reason),
vn_order__find_links(Vn, node_ctrl(Ctrl),
VnTables0, VnTables1,
Succmap0, Succmap1, Predmap0, Predmap1)
Index: compiler/vn_type.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_type.m,v
retrieving revision 1.32
diff -u -r1.32 vn_type.m
--- vn_type.m 1997/07/27 15:02:10 1.32
+++ vn_type.m 1997/08/23 23:37:54
@@ -77,7 +77,7 @@
; vn_mark_hp(vnlval)
; vn_restore_hp(vn)
; vn_store_ticket(vnlval)
- ; vn_restore_ticket(vn)
+ ; vn_reset_ticket(vn, reset_trail_reason)
; vn_discard_ticket
; vn_incr_sp(int, string)
; vn_decr_sp(int).
Index: compiler/vn_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_util.m,v
retrieving revision 1.55
diff -u -r1.55 vn_util.m
--- vn_util.m 1997/07/27 15:02:10 1.55
+++ vn_util.m 1997/08/23 23:38:08
@@ -1250,7 +1250,7 @@
vn_util__record_use_list(Vns, src_ctrl(Ctrl),
VnTables0, VnTables1)
;
- VnInstr = vn_restore_ticket(Vn),
+ VnInstr = vn_reset_ticket(Vn, _Reason),
vn_util__record_use(Vn, src_ctrl(Ctrl),
VnTables0, VnTables1)
;
Index: compiler/vn_verify.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/vn_verify.m,v
retrieving revision 1.11
diff -u -r1.11 vn_verify.m
--- vn_verify.m 1997/07/27 15:02:12 1.11
+++ vn_verify.m 1997/08/23 23:38:52
@@ -346,7 +346,7 @@
NoDeref = NoDeref0,
Tested = Tested0
;
- Instr = restore_ticket(Rval),
+ Instr = reset_ticket(Rval, _Reason),
vn_verify__tags_rval(Rval, NoDeref0),
NoDeref = NoDeref0,
Tested = Tested0
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list