[m-rev.] for review: base_typeclass_info rtti refs

Fergus Henderson fjh at cs.mu.OZ.AU
Thu May 8 14:22:50 AEST 2003


On 01-May-2003, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> Index: compiler/base_typeclass_info.m
...
> -base_typeclass_info__gen_infos_for_classes([], _ModuleName, _ModuleInfo, []).
> +base_typeclass_info__gen_infos_for_classes([], _ModuleName, _ModuleInfo,
> +		RttiDataList, RttiDataList).
>  base_typeclass_info__gen_infos_for_classes([C|Cs], ModuleName, ModuleInfo, 
> -		RttiDataList) :-
> +		RttiDataList0, RttiDataList) :-
>  	base_typeclass_info__gen_infos_for_instance_list(C, ModuleName,
> -		ModuleInfo, RttiDataList1),
> +		ModuleInfo, RttiDataList0, RttiDataList1),
>  	base_typeclass_info__gen_infos_for_classes(Cs, ModuleName,
> -		ModuleInfo, RttiDataList2),
> -	% XXX make it use an accumulator
> -	list__append(RttiDataList1, RttiDataList2, RttiDataList).
> +		ModuleInfo, RttiDataList1, RttiDataList).

Hmmm, this bit change the order in which the data will appear in the the
RttiDataList.  Previously the rtti_datas for the instance_list came first,
now the rtti_datas for the classes will come first.  

I suppose it probably doesn't make any difference either way...

> +++ compiler/mlds_to_c.m	1 May 2003 06:57:48 -0000
...
> @@ -1749,12 +1749,9 @@
>  mlds_output_data_name(common(Num)) -->
>  	io__write_string("common_"),
>  	io__write_int(Num).
> -mlds_output_data_name(rtti(RttiTypeCtor, RttiName)) -->
> -	{ rtti__addr_to_string(RttiTypeCtor, RttiName, RttiAddrName) },
> +mlds_output_data_name(rtti(RttiId)) -->
> +	{ rtti__addr_to_string(RttiId, RttiAddrName) },

I think rtti__addr_to_string would be better named rtti__id_to_string,
or even better rtti__id_to_c_identifier.

(The definition is in compiler/rtti.m, about line 550.)

> Index: compiler/mlds_to_gcc.m
...
> @@ -2336,7 +2347,7 @@
>  			% instance decls, even if they are in a different
>  			% module
>  			%
> -			Name = data(base_typeclass_info(_, _))
> +			Name = data(rtti(tc_rtti_id(_)))

The code here is inconsistent with the code in mlds_to_c.
Either this code should be testing

		Name = data(rtti(tc_rtti_id(base_typeclass_info(_, _))))

or the code in mlds_to_c should be changed to match this code.
It doesn't make any difference right now, since currently
there is only one kind of tc_rtti_id, but nevertheless these
two places should be consistent.

> @@ -3486,7 +3502,7 @@
>  		% instance decls, even if they are in a different
>  		% module
>  		%
> -		DataName = base_typeclass_info(_, _)
> +		DataName = rtti(tc_rtti_id(_))

Likewise here (make that three places, plus maybe some more that I missed).

> Index: compiler/mlds_to_il.m
> @@ -1271,10 +1271,10 @@
>  	= mangle_mlds_var_name(MLDSVarName).
>  mangle_dataname(common(Int))
>  	= string__format("common_%s", [i(Int)]).
> -mangle_dataname(rtti(RttiTypeCtor, RttiName)) = MangledName :-
> -	rtti__addr_to_string(RttiTypeCtor, RttiName, MangledName).
> -mangle_dataname(base_typeclass_info(ClassId, InstanceStr)) =
> -        make_base_typeclass_info_name(ClassId, InstanceStr).
> +mangle_dataname(rtti(RttiId)) = MangledName :-
> +	rtti__addr_to_string(RttiId, MangledName).
> +% mangle_dataname(base_typeclass_info(ClassId, InstanceStr)) =
> +% 	make_base_typeclass_info_name(ClassId, InstanceStr).

I think those two lines should be justed deleted rather than
commented out.

Otherwise that looks fine, thanks.

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