[m-rev.] for review: Arrays for the .NET backend

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Aug 3 06:18:35 AEST 2001


On 02-Aug-2001, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> 
> Implement arrays in the .NET backend.
...
> compiler/ml_call_gen.m:
> 	Implement the cast to the known instance of array(T) for return
> 	values of array.

You should also implement a cast for the other direction, IMHO.
We should avoid relying on any implicit conversions in the MLDS.

> compiler/mlds_to_c.m:
> compiler/mlds_to_gcc.m:
> 	Use MR_Word to represent mlds__mercury_array_type, unless we are
> 	using --high-level-data, in which case we use the appropriately
> 	named high-level-data type.
...
> +++ compiler/mlds_to_c.m	2001/08/02 15:09:21
> +mlds_output_type_prefix(mercury_array_type(_ElemType)) -->
> +	globals__io_lookup_bool_option(highlevel_data, HighLevelData),
> +	( { HighLevelData = yes } ->
> +		mlds_output_mercury_user_type_name(
> +			qualified(unqualified("array"), "array") - 1,
> +			user_type)
> +	;
> +		% for the --no-high-level-data case,
> +		% we just treat everything as `MR_Word'
> +		io__write_string("MR_Word")
> +	).

For mlds_to_c.m, just use the "MR_Array" typedef defined in runtime/mercury.h:

	mlds_output_type_prefix(mercury_array_type(_ElemType)) -->
		io__write_string("MR_Array").

> Index: compiler/mlds_to_il.m
> @@ -2523,7 +2531,7 @@
>  		(
>  			type_id_is_array(TypeId)
>  		->
> -			ILType = il_array_type
> +			ILType = il_object_array_type
>  		;
>  			ml_gen_type_name(TypeId, ClassName, Arity),
>  			ILType = ilds__type([], class(

Is that one correct??
It looks a bit dubious to me.  Please check it.

> @@ -3209,13 +3217,21 @@
...
> -% The mapping to the array type (used like MR_Word).
> +% The mapping to the library array type (array(T))

s/The mapping to/The mapping for/
or s//The mapping of/

> compiler/mlds_to_java.m:
>         Map mlds__mercury_array_type(ElemType) to class Object[] if
>         ElemType is a type variable, or ElemType[] otherwise.
>         (type variables are mapped to Object anyway, so this falls
>         out of the code anyway).
>         (This is untested).
...
> Index: compiler/mlds_to_java.m
> @@ -1206,6 +1207,10 @@
>  
>  output_type(mercury_type(Type, TypeCategory)) -->
>  	output_mercury_type(Type, TypeCategory).
> +
> +output_type(mercury_array_type(_MLDSType)) -->
> +	io__write_string("java.lang.Object").

The code here definitely doesn't match the log message.

Otherwise this looks fine.

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