[m-rev.] for review: trail segments

Peter Wang novalazy at gmail.com
Fri Sep 5 15:54:33 AEST 2008


On 2008-09-04, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>
> (I will post some benchmarks with G12's FD solver shortly -- benchmarking
> the compiler will be unenlightening in this case since the additional
> overhead is only incurred when entries are added to the trail, which the
> compiler doesn't do.)
>
> Estimated hours taken: 20
> Branches: main
>
> Add a mechanism for dynamically growing the trail by adding new segments to it
> in a similar fashion to what we do for the stacks with stack segments.  The
> mechanism is enabled by the trseg (trail segments) grade component.  Unlike
> stack segments the trail segment mechanism also works with the high-level C
> backend.

> Index: runtime/mercury_trail.h
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trail.h,v
> retrieving revision 1.30
> diff -u -r1.30 mercury_trail.h
> --- runtime/mercury_trail.h	13 Jun 2008 07:27:56 -0000	1.30
> +++ runtime/mercury_trail.h	3 Sep 2008 22:04:02 -0000
> @@ -25,6 +25,7 @@
>    #define MR_IF_USE_TRAIL(x)
>  #endif
>
> +
>  /*---------------------------------------------------------------------------*/
>  /*
>  ** The following macros define how to store and retrieve a 'ticket' -
> @@ -307,7 +308,7 @@
>        } while (0)
>
>    /*
> -  ** void MR_store_function_trail_entry_kind(
> +  ** void MR_store_function_trail_entry(
>    **        MR_trail_entry *entry, MR_untrail_func *func, void *datum);
>    */
>    #define MR_store_function_trail_entry(entry, func, datum)                 \
> @@ -316,7 +317,8 @@
>          (entry)->MR_union.MR_func.MR_untrail_func = (func);                 \
>          (entry)->MR_union.MR_func.MR_datum = (datum);                       \
>        } while (0)
> -#endif
> +
> +#endif /* ! MR_USE_TAGGED_TRAIL */
>
>  /*
>  ** MR_Word MR_get_trail_entry_value(const MR_trail_entry *);
> @@ -355,6 +357,11 @@
>      /* The Mercury trail */
>      extern MR_MemoryZone *MR_trail_zone;
>
> +    #if !defined(MR_TRAIL_SEGMENTS)
> +        /* A list of any previous trail zones. */
> +         extern MR_MemoryZones *MR_prev_trail_zones;
> +    #endif
> +

The condition looks inverted.

> @@ -397,6 +439,22 @@
>  */
>  /*---------------------------------------------------------------------------*/
>
> +#if defined(MR_TRAIL_SEGMENTS)
> +
> +#define MR_trail_extend_and_check()                                         \
> +    do {                                                                    \
> +        if (MR_trail_ptr >= (MR_TrailEntry *) MR_TRAIL_ZONE->MR_zone_end) { \
> +            MR_new_trail_segment();                                         \
> +        }                                                                   \
> +    } while (0)
> +
> +#else /* ! MR_TRAIL_SEGMENTS */
> +
> +    #define MR_trail_extend_and_check()

#define MR_trail_extend_and_check()	((void) 0)

> Index: scripts/canonical_grade.sh-subr
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/scripts/canonical_grade.sh-subr,v
> retrieving revision 1.21
> diff -u -r1.21 canonical_grade.sh-subr
> --- scripts/canonical_grade.sh-subr	24 Oct 2007 09:21:17 -0000	1.21
> +++ scripts/canonical_grade.sh-subr	3 Sep 2008 22:04:02 -0000
> @@ -118,9 +118,14 @@
>  			;;
>  esac
>
> -case $use_trail in
> -	true)		GRADE="$GRADE.tr" ;;
> -	false)		;;
> +case $use_trail,$trail_segments in
> +	true,false)	GRADE="$GRADE.tr" ;;
> +	true,true)	GRADE="$GRADE.trseg" ;;
> +	false,false)	;;
> +	*)		progname=`basename $0`
> +			echo "$progname: error: invalid combination of trailing opitons." 1>&2
> +			exit 1
> +			;;

options

Could .trseg become the default in future?

Peter

--------------------------------------------------------------------------
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