[m-dev.] Re: diff: fix bug with trail tickets and --trace shallow
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Dec 13 11:56:49 AEDT 2000
On 11-Dec-2000, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
> Estimated hours taken: 2
>
> compiler/code_gen.m:
> Fix a bug reported by Warwick Harvey: the code that we
> generated for procedures compiled with `--trace shallow'
> was allocating ticket counters conditionally
> (iff MR_trace_from_full was true on entry),
> but was deallocating them unconditionally.
> The fix was to only deallocate them if they were allocated.
Estimated hours taken: 0.5
compiler/code_gen.m:
Fix a bug in my previous change: it was generating duplicate label names.
Workspace: /home/pgrad/fjh/ws/hg3
Index: compiler/code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_gen.m,v
retrieving revision 1.90
diff -u -d -r1.90 code_gen.m
--- compiler/code_gen.m 2000/12/11 10:42:38 1.90
+++ compiler/code_gen.m 2000/12/13 00:09:22
@@ -873,24 +873,41 @@
% only if it was allocated, i.e. only if
% MR_trace_from_full was true on entry.
%
+ % Note that to avoid duplicating label names,
+ % we need to generate two different copies
+ % of this with different labels; this is
+ % needed for semidet code, which will get one
+ % copy in the success epilogue and one copy
+ % in the failure epilogue
+ %
{ FromFullSlotLval =
llds__stack_slot_num_to_lval(
CodeModel, FromFullSlot) },
code_info__get_next_label(SkipLabel),
+ code_info__get_next_label(SkipLabelCopy),
{ PruneTraceTicketCode = node([
if_val(unop(not,
lval(FromFullSlotLval)),
label(SkipLabel)) - "",
prune_ticket - "prune retry ticket",
label(SkipLabel) - ""
+ ]) },
+ { PruneTraceTicketCodeCopy = node([
+ if_val(unop(not,
+ lval(FromFullSlotLval)),
+ label(SkipLabelCopy)) - "",
+ prune_ticket - "prune retry ticket",
+ label(SkipLabelCopy) - ""
]) }
;
{ PruneTraceTicketCode = node([
prune_ticket - "prune retry ticket"
- ]) }
+ ]) },
+ { PruneTraceTicketCodeCopy = PruneTraceTicketCode }
)
;
- { PruneTraceTicketCode = empty }
+ { PruneTraceTicketCode = empty },
+ { PruneTraceTicketCodeCopy = empty }
),
{ RestoreDeallocCode =
@@ -898,6 +915,11 @@
tree(PruneTraceTicketCode,
DeallocCode))
},
+ { RestoreDeallocCodeCopy =
+ tree(RestoreSuccipCode,
+ tree(PruneTraceTicketCodeCopy,
+ DeallocCode))
+ },
code_info__get_maybe_trace_info(MaybeTraceInfo),
( { MaybeTraceInfo = yes(TraceInfo) } ->
@@ -941,7 +963,7 @@
]) },
{ AllSuccessCode =
tree(TraceExitCode,
- tree(RestoreDeallocCode,
+ tree(RestoreDeallocCodeCopy,
SuccessCode))
}
;
@@ -954,7 +976,7 @@
]) },
{ AllSuccessCode =
tree(TraceExitCode,
- tree(RestoreDeallocCode,
+ tree(RestoreDeallocCodeCopy,
SuccessCode))
}
;
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list