[m-rev.] for review: reducing the size of type ctor info structures, part 1

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Dec 31 14:44:38 AEDT 2001


On 31-Dec-2001, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> +struct MR_NewTypeCtorInfo_Struct {
> +    MR_Integer          arity;
> +    MR_int_least8_t     MR_type_ctor_version;
> +    MR_TypeCtorRepInt   MR_type_ctor_rep_CAST_ME;
> +    MR_int_least8_t     MR_type_ctor_new_num_ptags;	/* if DU */
> +    MR_ProcAddr         unify_pred;
> +    MR_ProcAddr         compare_pred;
> +    MR_Integer          MR_type_ctor_old_rep_CAST_ME;	/* will be unused */
> +    MR_ProcAddr         MR_unused1;	/* spare */
> +    MR_ProcAddr         MR_unused2;	/* spare */
> +    MR_ConstString      type_ctor_module_name;
> +    MR_ConstString      type_ctor_name;
> +    MR_Integer          MR_type_ctor_old_version;	/* will be unused */
> +    MR_TypeFunctors     type_functors;
> +    MR_TypeLayout       type_layout;
> +    MR_int_least32_t    type_ctor_num_functors;

Hmm...
Why does the "New" version of this struct have unused fields?

> +#define	MR_type_ctor_rep(type_ctor_info)			\
> +		((MR_TypeCtorRep) ((const struct MR_NewTypeCtorInfo_Struct *) \
> +			(type_ctor_info))->MR_type_ctor_old_rep_CAST_ME)

Please use MR_CHECK_EXPR_TYPE to check the type of the argument.

...
> +
> +/*
> +** Declaration for structs.
> +*/
> +
> +#define MR_DECLARE_STRUCT(T)                                        \
> +    extern MR_STATIC_CODE_CONST struct T##_struct T

I don't think it's right to use MR_STATIC_CODE_CONST there.
That would only be appropriate for structs which contain
code addresses, not for structs in general.

What is MR_DECLARE_STRUCT() used for?
If it's not used, maybe it can just be deleted.


Otherwise that change 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