[m-dev.] for review, MR_TypeInfo cleanup, part 2

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Mar 24 21:46:26 AEDT 2000


On 22-Mar-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> +++ runtime/mercury_deep_copy_body.h	2000/03/22 01:59:20
>      case MR_TYPECTOR_REP_EQUIV_VAR:
...
>              /*
>              ** The current version of the RTTI gives all equivalence types
>              ** the EQUIV type_ctor_rep, not EQUIV_VAR.
>              */
>              fatal_error("unexpected EQUIV_VAR type_ctor_rep");

Here's another occurrence of what I noticed earlier:
should that say "EQUIV or EQUIV_GROUND" rather than just "EQUIV"?

> +++ runtime/mercury_layout_util.c	2000/03/19 08:08:14
> -Word *
> +MR_TypeInfoParams
>  MR_materialize_typeinfos_base(const MR_Stack_Layout_Vars *vars,
>  	Word *saved_regs, Word *base_sp, Word *base_curfr)
>  {
> -	Word	*type_params;
> +	MR_TypeInfoParams	type_params;
>  	bool	succeeded;
>  	Integer	count;
>  	int	i;
>  
>  	if (vars->MR_slvs_tvars != NULL) {
>  		count = vars->MR_slvs_tvars->MR_tp_param_count;
> -		type_params = MR_NEW_ARRAY(Word, count + 1);
> +		type_params = (MR_TypeInfoParams)
> +			MR_NEW_ARRAY(Word, count + 1);

It would be better to avoid the cast by
allocating the right type in the first place:

		type_params = MR_NEW_ARRAY(MR_TypeInfo, count + 1);

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list