[m-dev.] for review: --no-special-preds

Fergus Henderson fjh at cs.mu.OZ.AU
Sat Apr 1 17:57:25 AEST 2000


On 31-Mar-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> compiler/make_hlds.m:
> 	With --no-special-spreds, do not generate even declarations for
> 	type-specific index and compare predicates. Generate declarations
> 	and clauses for type-specific unify predicates, since we may need
> 	them for unifications that are not (in,in). However, we prevent
> 	the generation of code for the (in,in) case (i.e. mode 0) by pretending
> 	that the unify predicate is pseudo_imported, even in the module
> 	defining the type. There is one exception to this: for types with
> 	user-defined equality, we do generate a proper __Unify__ predicate,
> 	since this is the only convenient way to convert the specified
> 	sym_name of the equality predicate into a pred_id and proc_id,
> 	and a proper __Compare__ predicate, since this is the only convenient
> 	way to generate the full type name for the error message at runtime
> 	(due to polymorphism, the full type may not be known at compile time).

How about using the ML_type_name function that is exported from std_util.m?

(That is a minor efficiency issue and can be addressed as a separate change.
For this change, just adding a comment about it would be fine.)

> compiler/higher_order.m:
> 	Also fix an old performance bug: for no_tag types wrapping builtins or
> 	enumerations, we were only specializing compare in mode 0, when modes
> 	0 through 3 have identical code (they differ only in uniqueness
> 	requirements on the arguments). We were also not specializing
> 	comparisons of builtins and enumerations here, leaving it to inlining.
> 	In the absence of --special-preds, that doesn't work for enumerations,
> 	since there is no compiler-generated comparison predicate to do
> 	the inlining in. We therefore now perform both specializations.

I'm not sure that this specialization is safe, because the resulting code is
not be well-moded.

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