[m-rev.] for review: trail resets
Julien Fischer
juliensf at csse.unimelb.edu.au
Fri Jun 13 17:11:54 AEST 2008
On Wed, 11 Jun 2008, Julien Fischer wrote:
> Estimated hours taken: 3
> Branches: main
>
> Provide a mechanism for resetting the trail. This allows the reuse of
> memory that is occupied by any entries on the trail. This can only be done
> safely after it is certain that any calls that added the trail entries
> cannot be backtracked over. For some programs doing this can prevent trail
> exhaustation.
>
> This diff does not provide a way of doing this at the Mercury level, nor
> can the compiler currently automatically add calls to reclaim memory used
> by trail. Both these things are future work.
>
> XXX the interaction between this and the debugger is a bit unclear since
> trailing and debugging don't currently work together properly.
>
> runtime/mercury_trail.h:
> runtime/mercury_trail.c:
> Add a new function MR_reset_trail(). When called this
> function walks back along the trail calling function trail entries
> with the MR_gc untrail reason. It then zeros out the trail zone
> and resets the ticket counter and ticket high water mark to their
> initial values.
>
> Define two macros, MR_TRAIL_ZONE and MR_TRAIL_BASE that expand
> to the addresses of the trail zone and the base of the trail
> respectively in a grade independent manner.
>
> Redefine MR_num_trail_entries() using the MR_TRAIL_BASE macro.
>
> Document that MR_gc is now used for this.
>
> Fix a typo.
>
> tests/trailing/Mmakefile:
> tests/trailing/test_trail_reset.m:
> tests/trailing/test_trail_reset.exp:
> A test of the trail reset functionality.
I'm going to go ahead and commit this since any potential reviewers
are either busy marking exams or on holidays. I fixed the typos
in the original diff that prevented it working when MR_THREAD_SAFE
was defined.
Julien.
--------------------------------------------------------------------------
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