[m-rev.] for review: builtin.copy
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu May 29 04:18:03 AEST 2003
On 29-May-2003, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> For review by Fergus, who am I am also asking to make the equivalent change
> for the IL and Java backends, before or after committing this one.
For the Java back-end, there is currently no implementation of
builtin.copy, so no change is needed.
For the IL back-end, the code for copy_2 and copy_2_m1 needs to be
deleted, and replaced with a `pragma foreign_proc', just as for C.
See the (untested) patch below. This should be done together with your
changes, to avoid breaking the IL back-end in the mean time.
> library/builtin.m:
> Replace the handwritten implementation of copy/2 with foreign_procs.
...
> -Using `pragma c_code' doesn't work, due to the lack of support for
> -aliasing, and in particular the lack of support for `ui' modes.
Was that comment wrong?
> +copy(_, _) :-
> + % XXX Fergus fixme
> + error("sorry: copy/2 not yet implemented").
That stub is not needed; the compiler will generate stubs like that
automatically with --allow-stubs. Defining the stub manually is
harmful, because it won't get warned about with --warn-stubs.
Index: builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.90
diff -u -d -u -r1.90 builtin.m
--- builtin.m 14 May 2003 14:38:46 -0000 1.90
+++ builtin.m 28 May 2003 18:15:24 -0000
@@ -477,18 +477,12 @@
compare_3(TypeInfo_for_T, Res, X, Y);
}
-static void copy_2(MR_TypeInfo TypeInfo_for_T,
- MR_Box X, MR_Ref(MR_Box) Y)
-{
- *Y = mercury::builtin__csharp_code::mercury_code::deep_copy(X);
-}
-
-static void copy_2_m1(MR_TypeInfo TypeInfo_for_T,
- MR_Box X, MR_Ref(MR_Box) Y)
-{
- copy_2(TypeInfo_for_T, X, Y);
-}
-
+").
+:- pragma foreign_proc("MC++", copy(X::in, Y::uo), [], "
+ Y = mercury::builtin__csharp_code::mercury_code::deep_copy(X);
+").
+:- pragma foreign_proc("MC++", copy(X::ui, Y::uo), [], "
+ Y = mercury::builtin__csharp_code::mercury_code::deep_copy(X);
").
:- pragma foreign_code("C#", "
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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