[m-dev.] for review: RTTI cleanup

Tyson Dowd trd at cs.mu.OZ.AU
Wed Jan 19 14:39:51 AEDT 2000


Here's the review.

On 10-Jan-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> For review by Tyson, during his trip or after he gets back. (I would like
> to build on this change soon, so I would prefer a review sooner rather
> than later.)
> 
> Estimated hours taken: 8, plus unknown hours by Tyson.
> 
> Remove type_ctor_layouts and type_ctor_functors where not needed.
> Simplify type_ctor_layouts by removing code that generates (and
> documentations for) particularly representations that are no longer used 
> now that we use type_ctor_reps.
> 
> Several files also had miscellaneous cleanups and documentation fixes.
> 
> compiler/base_type_layout.m:
>         Simplify documentation.  
> 
>         Remove references to representations in type_ctor_layouts that
>         are no longer used.compiler/base_type_layout.m:
> 
> compiler/base_type_info.m:
> 	Keep base_type_info__type_ctor_rep_to_int in sync with
> 	MR_TypeCtorRepresentation.
> 
> runtime/mercury_grade.h:
> runtime/mercury_cpp.h:
> 	Move the definitions of MR_STRINGIFY and MR_PASTEn to the new file
> 	mercury_cpp.h. Add MR_PASTEn for several new values of n, for use by
> 	mercury_type_info.h.
> 
> runtime/mercury_type_info.h:
> 	Define macros for creating type_ctor_info structures for builtin types.
> 	These have NULL layout and functor fields.
> 
> 	Remove several obsolete macros.
> 
> runtime/mercury_layout_util.c:
> 	Use the new macros for defining a dummy type_ctor_info.
> 
> runtime/mercury_deep_copy_body.h:
> runtime/mercury_tabling.c:
> 	Modify the implementation of some RTTI functions to use the layout
> 	and functors structures only if they are defined.
> 
> runtime/mercury_type_info.c:
> 	Modify MR_collapse_equivalences to use the type_ctor_rep, not the
> 	functors indicator, to check for equivalence, since the latter is
> 	not guaranteed to be present.
> 
> 	Move the type_ctor_info structure for preds/funcs to builtin.m.
> 
> library/array.m:
> 	Use these macros to define the type_ctor_info structure for array.
> 
> library/builtin.m:
> 	Use these macros to define the type_ctor_info structure for int,
> 	float, character, string, saved succip etc values, and for preds
> 	and funcs.

Might be worth mentioning that this moves the type_ctor_info for pred
and func out of the runtime.
This is the kind of information that can come in handy when merging in
changes.

>  :- pragma c_code(type_ctor_and_args(TypeInfo::in,
>  		TypeCtor::out, TypeArgs::out), will_not_call_mercury, "
>  {
> @@ -1511,17 +1445,17 @@
>  {
>  	MR_TypeCtorInfo type_ctor = (MR_TypeCtorInfo) TypeCtor;
>  
> +	/* XXX zs: I think this code is wrong */
>  	if (MR_TYPECTOR_IS_HIGHER_ORDER(type_ctor)) {
> -		TypeCtorName = (String) (Word) 
> -			MR_TYPECTOR_GET_HOT_NAME(type_ctor);

If you still think this code is wrong could you elaborate on your
suspicions here?
I thought I tested the higher order stuff in the test cases for
these predicates, but perhaps I missed something.

(This comment is no impediment to committing).

> Index: runtime/mercury_layout_util.c
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/runtime/mercury_layout_util.c,v
> retrieving revision 1.15
> diff -u -b -r1.15 mercury_layout_util.c
> --- runtime/mercury_layout_util.c	1999/12/12 14:29:06	1.15
> +++ runtime/mercury_layout_util.c	2000/01/08 07:20:11


> @@ -113,7 +104,7 @@
>  		** we need to fill in type_params[0] with a dummy type_ctor_info.
>  		*/
>  		type_params[0] = (Word)
> -			&mercury_data___type_ctor_info_stack_layout_0;
> +			&mercury_data___type_ctor_info_stack_layout_1024;
>  		for (i = 0; i < count; i++) {
>  			if (vars->MR_slvs_tvars->MR_tp_param_locns[i] != 0) {
>  				type_params[i + 1] = MR_lookup_long_lval_base(

This change isn't mentioned in the log message.  I'm not sure why it
was changed.  If you add a sentence about it that would be nice.

Apart from that, the change is fine.  I think my hours spent on this
change is about 12.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't eveyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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