[m-rev.] for review: type_info_cell_constructor

Zoltan Somogyi zs at cs.mu.OZ.AU
Sun Jun 22 22:06:43 AEST 2003


On 22-Jun-2003, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> I have already discussed the basic concept with Fergus, and the implementation
> is straightforward.

Actually, it was a bit more complicated than that: I also need the following
diff.

Zoltan.

Index: higher_order.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.109
diff -u -b -r1.109 higher_order.m
--- higher_order.m	29 May 2003 18:17:14 -0000	1.109
+++ higher_order.m	22 Jun 2003 11:42:36 -0000
@@ -666,7 +666,10 @@
 check_unify(deconstruct(_, _, _, _, _, _)) --> [].
 
 check_unify(construct(LVar, ConsId, Args, _Modes, _, _, _), Info0, Info) :-
-	( is_interesting_cons_id(Info0 ^ global_info ^ ho_params, ConsId) ->
+	(
+		is_interesting_cons_id(Info0 ^ global_info ^ ho_params, ConsId)
+			= yes
+	->
 		( map__search(Info0 ^ pred_vars, LVar, Specializable) ->
 			(
 				% we can't specialize calls involving
@@ -695,28 +698,28 @@
 check_unify(complicated_unify(_, _, _)) -->
 	{ error("higher_order:check_unify - complicated unification") }.
 
-:- pred is_interesting_cons_id(ho_params::in, cons_id::in) is semidet.
-
-is_interesting_cons_id(Params, cons(qualified(Module, Name), _)) :-
-	yes = Params ^ user_type_spec,
-	mercury_private_builtin_module(Module),
-	( Name = "type_info"
-	; Name = "typeclass_info"
-	).
-is_interesting_cons_id(Params, pred_const(_, _, _)) :-
-	yes = Params ^ optimize_higher_order.
-is_interesting_cons_id(Params,
-		type_ctor_info_const(_, _, _)) :-
-	yes = Params ^ user_type_spec.
-is_interesting_cons_id(Params,
-		base_typeclass_info_const(_, _, _, _)) :-
-	yes = Params ^ user_type_spec.
+:- func is_interesting_cons_id(ho_params, cons_id) = bool.
 
+is_interesting_cons_id(_Params, cons(_, _)) = no.
 	% We need to keep track of int_consts so we can interpret
 	% superclass_info_from_typeclass_info and typeinfo_from_typeclass_info.
 	% We don't specialize based on them.
-is_interesting_cons_id(Params, int_const(_)) :-
-	yes = Params ^ user_type_spec.
+is_interesting_cons_id(Params, int_const(_)) = Params ^ user_type_spec.
+is_interesting_cons_id(_Params, string_const(_)) = no.
+is_interesting_cons_id(_Params, float_const(_)) = no.
+is_interesting_cons_id(Params, pred_const(_, _, _)) =
+	Params ^ optimize_higher_order.
+is_interesting_cons_id(Params, type_ctor_info_const(_, _, _)) =
+	Params ^ user_type_spec.
+is_interesting_cons_id(Params, base_typeclass_info_const(_, _, _, _)) =
+	Params ^ user_type_spec.
+is_interesting_cons_id(Params, type_info_cell_constructor) =
+	Params ^ user_type_spec.
+is_interesting_cons_id(Params, typeclass_info_cell_constructor) =
+	Params ^ user_type_spec.
+is_interesting_cons_id(_Params, tabling_pointer_const(_, _)) = no.
+is_interesting_cons_id(_Params, deep_profiling_proc_static(_)) = no.
+is_interesting_cons_id(_Params, table_io_decl(_)) = no.
 
 	% Process a higher-order call or class_method_call to see if it
 	% could possibly be specialized.
--------------------------------------------------------------------------
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