[m-dev.] for review: retry in trailing grades
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Oct 5 14:55:51 AEST 1999
On 05-Oct-1999, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
>
> Make the retry command work in trailing grades (e.g. for HAL).
...
> compiler/llds.m:
> Add a new reason for resetting the trail: a retry in the debugger.
...
> runtime/mercury_trail.h:
> Add the new reason why the trail may be reset.
You should modify all the places in the Mercury distribution
which switch on the trail reset reason --
in particular extras/trailed_update/var.m and extras/clpr/clpr.m,
but the may be others.
> + case MR_TYPECTOR_REP_HP:
> + fatal_error("Tyson hasn't yet moved the code"
> + "for copying saved heap pointers here");
I don't think it is a good idea to refer to individuals in error messages.
I would change that to `fatal_error("Sorry, not implemented:
copying of saved heap pointers")'; if you must mention Tyson by name,
then it should go in a comment in the source, not in a runtime error
message that our users might encounter.
> + case MR_TYPECTOR_REP_TRAIL_PTR:
> + case MR_TYPECTOR_REP_TICKET:
> + /* we do not yet compress the trail when doing gc */
> + new_data = data;
> + break;
That comment probably deserves an "XXX".
> +++ mercury_trail.h 1999/09/29 05:20:32
> @@ -32,16 +32,18 @@
> ** MR_store_ticket()
> ** called when creating a choice point, or before a commit
> ** MR_reset_ticket()
> -** called when resuming forward execution after failing (MR_undo),
> -** or after a commit (MR_commit), or after a "soft commit"
> -** [one that doesn't prune away all the alternative solutions,
> -** but which does require us to commit to this goal being solvable]
> -** in an if-then-else with a nondet condition, or in solutions/2
> -** (MR_solve).
> +** called under the following circumstances, with different parameters:
> +** - when resuming forward execution after failing (MR_undo);
> +** - after a commit (MR_commit);
> +** - after a "soft commit" [one that doesn't prune away all the
> +** alternative solutions, but which does require us to commit to
> +** this goal being solvable] in an if-then-else with a nondet condition,
> +** or in solutions/2 (MR_solve);
> +** - when executing a `retry' command in the debugger (MR_retry).
Actually there is another case which should be documented there:
- when throwing an exception (MR_exception)
There are a few other places where the trailing documentation has
not been updated to reflect that we know support exceptions.
I suppose that could be fixed as a separate change.
> +++ mercury_trace.c 1999/09/30 06:40:05
> @@ -384,6 +384,22 @@
> MR_LONG_LVAL_NUMBER(location));
> MR_saved_sp(saved_regs) -= entry->MR_sle_stack_slots;
> MR_trace_event_number = MR_event_num_stackvar(this_frame);
> +
> +#ifdef MR_USE_TRAIL
> + if (entry->MR_sle_maybe_trail >= 0) {
> + Word ticket_counter;
> + Word trail_ptr;
> +
> + trail_ptr = MR_based_stackvar(this_frame,
> + entry->MR_sle_maybe_trail);
> + ticket_counter = MR_based_stackvar(this_frame,
> + entry->MR_sle_maybe_trail+1);
> + MR_reset_ticket(trail_ptr, MR_retry);
> + MR_discard_tickets_to(ticket_counter);
> + } else {
> + fatal_error("retry cannot restore the trail");
> + }
> +#endif
Hmm... are the Mercury registers valid here?
What will happen if the trail function tries to call back into Mercury code?
--
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.
--------------------------------------------------------------------------
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