[m-rev.] diff: mercury versions of library pragma foreign_procs

Simon Taylor stayl at cs.mu.OZ.AU
Fri Jun 14 02:14:48 AEST 2002


On 13-Jun-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> Estimated hours taken: 20
> Branches: main
> 
> configure.in:
> 	Test that the option --bug-intermod-2002-06-13 exists.  This signifies
> 	that the a bug in intermodule optimization for predicates which are
> 	defined as both mercury and foreign code clauses.
> 
> library/array.m:
> library/benchmarking.m:
> library/builtin.m:
> library/char.m:
> library/construct.m:
> library/deconstruct.m:
> library/float.m:
> library/gc.m:
> library/int.m:
> library/io.m:
> library/library.m:
> library/math.m:
> library/private_builtin.m:
> library/profiling_builtin.m:
> library/rtti_implementation.m:
> library/sparse_bitset.m:
> library/std_util.m:
> library/store.m:
> library/table_builtin.m:
> library/time.m:
> library/type_desc.m:
> 	Define a mercury version of every pragma foreign_proc.
> 	Remove any foreign_procs which are not implemented yet.

> Index: library/array.m
> ===================================================================
> @@ -725,6 +725,10 @@
>  #endif
>  ").		
>  
> +bounds_checks :-
> +	% This version is only for if there is not a foreign_proc version.

But there is a foreign_proc version. Something like the following
would be clearer:

+	% This version is only used for back-ends for which there is no
+	% matching foreign_proc version.

(Same for everywhere else that comment appears).

> Index: library/benchmarking.m
> ===================================================================
> @@ -656,18 +654,22 @@
>  "
>  	Time = MR_get_user_cpu_miliseconds();
>  ").
> +/* XXX Can't seem to get this to work -- perhaps Diagnositcs isn't yet

s/Diagnositcs/Diagnostics/

> Index: library/gc.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/gc.m,v
> retrieving revision 1.10
> diff -u -r1.10 gc.m
> --- library/gc.m	12 Jun 2002 06:46:33 -0000	1.10
> +++ library/gc.m	13 Jun 2002 13:27:10 -0000
> @@ -53,9 +53,10 @@
>  	MR_garbage_collect();
>  #endif
>  ").
> -:- pragma foreign_proc("MC++", garbage_collect, [will_not_call_mercury], "
> -	mercury::runtime::Errors::SORRY(""foreign code for this function"");
> -").
> +garbage_collect :-
> +	% This version is only for if there is not a foreign_proc version.
> +	impure private_builtin__imp,
> +	private_builtin__sorry("garbage_collect").

This should default to doing nothing.

> Index: library/sparse_bitset.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/library/sparse_bitset.m,v
> retrieving revision 1.14
> diff -u -r1.14 sparse_bitset.m
> --- library/sparse_bitset.m	12 Jun 2002 06:46:39 -0000	1.14
> +++ library/sparse_bitset.m	13 Jun 2002 13:27:16 -0000
> @@ -792,6 +792,10 @@
>  	mercury.runtime.LowLevelData.set_MR_Word_field(Pair, 2, B);
>  }").
>  
> +make_bitset_elem(_, _) = _ :-
> +	% This version is only for if there is not a foreign_proc version.
> +	private_builtin__sorry("make_bitset_elem").
> +

This should be `make_bitset_elem(Offset, Bits) = bitset_elem(Offset, Bits).'

> Index: library/string.m
> ===================================================================

Make sure you address the separate review comments for this change
before you commit.

Simon.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list