trivial diff: s/user_type(_)/user_type/

Fergus Henderson fjh at hydra.cs.mu.oz.au
Sun Oct 12 15:48:26 AEST 1997


Estimated hours: 0.5

Minor efficiency improvment.

compiler/type_util.m:
compiler/polymorphism.m:
compiler/switch_gen.m:
	Change the type category `user_type(Type)' to just `user_type';
	pass the type as well as the type category, if needed.

cvs diff: Diffing .
Index: polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.117
diff -u -u -r1.117 polymorphism.m
--- polymorphism.m	1997/09/01 14:04:26	1.117
+++ polymorphism.m	1997/10/12 05:31:18
@@ -380,8 +380,8 @@
 		{ list__member(SpecialPredId, SpecialPredIds) }
 	->
 		{ classify_type(Type, ModuleInfo, TypeCategory) },
-		{ polymorphism__get_special_proc(TypeCategory, SpecialPredId,
-			ModuleInfo, Name, PredId, ProcId) }
+		{ polymorphism__get_special_proc(TypeCategory, Type,
+			SpecialPredId, ModuleInfo, Name, PredId, ProcId) }
 	;
 		{ PredId = PredId0 },
 		{ ProcId = ProcId0 },
@@ -1009,7 +1009,7 @@
 	% for the operation specified by Id applied to Type.
 
 	classify_type(Type, ModuleInfo, TypeCategory),
-	polymorphism__get_special_proc(TypeCategory, Id, ModuleInfo,
+	polymorphism__get_special_proc(TypeCategory, Type, Id, ModuleInfo,
 					PredName2, PredId, ProcId),
 	ConsId = code_addr_const(PredId, ProcId),
 
@@ -1037,13 +1037,13 @@
 		Type, ModuleInfo, VarSet1, VarTypes1,
 		Vars, Goals, VarSet, VarTypes).
 
-:- pred polymorphism__get_special_proc(builtin_type, special_pred_id,
+:- pred polymorphism__get_special_proc(builtin_type, type, special_pred_id,
 				module_info, sym_name, pred_id, proc_id).
-:- mode polymorphism__get_special_proc(in, in, in, out, out, out) is det.
+:- mode polymorphism__get_special_proc(in, in, in, in, out, out, out) is det.
 
-polymorphism__get_special_proc(TypeCategory, SpecialPredId, ModuleInfo,
+polymorphism__get_special_proc(TypeCategory, Type, SpecialPredId, ModuleInfo,
 			PredName, PredId, ProcId) :-
-	( TypeCategory = user_type(Type) ->
+	( TypeCategory = user_type ->
 		module_info_get_special_pred_map(ModuleInfo, SpecialPredMap),
 		( type_to_type_id(Type, TypeId, _TypeArgs) ->
 			map__lookup(SpecialPredMap, SpecialPredId - TypeId,
@@ -1079,7 +1079,7 @@
 polymorphism__get_category_name(pred_type, "pred").
 polymorphism__get_category_name(polymorphic_type, _) :-
 	error("polymorphism__get_category_name: polymorphic type").
-polymorphism__get_category_name(user_type(_), _) :-
+polymorphism__get_category_name(user_type, _) :-
 	error("polymorphism__get_category_name: user_type").
 
 	% find the builtin predicate with the specified name
Index: switch_gen.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/switch_gen.m,v
retrieving revision 1.59
diff -u -u -r1.59 switch_gen.m
--- switch_gen.m	1997/07/27 15:01:44	1.59
+++ switch_gen.m	1997/10/12 05:31:34
@@ -172,7 +172,7 @@
 switch_gen__type_cat_to_switch_cat(float_type, other_switch).
 switch_gen__type_cat_to_switch_cat(str_type,  string_switch).
 switch_gen__type_cat_to_switch_cat(pred_type, other_switch).
-switch_gen__type_cat_to_switch_cat(user_type(_), tag_switch).
+switch_gen__type_cat_to_switch_cat(user_type, tag_switch).
 switch_gen__type_cat_to_switch_cat(polymorphic_type, other_switch).
 
 %---------------------------------------------------------------------------%
Index: type_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/type_util.m,v
retrieving revision 1.46
diff -u -u -r1.46 type_util.m
--- type_util.m	1997/09/01 04:19:00	1.46
+++ type_util.m	1997/10/12 05:29:46
@@ -54,7 +54,7 @@
 			;	pred_type
 			;	enum_type
 			;	polymorphic_type
-			;	user_type(type).
+			;	user_type.
 
 	% Given a non-variable type, return its type-id and argument types.
 
@@ -178,7 +178,7 @@
 	classify_type(Type, ModuleInfo, BuiltinType),
 	BuiltinType \= polymorphic_type,
 	BuiltinType \= pred_type,
-	BuiltinType \= user_type(_).
+	BuiltinType \= user_type.
 
 type_util__var(term__variable(Var), Var).
 
@@ -216,7 +216,7 @@
 	->
 		Type = enum_type
 	;
-		Type = user_type(VarType)
+		Type = user_type
 	).
 
 type_is_higher_order(Type, PredOrFunc, PredArgTypes) :-
cvs diff: Diffing notes
-- 
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.



More information about the developers mailing list