[m-rev.] for review: fix expand equivalence type for special preds bug
Fergus Henderson
fjh at cs.mu.OZ.AU
Sat Nov 9 03:08:13 AEDT 2002
On 08-Nov-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> Fix a bug highlighted by the .NET backend where the comparison,
> unification and index predicates for types defined as equivalence
> types were being generated refering to the original types instead of
> the expanded out equivalent type.
It occurred to me just now that an alternative way of solving this
problem would be to just not emit type_ctor_infos, unification predicates
or comparison predicates for equivalence types in the .NET and Java
back-ends. These back-ends require all equivalence types to be fully
expanded, so the type_ctor_infos and unify/compare predicates for those
types will never be referenced, I'm pretty sure.
> compiler/rtti.m:
> Record the the actual argument types for a special predicate
> in the rtti_proc_label type.
What was the rationale for this bit of the change?
> compiler/ml_call_gen.m:
> compiler/ml_closure_gen.m:
> compiler/ml_code_gen.m:
> compiler/ml_code_util.m:
> Use the types where all the equivalence types have been
> eliminated.
>
> compiler/type_util.m:
> Add a utility predicate to expand out equivalence types.
Hmm. Expanding these on the fly all the time seems like it could be
a bit inefficient (as far as compile time is concerned).
> Index: compiler/typecheck.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
> retrieving revision 1.325
> diff -u -r1.325 typecheck.m
> --- compiler/typecheck.m 25 Sep 2002 06:49:13 -0000 1.325
> +++ compiler/typecheck.m 8 Nov 2002 15:10:32 -0000
> @@ -791,6 +791,8 @@
> pred_info_arg_types(PredInfo, ArgTypes),
> special_pred_get_type(PredName, ArgTypes, Type),
> type_to_ctor_and_args(Type, TypeCtor, _TypeArgs),
> + classify_type_ctor(ModuleInfo, TypeCtor, BuiltinType),
> + BuiltinType = user_type,
> module_info_types(ModuleInfo, TypeTable),
> map__lookup(TypeTable, TypeCtor, TypeDefn),
> hlds_data__get_type_defn_body(TypeDefn, Body),
I think this change to special_pred_needs_typecheck is wrong.
This predicate will only work if it is using the unexpanded types.
The unexpanded type should always be present in the type table.
If the map lookup is failing, it indicates a bug somewhere,
and I think this change will just suppress the symptom without
fixing the bug.
--
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