[m-rev.] for review: pseudo-typeinfo RTTI in Mercury

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Apr 11 15:46:03 AEST 2002


On 10-Apr-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > compiler/mlds.m:
> > 	Since the MLDS now refers to type_infos, add their type
> > 	(mlds__type_info_type) to the list of types the MLDS knows about.
> > 
> Is there a reason why you can't just use mlds__rtti_type?  I guess you do it
> this way because mlds__pseudo_type_info_type appears to be defined specially,
> however one can also define a type mlds__rtti_type(pseudo_type_info(...)), so
> I am not sure what the correct thing to do is here.

I am not sufficiently familiar with the design decisions behind the existence
of mlds__pseudo_type_info_type to be sure either. However, the design as it is
works, and should not be hard to change the future if necessary.

> > +	% XXX should be checked by Tyson
> > +mlds_type_to_ilds_type(_, mlds__type_info_type) = il_generic_type.
> > +
> The only other option is for the type to be a il__object_array_type.
> However since plain type infos with an arity of zero are represented by a
> System.Object (I think) I guess this will need to be il_generic_type.

OK.

> > +:- func pseudo_type_info_is_exported(rtti_pseudo_type_info) = bool.
> > +
> > +pseudo_type_info_is_exported(plain_arity_zero_pseudo_type_info(_)) = yes.
> > +pseudo_type_info_is_exported(plain_pseudo_type_info(_, _))	= no.
> > +pseudo_type_info_is_exported(var_arity_pseudo_type_info(_, _))	= no.
> >  pseudo_type_info_is_exported(type_var(_))			= no.
> > -pseudo_type_info_is_exported(type_ctor_info(_))			= yes.
> > -pseudo_type_info_is_exported(type_info(_, _))			= no.
> > -pseudo_type_info_is_exported(higher_order_type_info(_, _, _))	= no.
>
> Why are only the zero arity types exported?
> The question is purely for improving my understanding of what is going on.

The zero arity versions are typectorinfos, which are visible across modules.
All other typeinfos and pseudo-typeinfos are constructed by each module, on
demand. Since you can't know whether other modules define e.g. a
pseudo-typeinfo with the same structure (and hence, in our naming scheme,
the same name), they may be static in each module.

> The indentation here is a bit screwy, please fix if it is not an
> artifact from diff.

It is an artifact.

> > -#define MR_TypeCtorInfo_struct  MR_TypeCtorInfo_Struct
> > -#define MR_NewTypeCtorInfo_struct  MR_TypeCtorInfo_Struct
> > +#ifndef MR_NO_BACKWARDS_COMPAT
> >  
> >  /*
> >  ** bool, TRUE and FALSE appear in the generated code.
> 
> The removal of the above two #defines isn't mentioned in the log message.

They were needed for bootstrapping a change a few months ago; but they are now
obsolete.

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