[m-rev.] for prelim review: fix generation of type_ctor_info for unboxed types bug

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Dec 2 14:54:21 AEDT 2003


On 01-Dec-2003, Peter Ross <pro at missioncriticalit.com> wrote:
> The comparison and unification function pointers stored in the
> type_ctor_info must be pointers to functions where all the arguments
> are boxed.  This wasn't occuring on the IL backend for types which
> are value types.

That looks fine.

> +	    % Note that gen_init_special_pred will by necessity add an extra
> +	    % level of indirection to calling the special preds.  However the
> +	    % backend compiler should be smart enough to ensure that this is
> +	    % inlined away.

Thinking about that, I realized that we could without too much effort
improve the code for the MLDS->C back-end versions of the generic unify/2
and compare/3 predicates in runtime/mercury_ho_call.c.  In particular,
instead of that switch(arity) with the corresponding call to
MR_fatal_error("... arity > 5 not supported") in the default case,
we could change the calling convention for the wrapper routines
for each type so that they get passed the type_info; the code to
pull the extra arguments out of the type_info would go in the wrapper
routines rather than in the generic unify/compare routine.

That would save one switch per generic unify/compare (and avoid a fixed limit).
We could also probably avoid the special treatment of variable-arity
type_infos, which would save another switch or if-then-else chain.
Once that was done, the code for generic unify/compare would essentially just
get the type_ctor_info, load the unify/compare field, and call it.

But that is all work for another day :)

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