[m-rev.] diff:
Zoltan Somogyi
zs at cs.mu.OZ.AU
Tue Feb 26 14:01:30 AEDT 2002
This diff changes only names, not functionality.
Zoltan.
compiler/*.m:
Change type_id to the more descriptive type_ctor everywhere.
cvs diff: Diffing .
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/assertion.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/assertion.m,v
retrieving revision 1.15
diff -u -b -r1.15 assertion.m
--- compiler/assertion.m 2002/02/22 01:20:39 1.15
+++ compiler/assertion.m 2002/02/25 16:03:09
@@ -816,10 +816,10 @@
{ clauses_info_vartypes(ClausesInfo, VarTypes) },
{ map__lookup(VarTypes, Var, Type) },
(
- { type_to_type_id(Type, TypeId, _) }
+ { type_to_ctor_and_args(Type, TypeCtor, _) }
->
{ module_info_types(Module0, Types) },
- { map__lookup(Types, TypeId, TypeDefn) },
+ { map__lookup(Types, TypeCtor, TypeDefn) },
{ hlds_data__get_type_defn_status(TypeDefn, TypeStatus) },
(
{ is_defined_in_implementation_section(TypeStatus,
@@ -831,7 +831,7 @@
{ Module = Module0 }
)
;
- { error("assertion__in_interface_check_unify_rhs: type_to_type_id failed.") }
+ { error("assertion__in_interface_check_unify_rhs: type_to_ctor_and_args failed.") }
).
assertion__in_interface_check_unify_rhs(lambda_goal(_,_,_,_,_,_,_,Goal),
_Var, _Context, PredInfo, Module0, Module) -->
Index: compiler/bytecode_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.66
diff -u -b -r1.66 bytecode_gen.m
--- compiler/bytecode_gen.m 2002/02/20 03:13:51 1.66
+++ compiler/bytecode_gen.m 2002/02/25 16:03:11
@@ -511,20 +511,25 @@
bytecode_gen__get_var_type(ByteInfo, Var1, Var1Type),
bytecode_gen__get_var_type(ByteInfo, Var2, Var2Type),
- ( type_to_type_id(Var1Type, TypeId1, _),
- type_to_type_id(Var2Type, TypeId2, _)
- -> ( TypeId2 = TypeId1
- -> TypeId = TypeId1
- ; unexpected(this_file, "simple_test between different types")
+ (
+ type_to_ctor_and_args(Var1Type, TypeCtor1, _),
+ type_to_ctor_and_args(Var2Type, TypeCtor2, _)
+ ->
+ ( TypeCtor2 = TypeCtor1 ->
+ TypeCtor = TypeCtor1
+ ; unexpected(this_file,
+ "simple_test between different types")
)
- ; unexpected(this_file, "failed lookup of type id")
+ ;
+ unexpected(this_file, "failed lookup of type id")
),
ByteInfo = byte_info(_, _, ModuleInfo, _, _),
- classify_type_id(ModuleInfo, TypeId, BuiltinType),
+ classify_type_ctor(ModuleInfo, TypeCtor, BuiltinType),
- ( BuiltinType = int_type,
+ (
+ BuiltinType = int_type,
TestId = int_test
; BuiltinType = char_type,
Index: compiler/code_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_info.m,v
retrieving revision 1.264
diff -u -b -r1.264 code_info.m
--- compiler/code_info.m 2001/04/24 03:58:51 1.264
+++ compiler/code_info.m 2002/02/25 16:03:13
@@ -790,13 +790,13 @@
code_info__lookup_type_defn(Type, TypeDefn) -->
code_info__get_module_info(ModuleInfo),
- { type_to_type_id(Type, TypeIdPrime, _) ->
- TypeId = TypeIdPrime
+ { type_to_ctor_and_args(Type, TypeCtorPrime, _) ->
+ TypeCtor = TypeCtorPrime
;
error("unknown type in code_info__lookup_type_defn")
},
{ module_info_types(ModuleInfo, TypeTable) },
- { map__lookup(TypeTable, TypeId, TypeDefn) }.
+ { map__lookup(TypeTable, TypeCtor, TypeDefn) }.
code_info__cons_id_to_tag(Var, ConsId, ConsTag) -->
code_info__variable_type(Var, Type),
Index: compiler/code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/code_util.m,v
retrieving revision 1.134
diff -u -b -r1.134 code_util.m
--- compiler/code_util.m 2002/02/20 03:13:53 1.134
+++ compiler/code_util.m 2002/02/25 16:03:13
@@ -76,7 +76,7 @@
:- mode code_util__make_user_proc_label(in, in,
in, in, in, in, in, out) is det.
-:- pred code_util__make_uni_label(module_info, type_id, proc_id, proc_label).
+:- pred code_util__make_uni_label(module_info, type_ctor, proc_id, proc_label).
:- mode code_util__make_uni_label(in, in, in, out) is det.
:- pred code_util__extract_proc_label_from_code_addr(code_addr, proc_label).
@@ -292,19 +292,19 @@
->
(
special_pred_get_type(PredName, ArgTypes, Type),
- type_to_type_id(Type, TypeId, _),
- % All type_ids other than tuples here should be
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ % All type_ctors other than tuples here should be
% module qualified, since builtin types are
% handled separately in polymorphism.m.
(
- TypeId = unqualified(TypeName) - _,
- type_id_is_tuple(TypeId),
+ TypeCtor = unqualified(TypeName) - _,
+ type_ctor_is_tuple(TypeCtor),
mercury_public_builtin_module(TypeModule)
;
- TypeId = qualified(TypeModule, TypeName) - _
+ TypeCtor = qualified(TypeModule, TypeName) - _
)
->
- TypeId = _ - TypeArity,
+ TypeCtor = _ - TypeArity,
(
ThisModule \= TypeModule,
PredName = "__Unify__",
@@ -347,9 +347,9 @@
ProcLabel = proc(DefiningModule, PredOrFunc,
PredModule, PredName, PredArity, ProcId).
-code_util__make_uni_label(ModuleInfo, TypeId, UniModeNum, ProcLabel) :-
+code_util__make_uni_label(ModuleInfo, TypeCtor, UniModeNum, ProcLabel) :-
module_info_name(ModuleInfo, ModuleName),
- ( TypeId = qualified(TypeModule, TypeName) - Arity ->
+ ( TypeCtor = qualified(TypeModule, TypeName) - Arity ->
( hlds_pred__in_in_unification_proc_id(UniModeNum) ->
Module = TypeModule
;
@@ -358,7 +358,7 @@
ProcLabel = special_proc(Module, "__Unify__", TypeModule,
TypeName, Arity, UniModeNum)
;
- error("code_util__make_uni_label: unqualified type_id")
+ error("code_util__make_uni_label: unqualified type_ctor")
).
code_util__extract_proc_label_from_code_addr(CodeAddr, ProcLabel) :-
@@ -712,18 +712,18 @@
->
Tag = single_functor
;
- % Use the type to determine the type_id
- ( type_to_type_id(Type, TypeId0, _) ->
- TypeId = TypeId0
+ % Use the type to determine the type_ctor
+ ( type_to_ctor_and_args(Type, TypeCtor0, _) ->
+ TypeCtor = TypeCtor0
;
% the type-checker should ensure that this never happens
error("code_util__cons_id_to_tag: invalid type")
),
- % Given the type_id, lookup up the constructor tag
+ % Given the type_ctor, lookup up the constructor tag
% table for that type
module_info_types(ModuleInfo, TypeTable),
- map__lookup(TypeTable, TypeId, TypeDefn),
+ map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
(
TypeBody = du_type(_, ConsTable0, _, _)
Index: compiler/common.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/common.m,v
retrieving revision 1.60
diff -u -b -r1.60 common.m
--- compiler/common.m 2001/12/06 10:16:39 1.60
+++ compiler/common.m 2002/02/25 16:03:13
@@ -292,9 +292,9 @@
:- mode common__compatible_types(in, in) is semidet.
common__compatible_types(Type1, Type2) :-
- type_to_type_id(Type1, TypeId1, _),
- type_to_type_id(Type2, TypeId2, _),
- TypeId1 = TypeId2.
+ type_to_ctor_and_args(Type1, TypeCtor1, _),
+ type_to_ctor_and_args(Type2, TypeCtor2, _),
+ TypeCtor1 = TypeCtor2.
%---------------------------------------------------------------------------%
@@ -684,9 +684,9 @@
common__types_match_exactly(term__variable(Var), term__variable(Var)).
common__types_match_exactly(Type1, Type2) :-
- type_to_type_id(Type1, TypeId1, Args1),
- type_to_type_id(Type2, TypeId2, Args2),
- TypeId1 = TypeId2,
+ type_to_ctor_and_args(Type1, TypeCtor1, Args1),
+ type_to_ctor_and_args(Type2, TypeCtor2, Args2),
+ TypeCtor1 = TypeCtor2,
common__types_match_exactly_list(Args1, Args2).
:- pred common__types_match_exactly_list(list(type), list(type)).
Index: compiler/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.68
diff -u -b -r1.68 dead_proc_elim.m
--- compiler/dead_proc_elim.m 2002/02/22 01:20:39 1.68
+++ compiler/dead_proc_elim.m 2002/02/25 16:03:14
@@ -176,7 +176,7 @@
dead_proc_elim__initialize_base_gen_infos([], Queue, Queue, Needed, Needed).
dead_proc_elim__initialize_base_gen_infos([TypeCtorGenInfo | TypeCtorGenInfos],
Queue0, Queue, Needed0, Needed) :-
- TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName, TypeName,
+ TypeCtorGenInfo = type_ctor_gen_info(_TypeCtor, ModuleName, TypeName,
Arity, _Status, _HldsDefn, _Unify, _Compare),
(
% XXX: We'd like to do this, but there are problems.
@@ -330,7 +330,7 @@
dead_proc_elim__find_base_gen_info(ModuleName, TypeName, TypeArity,
[TypeCtorGenInfo | TypeCtorGenInfos], Refs) :-
(
- TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName,
+ TypeCtorGenInfo = type_ctor_gen_info(_TypeCtor, ModuleName,
TypeName, TypeArity, _Status, _HldsDefn,
MaybeUnify, MaybeCompare)
->
@@ -667,7 +667,7 @@
Needed, TypeCtorGenInfos) :-
dead_proc_elim__eliminate_base_gen_infos(TypeCtorGenInfos0, Needed,
TypeCtorGenInfos1),
- TypeCtorGenInfo0 = type_ctor_gen_info(TypeId, ModuleName,
+ TypeCtorGenInfo0 = type_ctor_gen_info(TypeCtor, ModuleName,
TypeName, Arity, Status, HldsDefn,
_MaybeUnify, _MaybeCompare),
(
@@ -676,7 +676,7 @@
->
TypeCtorGenInfos = [TypeCtorGenInfo0 | TypeCtorGenInfos1]
;
- NeuteredTypeCtorGenInfo = type_ctor_gen_info(TypeId,
+ NeuteredTypeCtorGenInfo = type_ctor_gen_info(TypeCtor,
ModuleName, TypeName, Arity, Status, HldsDefn,
no, no),
TypeCtorGenInfos = [NeuteredTypeCtorGenInfo |
Index: compiler/det_report.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_report.m,v
retrieving revision 1.69
diff -u -b -r1.69 det_report.m
--- compiler/det_report.m 2002/02/11 09:59:09 1.69
+++ compiler/det_report.m 2002/02/25 16:03:16
@@ -1216,10 +1216,10 @@
io__write_string("unification for non-canonical type\n"),
prog_out__write_context(Context),
io__write_string(" `"),
- ( { type_to_type_id(Type, TypeId, _TypeArgs) } ->
- hlds_out__write_type_id(TypeId)
+ ( { type_to_ctor_and_args(Type, TypeCtor, _TypeArgs) } ->
+ hlds_out__write_type_ctor(TypeCtor)
;
- { error("det_report_message: type_to_type_id failed") }
+ { error("det_report_message: type_to_ctor_and_args failed") }
),
io__write_string("'\n"),
prog_out__write_context(Context),
@@ -1263,10 +1263,10 @@
io__write_string("unification for non-canonical type\n"),
prog_out__write_context(Context),
io__write_string(" `"),
- ( { type_to_type_id(Type, TypeId, _TypeArgs) } ->
- hlds_out__write_type_id(TypeId)
+ ( { type_to_ctor_and_args(Type, TypeCtor, _TypeArgs) } ->
+ hlds_out__write_type_ctor(TypeCtor)
;
- { error("det_report_message: type_to_type_id failed") }
+ { error("det_report_message: type_to_ctor_and_args failed") }
),
io__write_string("'\n"),
prog_out__write_context(Context),
Index: compiler/det_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/det_util.m,v
retrieving revision 1.20
diff -u -b -r1.20 det_util.m
--- compiler/det_util.m 2000/12/13 00:00:18 1.20
+++ compiler/det_util.m 2002/02/25 16:03:16
@@ -150,9 +150,9 @@
det_lookup_var_type(ModuleInfo, ProcInfo, Var, TypeDefn) :-
proc_info_vartypes(ProcInfo, VarTypes),
map__lookup(VarTypes, Var, Type),
- ( type_to_type_id(Type, TypeId, _) ->
+ ( type_to_ctor_and_args(Type, TypeCtor, _) ->
module_info_types(ModuleInfo, TypeTable),
- map__search(TypeTable, TypeId, TypeDefn)
+ map__search(TypeTable, TypeCtor, TypeDefn)
;
error("cannot lookup the type of a variable")
).
Index: compiler/equiv_type.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/equiv_type.m,v
retrieving revision 1.27
diff -u -b -r1.27 equiv_type.m
--- compiler/equiv_type.m 2002/02/26 02:45:36 1.27
+++ compiler/equiv_type.m 2002/02/26 02:49:02
@@ -19,7 +19,7 @@
% equiv_type__expand_eqv_types(ModuleName, Items0, Items,
% CircularTypes, EqvMap, MaybeRecompInfo0, MaybeRecompInfo).
%
- % First it builds up a map from type_id to the equivalent type.
+ % First it builds up a map from type_ctor to the equivalent type.
% Then it traverses through the list of items, expanding all types.
% This has the effect of eliminating all the equivalence types
% from the source code. Error messages are generated for any
@@ -37,7 +37,7 @@
in, out, di, uo) is det.
% Replace equivalence types in a given type, returning
- % the type_ids of the equivalence types replaced.
+ % the type_ctors of the equivalence types replaced.
:- pred equiv_type__replace_in_type(type, tvarset, eqv_map, type,
tvarset).
:- mode equiv_type__replace_in_type(in, in, in, out, out) is det.
@@ -80,7 +80,7 @@
).
:- type eqv_type_body ---> eqv_type_body(tvarset, list(type_param), type).
-:- type eqv_map == map(type_id, eqv_type_body).
+:- type eqv_map == map(type_ctor, eqv_type_body).
:- pred equiv_type__build_eqv_map(list(item_and_context), eqv_map, eqv_map).
:- mode equiv_type__build_eqv_map(in, in, out) is det.
@@ -143,12 +143,12 @@
ContainsCirc, Info0, Info) :-
list__length(TArgs, Arity),
equiv_type__maybe_record_used_equivalences(ModuleName, Name,
- Info0, UsedTypeIds0),
+ Info0, UsedTypeCtors0),
equiv_type__replace_in_type_defn(Name - Arity, TypeDefn0,
VarSet0, EqvMap, TypeDefn, VarSet, ContainsCirc,
- UsedTypeIds0, UsedTypeIds),
+ UsedTypeCtors0, UsedTypeCtors),
equiv_type__finish_recording_used_equivalences(
- item_id(type_body, Name - Arity), UsedTypeIds, Info0, Info).
+ item_id(type_body, Name - Arity), UsedTypeCtors, Info0, Info).
equiv_type__replace_in_item(ModuleName,
pred_or_func(TypeVarSet0, InstVarSet, ExistQVars, PredOrFunc,
@@ -161,16 +161,17 @@
no, Info0, Info) :-
list__length(TypesAndModes0, Arity),
equiv_type__maybe_record_used_equivalences(ModuleName, PredName,
- Info0, UsedTypeIds0),
+ Info0, UsedTypeCtors0),
equiv_type__replace_in_class_constraints(ClassContext0, TypeVarSet0,
- EqvMap, ClassContext, TypeVarSet1, UsedTypeIds0, UsedTypeIds1),
+ EqvMap, ClassContext, TypeVarSet1,
+ UsedTypeCtors0, UsedTypeCtors1),
equiv_type__replace_in_tms(TypesAndModes0, TypeVarSet1, EqvMap,
- TypesAndModes, TypeVarSet, UsedTypeIds1, UsedTypeIds),
+ TypesAndModes, TypeVarSet, UsedTypeCtors1, UsedTypeCtors),
ItemType = pred_or_func_to_item_type(PredOrFunc),
adjust_func_arity(PredOrFunc, OrigArity, Arity),
equiv_type__finish_recording_used_equivalences(
item_id(ItemType, PredName - OrigArity),
- UsedTypeIds, Info0, Info).
+ UsedTypeCtors, Info0, Info).
equiv_type__replace_in_item(ModuleName,
typeclass(Constraints0, ClassName, Vars,
@@ -181,22 +182,22 @@
no, Info0, Info) :-
list__length(Vars, Arity),
equiv_type__maybe_record_used_equivalences(ModuleName, ClassName,
- Info0, UsedTypeIds0),
+ Info0, UsedTypeCtors0),
equiv_type__replace_in_class_constraint_list(Constraints0, VarSet0,
- EqvMap, Constraints, VarSet, UsedTypeIds0, UsedTypeIds1),
+ EqvMap, Constraints, VarSet, UsedTypeCtors0, UsedTypeCtors1),
(
ClassInterface0 = abstract,
ClassInterface = abstract,
- UsedTypeIds = UsedTypeIds1
+ UsedTypeCtors = UsedTypeCtors1
;
ClassInterface0 = concrete(Methods0),
equiv_type__replace_in_class_interface(Methods0,
- EqvMap, Methods, UsedTypeIds1, UsedTypeIds),
+ EqvMap, Methods, UsedTypeCtors1, UsedTypeCtors),
ClassInterface = concrete(Methods)
),
equiv_type__finish_recording_used_equivalences(
item_id(typeclass, ClassName - Arity),
- UsedTypeIds, Info0, Info).
+ UsedTypeCtors, Info0, Info).
equiv_type__replace_in_item(ModuleName,
instance(Constraints0, ClassName, Ts0,
@@ -206,50 +207,50 @@
InstanceBody, VarSet, ModName),
no, Info0, Info) :-
( (Info0 = no ; ModName = ModuleName) ->
- UsedTypeIds0 = no
+ UsedTypeCtors0 = no
;
- UsedTypeIds0 = yes(ModuleName - set__init)
+ UsedTypeCtors0 = yes(ModuleName - set__init)
),
equiv_type__replace_in_class_constraint_list(Constraints0, VarSet0,
- EqvMap, Constraints, VarSet1, UsedTypeIds0, UsedTypeIds1),
+ EqvMap, Constraints, VarSet1, UsedTypeCtors0, UsedTypeCtors1),
equiv_type__replace_in_type_list(Ts0, VarSet1, EqvMap, Ts, VarSet, _,
- UsedTypeIds1, UsedTypeIds),
+ UsedTypeCtors1, UsedTypeCtors),
list__length(Ts0, Arity),
equiv_type__finish_recording_used_equivalences(
item_id(typeclass, ClassName - Arity),
- UsedTypeIds, Info0, Info).
+ UsedTypeCtors, Info0, Info).
equiv_type__replace_in_item(ModuleName,
pragma(type_spec(PredName, B, Arity, D, E,
- Subst0, VarSet0, TypeIds0)),
+ Subst0, VarSet0, TypeCtors0)),
EqvMap,
pragma(type_spec(PredName, B, Arity, D, E,
- Subst, VarSet, TypeIds)),
+ Subst, VarSet, TypeCtors)),
no, Info, Info) :-
( (Info = no ; PredName = qualified(ModuleName, _)) ->
- UsedTypeIds0 = no
+ UsedTypeCtors0 = no
;
- UsedTypeIds0 = yes(ModuleName - TypeIds0)
+ UsedTypeCtors0 = yes(ModuleName - TypeCtors0)
),
equiv_type__replace_in_subst(Subst0, VarSet0, EqvMap, Subst, VarSet,
- UsedTypeIds0, UsedTypeIds),
+ UsedTypeCtors0, UsedTypeCtors),
(
- UsedTypeIds = no,
- TypeIds = TypeIds0
+ UsedTypeCtors = no,
+ TypeCtors = TypeCtors0
;
- UsedTypeIds = yes(_ - TypeIds)
+ UsedTypeCtors = yes(_ - TypeCtors)
).
-:- pred equiv_type__replace_in_type_defn(type_id, type_defn, tvarset,
+:- pred equiv_type__replace_in_type_defn(type_ctor, type_defn, tvarset,
eqv_map, type_defn, tvarset, bool,
equiv_type_info, equiv_type_info).
:- mode equiv_type__replace_in_type_defn(in, in, in, in, out, out, out,
in, out) is semidet.
-equiv_type__replace_in_type_defn(TypeId, eqv_type(TBody0),
+equiv_type__replace_in_type_defn(TypeCtor, eqv_type(TBody0),
VarSet0, EqvMap, eqv_type(TBody),
VarSet, ContainsCirc, Info0, Info) :-
- equiv_type__replace_in_type_2(TBody0, VarSet0, EqvMap, [TypeId],
+ equiv_type__replace_in_type_2(TBody0, VarSet0, EqvMap, [TypeCtor],
TBody, VarSet, ContainsCirc, Info0, Info).
equiv_type__replace_in_type_defn(_, du_type(TBody0,
@@ -403,7 +404,7 @@
Ts, VarSet, no, ContainsCirc, Info0, Info).
:- pred equiv_type__replace_in_type_list_2(list(type), tvarset, eqv_map,
- list(type_id), list(type), tvarset, bool, bool,
+ list(type_ctor), list(type), tvarset, bool, bool,
equiv_type_info, equiv_type_info).
:- mode equiv_type__replace_in_type_list_2(in, in, in,
in, out, out, in, out, in, out) is det.
@@ -432,7 +433,7 @@
As, VarSet, no, ContainsCirc, Info0, Info).
:- pred equiv_type__replace_in_ctor_arg_list_2(list(constructor_arg), tvarset,
- eqv_map, list(type_id), list(constructor_arg), tvarset, bool, bool,
+ eqv_map, list(type_ctor), list(constructor_arg), tvarset, bool, bool,
equiv_type_info, equiv_type_info).
:- mode equiv_type__replace_in_ctor_arg_list_2(in, in, in,
in, out, out, in, out, in, out) is det.
@@ -466,30 +467,31 @@
% Replace all equivalence types in a given type, detecting
% any circularities.
:- pred equiv_type__replace_in_type_2(type, tvarset, eqv_map,
- list(type_id), type, tvarset, bool, equiv_type_info, equiv_type_info).
+ list(type_ctor), type, tvarset, bool,
+ equiv_type_info, equiv_type_info).
:- mode equiv_type__replace_in_type_2(in, in, in, in, out, out, out,
in, out) is det.
equiv_type__replace_in_type_2(term__variable(V), VarSet, _EqvMap,
_Seen, term__variable(V), VarSet, no, Info, Info).
-equiv_type__replace_in_type_2(Type0, VarSet0, EqvMap, TypeIdsAlreadyExpanded,
+equiv_type__replace_in_type_2(Type0, VarSet0, EqvMap, TypeCtorsAlreadyExpanded,
Type, VarSet, Circ, Info0, Info) :-
Type0 = term__functor(_, _, _),
(
- type_to_type_id(Type0, EqvTypeId, TArgs0)
+ type_to_ctor_and_args(Type0, EqvTypeCtor, TArgs0)
->
equiv_type__replace_in_type_list_2(TArgs0, VarSet0, EqvMap,
- TypeIdsAlreadyExpanded, TArgs1, VarSet1, no, Circ0,
+ TypeCtorsAlreadyExpanded, TArgs1, VarSet1, no, Circ0,
Info0, Info1),
- ( list__member(EqvTypeId, TypeIdsAlreadyExpanded) ->
+ ( list__member(EqvTypeCtor, TypeCtorsAlreadyExpanded) ->
Circ1 = yes
;
Circ1 = no
),
(
- map__search(EqvMap, EqvTypeId,
+ map__search(EqvMap, EqvTypeCtor,
eqv_type_body(EqvVarSet, Args0, Body0)),
%
% Don't merge in the variable names from the
@@ -508,18 +510,18 @@
Circ0 = no,
Circ1 = no
->
- map_maybe(equiv_type__record_used_type(EqvTypeId),
+ map_maybe(equiv_type__record_used_type(EqvTypeCtor),
Info1, Info2),
term__term_list_to_var_list(Args, ArgVars),
term__substitute_corresponding(ArgVars, TArgs1,
Body, Type1),
- equiv_type__replace_in_type_2(Type1, VarSet2,
- EqvMap, [EqvTypeId | TypeIdsAlreadyExpanded],
+ equiv_type__replace_in_type_2(Type1, VarSet2, EqvMap,
+ [EqvTypeCtor | TypeCtorsAlreadyExpanded],
Type, VarSet, Circ, Info2, Info)
;
VarSet = VarSet1,
Info = Info1,
- construct_type(EqvTypeId, TArgs1, Type),
+ construct_type(EqvTypeCtor, TArgs1, Type),
bool__or(Circ0, Circ1, Circ)
)
;
@@ -529,17 +531,17 @@
Circ = no
).
-:- pred equiv_type__record_used_type(type_id, pair(module_name, set(type_id)),
- pair(module_name, set(type_id))).
+:- pred equiv_type__record_used_type(type_ctor,
+ pair(module_name, set(type_ctor)), pair(module_name, set(type_ctor))).
:- mode equiv_type__record_used_type(in, in, out) is det.
-equiv_type__record_used_type(TypeId, UsedTypes0, UsedTypes) :-
+equiv_type__record_used_type(TypeCtor, UsedTypes0, UsedTypes) :-
UsedTypes0 = ModuleName - Types0,
- ( TypeId = qualified(ModuleName, _) - _ ->
+ ( TypeCtor = qualified(ModuleName, _) - _ ->
% We don't need to record local types.
UsedTypes = UsedTypes0
;
- UsedTypes = ModuleName - set__insert(Types0, TypeId)
+ UsedTypes = ModuleName - set__insert(Types0, TypeCtor)
).
%-----------------------------------------------------------------------------%
@@ -573,7 +575,7 @@
%-----------------------------------------------------------------------------%
-:- type equiv_type_info == maybe(pair(module_name, set(type_id))).
+:- type equiv_type_info == maybe(pair(module_name, set(type_ctor))).
:- pred equiv_type__maybe_record_used_equivalences(module_name, sym_name,
maybe(recompilation_info), equiv_type_info).
@@ -596,9 +598,9 @@
equiv_type__finish_recording_used_equivalences(_, no, yes(Info), yes(Info)).
equiv_type__finish_recording_used_equivalences(_, yes(_), no, _) :-
error("equiv_type__finish_recording_used_equivalences").
-equiv_type__finish_recording_used_equivalences(Item, yes(_ - UsedTypeIds),
+equiv_type__finish_recording_used_equivalences(Item, yes(_ - UsedTypeCtors),
yes(Info0), yes(Info)) :-
- recompilation__record_used_equivalence_types(Item, UsedTypeIds,
+ recompilation__record_used_equivalence_types(Item, UsedTypeCtors,
Info0, Info).
%-----------------------------------------------------------------------------%
Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.10
diff -u -b -r1.10 foreign.m
--- compiler/foreign.m 2002/01/16 01:13:18 1.10
+++ compiler/foreign.m 2002/02/25 16:03:17
@@ -577,8 +577,8 @@
to_exported_type(ModuleInfo, Type) = ExportType :-
module_info_types(ModuleInfo, Types),
(
- type_to_type_id(Type, TypeId, _),
- map__search(Types, TypeId, TypeDefn)
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ map__search(Types, TypeCtor, TypeDefn)
->
hlds_data__get_type_defn_body(TypeDefn, Body),
( Body = foreign_type(_, ForeignType, _) ->
Index: compiler/higher_order.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/higher_order.m,v
retrieving revision 1.93
diff -u -b -r1.93 higher_order.m
--- compiler/higher_order.m 2002/02/20 03:13:57 1.93
+++ compiler/higher_order.m 2002/02/25 16:03:19
@@ -1885,7 +1885,7 @@
Args = [TypeInfoVar | SpecialPredArgs],
map__search(PredVars, TypeInfoVar,
constant(_TypeInfoConsId, TypeInfoVarArgs)),
- type_to_type_id(SpecialPredType, _ - TypeArity, _),
+ type_to_ctor_and_args(SpecialPredType, _ - TypeArity, _),
( TypeArity = 0 ->
TypeInfoArgs = []
;
@@ -2100,11 +2100,11 @@
ProcId = ProcId0,
Info = Info0
;
- type_to_type_id(Type, TypeId, _),
- special_pred_is_generated_lazily(ModuleInfo, TypeId),
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ special_pred_is_generated_lazily(ModuleInfo, TypeCtor),
(
SpecialId = compare,
- unify_proc__add_lazily_generated_compare_pred_decl(TypeId,
+ unify_proc__add_lazily_generated_compare_pred_decl(TypeCtor,
PredId, ModuleInfo0, ModuleInfo),
hlds_pred__initial_proc_id(ProcId)
;
@@ -2126,7 +2126,7 @@
% added. This case shouldn't come up unless an optimization
% does reordering which requires rescheduling a conjunction.
%
- unify_proc__add_lazily_generated_unify_pred(TypeId,
+ unify_proc__add_lazily_generated_unify_pred(TypeCtor,
PredId, ModuleInfo0, ModuleInfo),
hlds_pred__in_in_unification_proc_id(ProcId)
),
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.66
diff -u -b -r1.66 hlds_data.m
--- compiler/hlds_data.m 2002/02/26 02:45:36 1.66
+++ compiler/hlds_data.m 2002/02/26 02:49:03
@@ -75,7 +75,7 @@
list(constructor_arg), % The field names and types of
% the arguments of this functor
% (if any)
- type_id, % The result type, i.e. the
+ type_ctor, % The result type, i.e. the
% type to which this
% cons_defn belongs.
prog_context % The location of this
@@ -91,7 +91,7 @@
---> hlds_ctor_field_defn(
prog_context, % context of the field definition
import_status,
- type_id, % type containing the field
+ type_ctor, % type containing the field
cons_id, % constructor containing the field
int % argument number (counting from 1)
).
@@ -143,14 +143,14 @@
:- mode make_functor_cons_id(in, in, out) is det.
% Another way of making a cons_id from a functor.
- % Given the name, argument types, and type_id of a functor,
+ % Given the name, argument types, and type_ctor of a functor,
% create a cons_id for that functor.
-:- pred make_cons_id(sym_name, list(constructor_arg), type_id, cons_id).
+:- pred make_cons_id(sym_name, list(constructor_arg), type_ctor, cons_id).
:- mode make_cons_id(in, in, in, out) is det.
% Another way of making a cons_id from a functor.
- % Given the name, argument types, and type_id of a functor,
+ % Given the name, argument types, and type_ctor of a functor,
% create a cons_id for that functor.
%
% Differs from make_cons_id in that (a) it requires the sym_name
@@ -217,7 +217,7 @@
make_functor_cons_id(term__string(String), _, string_const(String)).
make_functor_cons_id(term__float(Float), _, float_const(Float)).
-make_cons_id(SymName0, Args, TypeId, cons(SymName, Arity)) :-
+make_cons_id(SymName0, Args, TypeCtor, cons(SymName, Arity)) :-
% Use the module qualifier on the SymName, if there is one,
% otherwise use the module qualifier on the Type, if there is one,
% otherwise leave it unqualified.
@@ -228,10 +228,10 @@
;
SymName0 = unqualified(ConsName),
(
- TypeId = unqualified(_) - _,
+ TypeCtor = unqualified(_) - _,
SymName = SymName0
;
- TypeId = qualified(TypeModule, _) - _,
+ TypeCtor = qualified(TypeModule, _) - _,
SymName = qualified(TypeModule, ConsName)
)
),
@@ -247,7 +247,7 @@
% The symbol table for types.
-:- type type_table == map(type_id, hlds_type_defn).
+:- type type_table == map(type_ctor, hlds_type_defn).
% This is how type, modes and constructors are represented.
% The parts that are not defined here (i.e. type_param, constructor,
@@ -432,7 +432,7 @@
; small_pointer(int)
% This is for constants which are represented as a
% small integer, cast to a pointer.
- ; reserved_object(type_id, sym_name, arity).
+ ; reserved_object(type_ctor, sym_name, arity).
% This is for constants which are represented as the
% address of a specially reserved global variable.
@@ -453,7 +453,7 @@
(type) % Argument type.
).
-:- type no_tag_type_table == map(type_id, no_tag_type).
+:- type no_tag_type_table == map(type_ctor, no_tag_type).
% Return the primary tag, if any, for a cons_tag.
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.71
diff -u -b -r1.71 hlds_module.m
--- compiler/hlds_module.m 2002/02/22 01:20:41 1.71
+++ compiler/hlds_module.m 2002/02/25 16:03:20
@@ -57,7 +57,7 @@
:- type type_ctor_gen_info
---> type_ctor_gen_info(
- type_id,
+ type_ctor,
module_name, % module name
string, % type name
int, % type arity
@@ -422,7 +422,7 @@
pred_proc_id, pred_info, proc_info, module_info).
:- mode module_info_set_pred_proc_info(in, in, in, in, out) is det.
-:- pred module_info_typeids(module_info, list(type_id)).
+:- pred module_info_typeids(module_info, list(type_ctor)).
:- mode module_info_typeids(in, out) is det.
:- pred module_info_instids(module_info, list(inst_id)).
@@ -805,9 +805,9 @@
pred_info_set_procedures(PredInfo0, Procs, PredInfo),
module_info_set_pred_info(MI0, PredId, PredInfo, MI).
-module_info_typeids(MI, TypeIds) :-
+module_info_typeids(MI, TypeCtors) :-
module_info_types(MI, Types),
- map__keys(Types, TypeIds).
+ map__keys(Types, TypeCtors).
module_info_instids(MI, InstIds) :-
module_info_insts(MI, InstTable),
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.275
diff -u -b -r1.275 hlds_out.m
--- compiler/hlds_out.m 2002/02/26 02:45:37 1.275
+++ compiler/hlds_out.m 2002/02/26 02:49:03
@@ -41,8 +41,8 @@
%-----------------------------------------------------------------------------%
-:- pred hlds_out__write_type_id(type_id, io__state, io__state).
-:- mode hlds_out__write_type_id(in, di, uo) is det.
+:- pred hlds_out__write_type_ctor(type_ctor, io__state, io__state).
+:- mode hlds_out__write_type_ctor(in, di, uo) is det.
:- pred hlds_out__write_class_id(class_id, io__state, io__state).
:- mode hlds_out__write_class_id(in, di, uo) is det.
@@ -276,7 +276,7 @@
:- import_module require, getopt, std_util, term_io, varset.
-hlds_out__write_type_id(Name - Arity) -->
+hlds_out__write_type_ctor(Name - Arity) -->
prog_out__write_sym_name_and_arity(Name / Arity).
hlds_out__write_class_id(class_id(Name, Arity)) -->
@@ -2613,12 +2613,12 @@
{ map__to_assoc_list(TypeTable, TypeAL) },
hlds_out__write_types_2(Indent, TypeAL).
-:- pred hlds_out__write_types_2(int, assoc_list(type_id, hlds_type_defn),
+:- pred hlds_out__write_types_2(int, assoc_list(type_ctor, hlds_type_defn),
io__state, io__state).
:- mode hlds_out__write_types_2(in, in, di, uo) is det.
hlds_out__write_types_2(_Indent, []) --> [].
-hlds_out__write_types_2(Indent, [TypeId - TypeDefn | Types]) -->
+hlds_out__write_types_2(Indent, [TypeCtor - TypeDefn | Types]) -->
{ hlds_data__get_type_defn_tvarset(TypeDefn, TVarSet) },
{ hlds_data__get_type_defn_tparams(TypeDefn, TypeParams) },
{ hlds_data__get_type_defn_body(TypeDefn, TypeBody) },
@@ -2650,13 +2650,13 @@
hlds_out__write_indent(Indent),
io__write_string(":- type "),
- hlds_out__write_type_name(TypeId),
+ hlds_out__write_type_name(TypeCtor),
hlds_out__write_type_params(TVarSet, TypeParams),
{ Indent1 is Indent + 1 },
hlds_out__write_type_body(Indent1, TVarSet, TypeBody),
hlds_out__write_types_2(Indent, Types).
-:- pred hlds_out__write_type_name(type_id, io__state, io__state).
+:- pred hlds_out__write_type_name(type_ctor, io__state, io__state).
:- mode hlds_out__write_type_name(in, di, uo) is det.
hlds_out__write_type_name(Name - _Arity) -->
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.113
diff -u -b -r1.113 intermod.m
--- compiler/intermod.m 2002/02/26 02:45:39 1.113
+++ compiler/intermod.m 2002/02/26 02:49:03
@@ -162,7 +162,7 @@
assoc_list(class_id, hlds_instance_defn),
% instances declarations
% to write
- assoc_list(type_id, hlds_type_defn),
+ assoc_list(type_ctor, hlds_type_defn),
% type declarations
% to write
unit,
@@ -949,27 +949,27 @@
MethodArity, _, FieldName),
map__search(CtorFieldTable, FieldName, FieldDefns)
->
- TypeIds0 = list__map(
- (func(FieldDefn) = TypeId :-
+ TypeCtors0 = list__map(
+ (func(FieldDefn) = TypeCtor :-
FieldDefn = hlds_ctor_field_defn(_, _,
- TypeId, _, _)
+ TypeCtor, _, _)
), FieldDefns)
;
- TypeIds0 = []
+ TypeCtors0 = []
),
module_info_ctors(ModuleInfo, Ctors),
(
map__search(Ctors, cons(InstanceMethodName0, MethodArity),
MatchingConstructors)
->
- TypeIds1 = list__map(
- (func(ConsDefn) = TypeId :-
- ConsDefn = hlds_cons_defn(_, _, _, TypeId, _)
+ TypeCtors1 = list__map(
+ (func(ConsDefn) = TypeCtor :-
+ ConsDefn = hlds_cons_defn(_, _, _, TypeCtor, _)
), MatchingConstructors)
;
- TypeIds1 = []
+ TypeCtors1 = []
),
- TypeIds = list__append(TypeIds0, TypeIds1),
+ TypeCtors = list__append(TypeCtors0, TypeCtors1),
module_info_get_predicate_table(ModuleInfo, PredicateTable),
(
@@ -979,19 +979,19 @@
MethodCallTVarSet, MethodCallArgTypes,
PredId, InstanceMethodFuncName)
->
- TypeIds = [],
+ TypeCtors = [],
MaybePredId = yes(PredId),
InstanceMethodName = InstanceMethodFuncName
;
- TypeIds = [TheTypeId],
+ TypeCtors = [TheTypeCtor],
MaybePredId = no,
- ( TheTypeId = qualified(TypeModule, _) - _ ->
+ ( TheTypeCtor = qualified(TypeModule, _) - _ ->
unqualify_name(InstanceMethodName0, UnqualMethodName),
InstanceMethodName =
qualified(TypeModule, UnqualMethodName)
;
error(
- "unqualified type_id in hlds_cons_defn or hlds_ctor_field_defn")
+ "unqualified type_ctor in hlds_cons_defn or hlds_ctor_field_defn")
)
).
@@ -1004,14 +1004,14 @@
{ module_info_types(ModuleInfo, Types) },
map__foldl(intermod__gather_types_2, Types).
-:- pred intermod__gather_types_2(type_id::in,
+:- pred intermod__gather_types_2(type_ctor::in,
hlds_type_defn::in, intermod_info::in, intermod_info::out) is det.
-intermod__gather_types_2(TypeId, TypeDefn0, Info0, Info) :-
+intermod__gather_types_2(TypeCtor, TypeDefn0, Info0, Info) :-
intermod_info_get_module_info(ModuleInfo, Info0, Info1),
module_info_name(ModuleInfo, ModuleName),
(
- intermod__should_write_type(ModuleName, TypeId, TypeDefn0)
+ intermod__should_write_type(ModuleName, TypeCtor, TypeDefn0)
->
(
hlds_data__get_type_defn_body(TypeDefn0, TypeBody0),
@@ -1019,7 +1019,7 @@
MaybeUserEq0 = yes(UserEq0)
->
module_info_get_special_pred_map(ModuleInfo, SpecialPreds),
- map__lookup(SpecialPreds, unify - TypeId, UnifyPredId),
+ map__lookup(SpecialPreds, unify - TypeCtor, UnifyPredId),
module_info_pred_info(ModuleInfo, UnifyPredId, UnifyPredInfo),
pred_info_arg_types(UnifyPredInfo, TVarSet, _, ArgTypes),
typecheck__resolve_pred_overloading(ModuleInfo, ArgTypes,
@@ -1038,17 +1038,18 @@
TypeDefn = TypeDefn0
),
intermod_info_get_types(Types0, Info2, Info3),
- intermod_info_set_types([TypeId - TypeDefn | Types0], Info3, Info)
+ intermod_info_set_types([TypeCtor - TypeDefn | Types0],
+ Info3, Info)
;
Info = Info1
).
:- pred intermod__should_write_type(module_name::in,
- type_id::in, hlds_type_defn::in) is semidet.
+ type_ctor::in, hlds_type_defn::in) is semidet.
-intermod__should_write_type(ModuleName, TypeId, TypeDefn) :-
+intermod__should_write_type(ModuleName, TypeCtor, TypeDefn) :-
hlds_data__get_type_defn_status(TypeDefn, ImportStatus),
- TypeId = Name - _Arity,
+ TypeCtor = Name - _Arity,
Name = qualified(ModuleName, _),
( ImportStatus = local
; ImportStatus = abstract_exported
@@ -1190,21 +1191,21 @@
intermod__write_modules(Rest)
).
-:- pred intermod__write_types(assoc_list(type_id, hlds_type_defn)::in,
+:- pred intermod__write_types(assoc_list(type_ctor, hlds_type_defn)::in,
io__state::di, io__state::uo) is det.
intermod__write_types(Types) -->
list__foldl(intermod__write_type, Types).
-:- pred intermod__write_type(pair(type_id, hlds_type_defn)::in,
+:- pred intermod__write_type(pair(type_ctor, hlds_type_defn)::in,
io__state::di, io__state::uo) is det.
-intermod__write_type(TypeId - TypeDefn) -->
+intermod__write_type(TypeCtor - TypeDefn) -->
{ hlds_data__get_type_defn_tvarset(TypeDefn, VarSet) },
{ hlds_data__get_type_defn_tparams(TypeDefn, Args) },
{ hlds_data__get_type_defn_body(TypeDefn, Body) },
{ hlds_data__get_type_defn_context(TypeDefn, Context) },
- { TypeId = Name - _Arity },
+ { TypeCtor = Name - _Arity },
(
{ Body = du_type(Ctors, _, _, MaybeEqualityPred) },
{ TypeBody = du_type(Ctors, MaybeEqualityPred) }
@@ -1766,7 +1767,7 @@
:- pred intermod_info_get_instances(
assoc_list(class_id, hlds_instance_defn)::out,
intermod_info::in, intermod_info::out) is det.
-:- pred intermod_info_get_types(assoc_list(type_id, hlds_type_defn)::out,
+:- pred intermod_info_get_types(assoc_list(type_ctor, hlds_type_defn)::out,
intermod_info::in, intermod_info::out) is det.
%:- pred intermod_info_get_insts(set(inst_id)::out,
% intermod_info::in, intermod_info::out) is det.
@@ -1803,7 +1804,7 @@
:- pred intermod_info_set_instances(
assoc_list(class_id, hlds_instance_defn)::in,
intermod_info::in, intermod_info::out) is det.
-:- pred intermod_info_set_types(assoc_list(type_id, hlds_type_defn)::in,
+:- pred intermod_info_set_types(assoc_list(type_ctor, hlds_type_defn)::in,
intermod_info::in, intermod_info::out) is det.
%:- pred intermod_info_set_insts(set(inst_id)::in,
% intermod_info::in, intermod_info::out) is det.
@@ -1893,29 +1894,29 @@
map__from_assoc_list(TypesAL, Types),
module_info_set_types(ModuleInfo1, Types, ModuleInfo).
-:- pred adjust_type_status_2(pair(type_id, hlds_type_defn)::in,
- pair(type_id, hlds_type_defn)::out,
+:- pred adjust_type_status_2(pair(type_ctor, hlds_type_defn)::in,
+ pair(type_ctor, hlds_type_defn)::out,
module_info::in, module_info::out) is det.
-adjust_type_status_2(TypeId - TypeDefn0, TypeId - TypeDefn,
+adjust_type_status_2(TypeCtor - TypeDefn0, TypeCtor - TypeDefn,
ModuleInfo0, ModuleInfo) :-
module_info_name(ModuleInfo0, ModuleName),
- ( intermod__should_write_type(ModuleName, TypeId, TypeDefn0) ->
+ ( intermod__should_write_type(ModuleName, TypeCtor, TypeDefn0) ->
hlds_data__set_type_defn_status(TypeDefn0, exported, TypeDefn),
- fixup_special_preds(TypeId, ModuleInfo0, ModuleInfo)
+ fixup_special_preds(TypeCtor, ModuleInfo0, ModuleInfo)
;
ModuleInfo = ModuleInfo0,
TypeDefn = TypeDefn0
).
-:- pred fixup_special_preds((type_id)::in,
+:- pred fixup_special_preds((type_ctor)::in,
module_info::in, module_info::out) is det.
-fixup_special_preds(TypeId, ModuleInfo0, ModuleInfo) :-
+fixup_special_preds(TypeCtor, ModuleInfo0, ModuleInfo) :-
special_pred_list(SpecialPredList),
module_info_get_special_pred_map(ModuleInfo0, SpecPredMap),
list__filter_map((pred(SpecPredId::in, PredId::out) is semidet :-
- map__search(SpecPredMap, SpecPredId - TypeId, PredId)
+ map__search(SpecPredMap, SpecPredId - TypeCtor, PredId)
), SpecialPredList, PredIds),
set_list_of_preds_exported(PredIds, ModuleInfo0, ModuleInfo).
Index: compiler/ll_pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ll_pseudo_type_info.m,v
retrieving revision 1.2
diff -u -b -r1.2 ll_pseudo_type_info.m
--- compiler/ll_pseudo_type_info.m 2000/08/11 08:19:06 1.2
+++ compiler/ll_pseudo_type_info.m 2002/02/25 16:03:24
@@ -81,30 +81,30 @@
LldsType = integer,
C = C0
;
- Pseudo = type_ctor_info(RttiTypeId),
- DataAddr = rtti_addr(RttiTypeId, pseudo_type_info(Pseudo)),
+ Pseudo = type_ctor_info(RttiTypeCtor),
+ DataAddr = rtti_addr(RttiTypeCtor, pseudo_type_info(Pseudo)),
Rval = const(data_addr_const(DataAddr)),
LldsType = data_ptr,
C = C0
;
- Pseudo = type_info(RttiTypeId, Args),
- convert_compound_pseudo(RttiTypeId, [], Args, Rval, LldsType,
+ Pseudo = type_info(RttiTypeCtor, Args),
+ convert_compound_pseudo(RttiTypeCtor, [], Args, Rval, LldsType,
C0, C)
;
- Pseudo = higher_order_type_info(RttiTypeId, Arity, Args),
+ Pseudo = higher_order_type_info(RttiTypeCtor, Arity, Args),
ArityArg = yes(const(int_const(Arity))),
- convert_compound_pseudo(RttiTypeId, [ArityArg], Args, Rval,
+ convert_compound_pseudo(RttiTypeCtor, [ArityArg], Args, Rval,
LldsType, C0, C)
).
-:- pred convert_compound_pseudo(rtti_type_id, list(maybe(rval)),
+:- pred convert_compound_pseudo(rtti_type_ctor, list(maybe(rval)),
list(pseudo_type_info), rval, llds_type, counter, counter).
:- mode convert_compound_pseudo(in, in, in, out, out, in, out) is det.
-convert_compound_pseudo(RttiTypeId, ArgRvals0, Args,
+convert_compound_pseudo(RttiTypeCtor, ArgRvals0, Args,
Rval, LldsType, C0, C) :-
- TypeCtorInfoPseudo = pseudo_type_info(type_ctor_info(RttiTypeId)),
- TypeCtorInfoDataAddr = rtti_addr(RttiTypeId, TypeCtorInfoPseudo),
+ TypeCtorInfoPseudo = pseudo_type_info(type_ctor_info(RttiTypeCtor)),
+ TypeCtorInfoDataAddr = rtti_addr(RttiTypeCtor, TypeCtorInfoPseudo),
TypeCtorInfoRval = yes(const(data_addr_const(TypeCtorInfoDataAddr))),
LldsType = data_ptr,
counter__allocate(CNum, C0, C1),
Index: compiler/llds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds.m,v
retrieving revision 1.280
diff -u -b -r1.280 llds.m
--- compiler/llds.m 2001/11/06 15:20:46 1.280
+++ compiler/llds.m 2002/02/25 16:03:24
@@ -888,7 +888,7 @@
:- type data_addr
---> data_addr(module_name, data_name)
% module name; which var
- ; rtti_addr(rtti_type_id, rtti_name)
+ ; rtti_addr(rtti_type_ctor, rtti_name)
% type id; which var
; layout_addr(layout_name).
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.186
diff -u -b -r1.186 llds_out.m
--- compiler/llds_out.m 2002/02/20 03:14:07 1.186
+++ compiler/llds_out.m 2002/02/25 16:03:25
@@ -707,7 +707,7 @@
{ NextSeq is Seq + 1 },
output_init_bunch_calls(Bunches, ModuleName, InitStatus, NextSeq).
- % Output MR_INIT_TYPE_CTOR_INFO(TypeCtorInfo, TypeId);
+ % Output MR_INIT_TYPE_CTOR_INFO(TypeCtorInfo, Typector);
% for each type_ctor_info defined in this module.
:- pred output_c_data_init_list(list(comp_gen_c_data)::in,
@@ -3004,8 +3004,9 @@
output_data_addr_storage_type_name(ModuleName, DataVarName, no,
LaterIndent)
;
- { DataAddr = rtti_addr(RttiTypeId, RttiVarName) },
- output_rtti_addr_storage_type_name(RttiTypeId, RttiVarName, no)
+ { DataAddr = rtti_addr(RttiTypector, RttiVarName) },
+ output_rtti_addr_storage_type_name(RttiTypector, RttiVarName,
+ no)
;
{ DataAddr = layout_addr(LayoutName) },
output_layout_name_storage_type_name(LayoutName, no)
@@ -3407,8 +3408,8 @@
output_data_addr(data_addr(ModuleName, DataName)) -->
output_data_addr(ModuleName, DataName).
-output_data_addr(rtti_addr(RttiTypeId, RttiName)) -->
- output_rtti_addr(RttiTypeId, RttiName).
+output_data_addr(rtti_addr(RttiTypeCtor, RttiName)) -->
+ output_rtti_addr(RttiTypeCtor, RttiName).
output_data_addr(layout_addr(LayoutName)) -->
output_layout_name(LayoutName).
Index: compiler/magic_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic_util.m,v
retrieving revision 1.18
diff -u -b -r1.18 magic_util.m
--- compiler/magic_util.m 2002/02/26 02:45:40 1.18
+++ compiler/magic_util.m 2002/02/26 02:49:04
@@ -617,7 +617,7 @@
- (FinalInst -> FinalInst)),
Test = unify(Var, var(OutputVar), UnifyMode,
Unification, unify_context(explicit, [])) - GoalInfo
- ; type_to_type_id(VarType, _TypeId, _ArgTypes) ->
+ ; type_to_ctor_and_args(VarType, _TypeCtor, _ArgTypes) ->
% XXX for now we pretend that the unification is
% a simple test, since otherwise we would have to
% go through the rigmarole of creating type_info variables
@@ -635,7 +635,7 @@
%
module_info_get_special_pred_map(ModuleInfo,
SpecialPredMap),
- map__lookup(SpecialPredMap, unify - TypeId, UniPredId),
+ map__lookup(SpecialPredMap, unify - TypeCtor, UniPredId),
% It had better be an in-in unification, since Aditi
% relations cannot have non-ground arguments. This is
@@ -651,7 +651,7 @@
*/
;
error("magic_util__create_input_test_unifications: \
- type_to_type_id failed")
+ type_to_ctor_and_args failed")
),
goal_info_get_nonlocals(CallInfo0, CallNonLocals0),
set__delete(CallNonLocals0, Var, CallNonLocals1),
@@ -1298,7 +1298,7 @@
Errors1, Errors)
).
-:- pred magic_util__traverse_type(bool::in, set(type_id)::in, (type)::in,
+:- pred magic_util__traverse_type(bool::in, set(type_ctor)::in, (type)::in,
set(argument_error)::in, set(argument_error)::out,
magic_info::in, magic_info::out) is det.
@@ -1320,8 +1320,8 @@
)
;
% The type is user-defined.
- ( { type_to_type_id(ArgType, TypeId, Args) } ->
- magic_util__check_type_id(Parents, TypeId,
+ ( { type_to_ctor_and_args(ArgType, TypeCtor, Args) } ->
+ magic_util__check_type_ctor(Parents, TypeCtor,
Errors0, Errors1),
list__foldl2(magic_util__traverse_type(no, Parents),
Args, Errors1, Errors)
@@ -1332,41 +1332,41 @@
)
).
-:- pred magic_util__check_type_id(set(type_id)::in, type_id::in,
+:- pred magic_util__check_type_ctor(set(type_ctor)::in, type_ctor::in,
set(argument_error)::in, set(argument_error)::out,
magic_info::in, magic_info::out) is det.
-magic_util__check_type_id(Parents, TypeId, Errors0, Errors) -->
+magic_util__check_type_ctor(Parents, TypeCtor, Errors0, Errors) -->
magic_info_get_ok_types(OKTypes0),
magic_info_get_bad_types(BadTypes0),
- ( { set__member(TypeId, Parents) } ->
+ ( { set__member(TypeCtor, Parents) } ->
{ Errors = Errors0 }
- ; { set__member(TypeId, OKTypes0) } ->
+ ; { set__member(TypeCtor, OKTypes0) } ->
{ Errors = Errors0 }
- ; { map__search(BadTypes0, TypeId, TypeErrors) } ->
+ ; { map__search(BadTypes0, TypeCtor, TypeErrors) } ->
{ set__union(Errors0, TypeErrors, Errors) }
;
magic_info_get_module_info(ModuleInfo),
{ module_info_types(ModuleInfo, Types) },
- { map__lookup(Types, TypeId, TypeDefn) },
+ { map__lookup(Types, TypeCtor, TypeDefn) },
{ hlds_data__get_type_defn_body(TypeDefn, TypeBody) },
{ set__init(NewErrors0) },
- { set__insert(Parents, TypeId, Parents1) },
+ { set__insert(Parents, TypeCtor, Parents1) },
magic_util__check_type_defn(TypeBody, Parents1,
NewErrors0, NewErrors),
( { set__empty(NewErrors) } ->
- { set__insert(OKTypes0, TypeId, OKTypes) },
+ { set__insert(OKTypes0, TypeCtor, OKTypes) },
{ Errors = Errors0 },
magic_info_set_ok_types(OKTypes)
;
- { map__det_insert(BadTypes0, TypeId,
+ { map__det_insert(BadTypes0, TypeCtor,
NewErrors, BadTypes) },
{ set__union(Errors0, NewErrors, Errors) },
magic_info_set_bad_types(BadTypes)
)
).
-:- pred magic_util__check_type_defn(hlds_type_body::in, set(type_id)::in,
+:- pred magic_util__check_type_defn(hlds_type_body::in, set(type_ctor)::in,
set(argument_error)::in, set(argument_error)::out,
magic_info::in, magic_info::out) is det.
@@ -1380,7 +1380,7 @@
magic_util__check_type_defn(foreign_type(_, _, _), _, _, _) -->
{ error("magic_util__check_type_defn: foreign_type") }.
-:- pred magic_util__check_ctor(set(type_id)::in, constructor::in,
+:- pred magic_util__check_ctor(set(type_ctor)::in, constructor::in,
set(argument_error)::in, set(argument_error)::out,
magic_info::in, magic_info::out) is det.
@@ -1459,9 +1459,9 @@
magic_info::in, magic_info::out) is det.
:- pred magic_info_get_errors(magic_errors::out,
magic_info::in, magic_info::out) is det.
-:- pred magic_info_get_ok_types(set(type_id)::out,
+:- pred magic_info_get_ok_types(set(type_ctor)::out,
magic_info::in, magic_info::out) is det.
-:- pred magic_info_get_bad_types(map(type_id, set(argument_error))::out,
+:- pred magic_info_get_bad_types(map(type_ctor, set(argument_error))::out,
magic_info::in, magic_info::out) is det.
:- pred magic_info_set_module_info(module_info::in, magic_info::in,
@@ -1490,9 +1490,9 @@
magic_info::in, magic_info::out) is det.
:- pred magic_info_set_errors(magic_errors::in,
magic_info::in, magic_info::out) is det.
-:- pred magic_info_set_ok_types(set(type_id)::in,
+:- pred magic_info_set_ok_types(set(type_ctor)::in,
magic_info::in, magic_info::out) is det.
-:- pred magic_info_set_bad_types(map(type_id, set(argument_error))::in,
+:- pred magic_info_set_bad_types(map(type_ctor, set(argument_error))::in,
magic_info::in, magic_info::out) is det.
%-----------------------------------------------------------------------------%
@@ -1528,14 +1528,14 @@
% vars for which errors have
% been reported.
errors :: magic_errors,
- ok_types :: set(type_id),
- % type_ids which are allowed
+ ok_types :: set(type_ctor),
+ % type_ctors which are allowed
% as argument types of
% Aditi predicates. A type
% is ok if no part of it is
% higher-order or abstract.
- bad_types :: map(type_id, set(argument_error))
- % type_ids which are not ok
+ bad_types :: map(type_ctor, set(argument_error))
+ % type_ctors which are not ok
% as Aditi argument types.
).
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.401
diff -u -b -r1.401 make_hlds.m
--- compiler/make_hlds.m 2002/02/26 02:45:41 1.401
+++ compiler/make_hlds.m 2002/02/26 02:49:04
@@ -46,7 +46,7 @@
:- mode add_new_proc(in, in, in, in, in, in, in, in, in, out, out) is det.
% add_special_pred_for_real(SpecialPredId, ModuleInfo0, TVarSet,
- % Type, TypeId, TypeBody, TypeContext, TypeStatus, ModuleInfo).
+ % Type, TypeCtor, TypeBody, TypeContext, TypeStatus, ModuleInfo).
%
% Add declarations and clauses for a special predicate.
% This is used by unify_proc.m to add a unification predicate
@@ -54,19 +54,19 @@
% generated only when a unification procedure is requested
% during mode analysis.
:- pred add_special_pred_for_real(special_pred_id,
- module_info, tvarset, type, type_id, hlds_type_body,
+ module_info, tvarset, type, type_ctor, hlds_type_body,
prog_context, import_status, module_info).
:- mode add_special_pred_for_real(in, in, in, in, in, in, in, in, out) is det.
% add_special_pred_decl_for_real(SpecialPredId, ModuleInfo0, TVarSet,
- % Type, TypeId, TypeContext, TypeStatus, ModuleInfo).
+ % Type, TypeCtor, TypeContext, TypeStatus, ModuleInfo).
%
% Add declarations for a special predicate.
% This is used by higher_order.m when specializing an in-in
% unification for an imported type for which unification procedures
% are generated lazily.
:- pred add_special_pred_decl_for_real(special_pred_id,
- module_info, tvarset, type, type_id, prog_context,
+ module_info, tvarset, type, type_ctor, prog_context,
import_status, module_info).
:- mode add_special_pred_decl_for_real(in, in, in, in, in, in, in, out) is det.
@@ -413,12 +413,12 @@
ForeignTypeName, ForeignTypeLocation) },
{ Cond = true },
- { TypeId = Name - 0 },
+ { TypeCtor = Name - 0 },
{ module_info_types(Module0, Types) },
{ TypeStr = error_util__describe_sym_name_and_arity(
Name / 0) },
(
- { map__search(Types, TypeId, OldDefn) }
+ { map__search(Types, TypeCtor, OldDefn) }
->
{ hlds_data__get_type_defn_status(OldDefn, OldStatus) },
{ combine_status(OldStatus, ImportStatus, NewStatus) },
@@ -1855,8 +1855,8 @@
item_status(Status0, NeedQual), Module) -->
globals__io_get_globals(Globals),
{ list__length(Args, Arity) },
- { TypeId = Name - Arity },
- { convert_type_defn(TypeDefn, TypeId, Globals, Body) },
+ { TypeCtor = Name - Arity },
+ { convert_type_defn(TypeDefn, TypeCtor, Globals, Body) },
module_add_type_defn_2(Module0, TVarSet, Name, Args, Body, Cond,
Context, item_status(Status0, NeedQual), Module).
@@ -1871,7 +1871,7 @@
{ module_info_types(Module0, Types0) },
globals__io_get_globals(Globals),
{ list__length(Args, Arity) },
- { TypeId = Name - Arity },
+ { TypeCtor = Name - Arity },
{ Body = abstract_type ->
make_status_abstract(Status0, Status1)
;
@@ -1880,7 +1880,7 @@
{
% the type is exported if *any* occurrence is exported,
% even a previous abstract occurrence
- map__search(Types0, TypeId, OldDefn)
+ map__search(Types0, TypeCtor, OldDefn)
->
hlds_data__get_type_defn_status(OldDefn, OldStatus),
combine_status(Status1, OldStatus, Status),
@@ -1912,7 +1912,7 @@
;
hlds_data__set_type_defn(TVarSet_2, Params_2,
Body_2, Status, OrigContext, T3),
- map__det_update(Types0, TypeId, T3, Types),
+ map__det_update(Types0, TypeCtor, T3, Types),
module_info_set_types(Module0, Types, Module)
}
;
@@ -1928,8 +1928,8 @@
OrigContext)
)
;
- { map__set(Types0, TypeId, T, Types) },
- { construct_type(TypeId, Args, Type) },
+ { map__set(Types0, TypeCtor, T, Types) },
+ { construct_type(TypeCtor, Args, Type) },
(
{ Body = du_type(ConsList, _, _, _) }
->
@@ -1938,9 +1938,9 @@
PQInfo) },
{ module_info_ctor_field_table(Module0,
CtorFields0) },
- ctors_add(ConsList, TypeId, TVarSet, NeedQual, PQInfo,
- Context, Status, CtorFields0, CtorFields,
- Ctors0, Ctors),
+ ctors_add(ConsList, TypeCtor, TVarSet, NeedQual,
+ PQInfo, Context, Status,
+ CtorFields0, CtorFields, Ctors0, Ctors),
{ module_info_set_ctors(Module0, Ctors, Module1) },
{ module_info_set_ctor_field_table(Module1,
CtorFields, Module1a) },
@@ -1952,7 +1952,7 @@
Name, CtorArgType),
module_info_no_tag_types(Module1a,
NoTagTypes0),
- map__set(NoTagTypes0, TypeId, NoTagType,
+ map__set(NoTagTypes0, TypeCtor, NoTagType,
NoTagTypes),
module_info_set_no_tag_types(Module1a,
NoTagTypes, Module2)
@@ -1962,7 +1962,7 @@
;
{ Module2 = Module0 }
),
- { add_special_preds(Module2, TVarSet, Type, TypeId,
+ { add_special_preds(Module2, TVarSet, Type, TypeCtor,
Body, Context, Status, Module3) },
{ module_info_set_types(Module3, Types, Module) },
(
@@ -2081,16 +2081,21 @@
Status = abstract_imported
).
-:- pred convert_type_defn(type_defn, type_id, globals, hlds_type_body).
+:- pred convert_type_defn(type_defn, type_ctor, globals, hlds_type_body).
:- mode convert_type_defn(in, in, in, out) is det.
-convert_type_defn(du_type(Body, EqualityPred), TypeId, Globals,
+convert_type_defn(du_type(Body, EqualityPred), TypeCtor, Globals,
du_type(Body, CtorTags, IsEnum, EqualityPred)) :-
+<<<<<<< make_hlds.m
+ assign_constructor_tags(Body, TypeCtor, Globals, CtorTags, IsEnum).
+convert_type_defn(uu_type(Body), _, _, uu_type(Body)).
+=======
assign_constructor_tags(Body, TypeId, Globals, CtorTags, IsEnum).
+>>>>>>> 1.401
convert_type_defn(eqv_type(Body), _, _, eqv_type(Body)).
convert_type_defn(abstract_type, _, _, abstract_type).
-:- pred ctors_add(list(constructor), type_id, tvarset, need_qualifier,
+:- pred ctors_add(list(constructor), type_ctor, tvarset, need_qualifier,
partial_qualifier_info, prog_context, import_status,
ctor_field_table, ctor_field_table,
cons_table, cons_table, io__state, io__state).
@@ -2098,12 +2103,12 @@
ctors_add([], _, _, _, _, _, _, FieldNameTable, FieldNameTable,
Ctors, Ctors) --> [].
-ctors_add([Ctor | Rest], TypeId, TVarSet, NeedQual, PQInfo, Context,
+ctors_add([Ctor | Rest], TypeCtor, TVarSet, NeedQual, PQInfo, Context,
ImportStatus, FieldNameTable0, FieldNameTable,
Ctors0, Ctors) -->
{ Ctor = ctor(ExistQVars, Constraints, Name, Args) },
- { make_cons_id(Name, Args, TypeId, QualifiedConsId) },
- { ConsDefn = hlds_cons_defn(ExistQVars, Constraints, Args, TypeId,
+ { make_cons_id(Name, Args, TypeCtor, QualifiedConsId) },
+ { ConsDefn = hlds_cons_defn(ExistQVars, Constraints, Args, TypeCtor,
Context) },
%
% Insert the fully-qualified version of this cons_id into the
@@ -2120,7 +2125,7 @@
),
(
{ list__member(OtherConsDefn, QualifiedConsDefns1) },
- { OtherConsDefn = hlds_cons_defn(_, _, _, TypeId, _) }
+ { OtherConsDefn = hlds_cons_defn(_, _, _, TypeCtor, _) }
->
% XXX we should record each error using module_info_incr_errors
io__stderr_stream(StdErr),
@@ -2129,7 +2134,7 @@
io__write_string("Error: constructor `"),
hlds_out__write_cons_id(QualifiedConsId),
io__write_string("' for type `"),
- hlds_out__write_type_id(TypeId),
+ hlds_out__write_type_ctor(TypeCtor),
io__write_string("' multiply defined.\n"),
io__set_exit_status(1),
io__set_output_stream(OldStream, _),
@@ -2162,13 +2167,13 @@
{ FirstField = 1 },
add_ctor_field_names(FieldNames, NeedQual, PartialQuals,
- TypeId, QualifiedConsId, Context, ImportStatus,
+ TypeCtor, QualifiedConsId, Context, ImportStatus,
FirstField, FieldNameTable0, FieldNameTable1)
;
{ error("ctors_add: cons_id not qualified") }
),
- ctors_add(Rest, TypeId, TVarSet, NeedQual, PQInfo, Context,
+ ctors_add(Rest, TypeCtor, TVarSet, NeedQual, PQInfo, Context,
ImportStatus, FieldNameTable1, FieldNameTable, Ctors3, Ctors).
:- pred add_ctor(string, int, hlds_cons_defn, module_name,
@@ -2180,7 +2185,7 @@
multi_map__set(CtorsIn, ConsId, ConsDefn, CtorsOut).
:- pred add_ctor_field_names(list(maybe(ctor_field_name)),
- need_qualifier, list(module_name), type_id, cons_id,
+ need_qualifier, list(module_name), type_ctor, cons_id,
prog_context, import_status, int, ctor_field_table,
ctor_field_table, io__state, io__state).
:- mode add_ctor_field_names(in, in, in, in, in, in, in, in,
@@ -2189,19 +2194,19 @@
add_ctor_field_names([], _, _, _, _, _, _, _,
FieldNameTable, FieldNameTable) --> [].
add_ctor_field_names([MaybeFieldName | FieldNames], NeedQual,
- PartialQuals, TypeId, ConsId, Context, ImportStatus,
+ PartialQuals, TypeCtor, ConsId, Context, ImportStatus,
FieldNumber, FieldNameTable0, FieldNameTable) -->
(
{ MaybeFieldName = yes(FieldName) },
{ FieldDefn = hlds_ctor_field_defn(Context, ImportStatus,
- TypeId, ConsId, FieldNumber) },
+ TypeCtor, ConsId, FieldNumber) },
add_ctor_field_name(FieldName, FieldDefn, NeedQual,
PartialQuals, FieldNameTable0, FieldNameTable2)
;
{ MaybeFieldName = no },
{ FieldNameTable2 = FieldNameTable0 }
),
- add_ctor_field_names(FieldNames, NeedQual, PartialQuals, TypeId,
+ add_ctor_field_names(FieldNames, NeedQual, PartialQuals, TypeCtor,
ConsId, Context, ImportStatus, FieldNumber + 1,
FieldNameTable2, FieldNameTable).
@@ -3043,7 +3048,7 @@
%-----------------------------------------------------------------------------%
-:- pred add_special_preds(module_info, tvarset, type, type_id,
+:- pred add_special_preds(module_info, tvarset, type, type_ctor,
hlds_type_body, prog_context, import_status, module_info).
:- mode add_special_preds(in, in, in, in, in, in, in, out) is det.
@@ -3082,17 +3087,17 @@
% predicates to be defined only for the kinds of types which do not
% lead unify_proc__generate_index_clauses to abort.
-add_special_preds(Module0, TVarSet, Type, TypeId,
+add_special_preds(Module0, TVarSet, Type, TypeCtor,
Body, Context, Status, Module) :-
(
special_pred_is_generated_lazily(Module0,
- TypeId, Body, Status)
+ TypeCtor, Body, Status)
->
Module = Module0
;
- can_generate_special_pred_clauses_for_type(TypeId, Body)
+ can_generate_special_pred_clauses_for_type(TypeCtor, Body)
->
- add_special_pred(unify, Module0, TVarSet, Type, TypeId,
+ add_special_pred(unify, Module0, TVarSet, Type, TypeCtor,
Body, Context, Status, Module1),
(
status_defined_in_this_module(Status, yes)
@@ -3113,53 +3118,53 @@
SpecialPredIds = [compare]
),
add_special_pred_list(SpecialPredIds,
- Module1, TVarSet, Type, TypeId,
+ Module1, TVarSet, Type, TypeCtor,
Body, Context, Status, Module)
;
% Never add clauses for comparison predicates
% for imported types -- they will never be used.
module_info_get_special_pred_map(Module1,
SpecialPreds),
- ( map__contains(SpecialPreds, compare - TypeId) ->
+ ( map__contains(SpecialPreds, compare - TypeCtor) ->
Module = Module1
;
add_special_pred_decl(compare, Module1,
- TVarSet, Type, TypeId, Body,
+ TVarSet, Type, TypeCtor, Body,
Context, Status, Module)
)
)
;
SpecialPredIds = [unify, compare],
add_special_pred_decl_list(SpecialPredIds, Module0, TVarSet,
- Type, TypeId, Body, Context, Status, Module)
+ Type, TypeCtor, Body, Context, Status, Module)
).
:- pred add_special_pred_list(list(special_pred_id),
- module_info, tvarset, type, type_id, hlds_type_body,
+ module_info, tvarset, type, type_ctor, hlds_type_body,
prog_context, import_status, module_info).
:- mode add_special_pred_list(in, in, in, in, in, in, in, in, out) is det.
add_special_pred_list([], Module, _, _, _, _, _, _, Module).
add_special_pred_list([SpecialPredId | SpecialPredIds], Module0,
- TVarSet, Type, TypeId, Body, Context, Status, Module) :-
+ TVarSet, Type, TypeCtor, Body, Context, Status, Module) :-
add_special_pred(SpecialPredId, Module0,
- TVarSet, Type, TypeId, Body, Context, Status, Module1),
+ TVarSet, Type, TypeCtor, Body, Context, Status, Module1),
add_special_pred_list(SpecialPredIds, Module1,
- TVarSet, Type, TypeId, Body, Context, Status, Module).
+ TVarSet, Type, TypeCtor, Body, Context, Status, Module).
:- pred add_special_pred(special_pred_id,
- module_info, tvarset, type, type_id, hlds_type_body,
+ module_info, tvarset, type, type_ctor, hlds_type_body,
prog_context, import_status, module_info).
:- mode add_special_pred(in, in, in, in, in, in, in, in, out) is det.
-add_special_pred(SpecialPredId, Module0, TVarSet, Type, TypeId, TypeBody,
+add_special_pred(SpecialPredId, Module0, TVarSet, Type, TypeCtor, TypeBody,
Context, Status0, Module) :-
module_info_globals(Module0, Globals),
globals__lookup_bool_option(Globals, special_preds, GenSpecialPreds),
(
GenSpecialPreds = yes,
add_special_pred_for_real(SpecialPredId, Module0, TVarSet,
- Type, TypeId, TypeBody, Context, Status0, Module)
+ Type, TypeCtor, TypeBody, Context, Status0, Module)
;
GenSpecialPreds = no,
(
@@ -3167,7 +3172,7 @@
add_special_pred_unify_status(TypeBody, Status0,
Status),
add_special_pred_for_real(SpecialPredId, Module0,
- TVarSet, Type, TypeId, TypeBody, Context,
+ TVarSet, Type, TypeCtor, TypeBody, Context,
Status, Module)
;
SpecialPredId = index,
@@ -3186,7 +3191,7 @@
% a good error message in Mercury code
% than in C code.
add_special_pred_for_real(SpecialPredId,
- Module0, TVarSet, Type, TypeId,
+ Module0, TVarSet, Type, TypeCtor,
TypeBody, Context, Status0, Module)
;
Module = Module0
@@ -3195,19 +3200,19 @@
).
add_special_pred_for_real(SpecialPredId,
- Module0, TVarSet, Type, TypeId, TypeBody, Context, Status0,
+ Module0, TVarSet, Type, TypeCtor, TypeBody, Context, Status0,
Module) :-
adjust_special_pred_status(Status0, SpecialPredId, Status),
module_info_get_special_pred_map(Module0, SpecialPredMap0),
- ( map__contains(SpecialPredMap0, SpecialPredId - TypeId) ->
+ ( map__contains(SpecialPredMap0, SpecialPredId - TypeCtor) ->
Module1 = Module0
;
add_special_pred_decl_for_real(SpecialPredId,
- Module0, TVarSet, Type, TypeId, Context, Status,
+ Module0, TVarSet, Type, TypeCtor, Context, Status,
Module1)
),
module_info_get_special_pred_map(Module1, SpecialPredMap1),
- map__lookup(SpecialPredMap1, SpecialPredId - TypeId, PredId),
+ map__lookup(SpecialPredMap1, SpecialPredId - TypeCtor, PredId),
module_info_preds(Module1, Preds0),
map__lookup(Preds0, PredId, PredInfo0),
% if the type was imported, then the special preds for that
@@ -3242,40 +3247,40 @@
module_info_set_preds(Module1, Preds, Module).
:- pred add_special_pred_decl_list(list(special_pred_id),
- module_info, tvarset, type, type_id, hlds_type_body,
+ module_info, tvarset, type, type_ctor, hlds_type_body,
prog_context, import_status, module_info).
:- mode add_special_pred_decl_list(in, in, in, in, in, in, in, in, out) is det.
add_special_pred_decl_list([], Module, _, _, _, _, _, _, Module).
add_special_pred_decl_list([SpecialPredId | SpecialPredIds], Module0,
- TVarSet, Type, TypeId, TypeBody, Context, Status, Module) :-
+ TVarSet, Type, TypeCtor, TypeBody, Context, Status, Module) :-
add_special_pred_decl(SpecialPredId, Module0,
- TVarSet, Type, TypeId, TypeBody, Context, Status, Module1),
+ TVarSet, Type, TypeCtor, TypeBody, Context, Status, Module1),
add_special_pred_decl_list(SpecialPredIds, Module1,
- TVarSet, Type, TypeId, TypeBody, Context, Status, Module).
+ TVarSet, Type, TypeCtor, TypeBody, Context, Status, Module).
:- pred add_special_pred_decl(special_pred_id,
- module_info, tvarset, type, type_id, hlds_type_body,
+ module_info, tvarset, type, type_ctor, hlds_type_body,
prog_context, import_status, module_info).
:- mode add_special_pred_decl(in, in, in, in, in, in, in, in, out) is det.
-add_special_pred_decl(SpecialPredId, Module0, TVarSet, Type, TypeId, TypeBody,
- Context, Status0, Module) :-
+add_special_pred_decl(SpecialPredId, Module0, TVarSet, Type, TypeCtor,
+ TypeBody, Context, Status0, Module) :-
module_info_globals(Module0, Globals),
globals__lookup_bool_option(Globals, special_preds, GenSpecialPreds),
( GenSpecialPreds = yes ->
add_special_pred_decl_for_real(SpecialPredId, Module0,
- TVarSet, Type, TypeId, Context, Status0, Module)
+ TVarSet, Type, TypeCtor, Context, Status0, Module)
; SpecialPredId = unify ->
add_special_pred_unify_status(TypeBody, Status0, Status),
add_special_pred_decl_for_real(SpecialPredId, Module0,
- TVarSet, Type, TypeId, Context, Status, Module)
+ TVarSet, Type, TypeCtor, Context, Status, Module)
;
Module = Module0
).
add_special_pred_decl_for_real(SpecialPredId,
- Module0, TVarSet, Type, TypeId, Context, Status0,
+ Module0, TVarSet, Type, TypeCtor, Context, Status0,
Module) :-
module_info_name(Module0, ModuleName),
PredName = unqualified(Name),
@@ -3309,7 +3314,7 @@
module_info_set_predicate_table(Module0, PredicateTable,
Module1),
module_info_get_special_pred_map(Module1, SpecialPredMap0),
- map__set(SpecialPredMap0, SpecialPredId - TypeId, PredId,
+ map__set(SpecialPredMap0, SpecialPredId - TypeCtor, PredId,
SpecialPredMap),
module_info_set_special_pred_map(Module1, SpecialPredMap, Module).
Index: compiler/make_tags.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_tags.m,v
retrieving revision 1.35
diff -u -b -r1.35 make_tags.m
--- compiler/make_tags.m 2001/10/31 16:58:08 1.35
+++ compiler/make_tags.m 2002/02/25 16:03:27
@@ -54,13 +54,13 @@
:- import_module prog_data, hlds_data, globals.
:- import_module bool, list.
-% assign_constructor_tags(Constructors, TypeId, Globals, TagValues, IsEnum):
+% assign_constructor_tags(Constructors, TypeCtor, Globals, TagValues, IsEnum):
% Assign a constructor tag to each constructor for a discriminated
% union type, and determine whether the type is an enumeration
% type or not. (`Globals' is passed because exact way in which
% this is done is dependent on a compilation option.)
-:- pred assign_constructor_tags(list(constructor), type_id, globals,
+:- pred assign_constructor_tags(list(constructor), type_ctor, globals,
cons_tag_values, bool).
:- mode assign_constructor_tags(in, in, in, out, out) is det.
@@ -74,7 +74,7 @@
%-----------------------------------------------------------------------------%
-assign_constructor_tags(Ctors, TypeId, Globals, CtorTags, IsEnum) :-
+assign_constructor_tags(Ctors, TypeCtor, Globals, CtorTags, IsEnum) :-
% work out how many tag bits and reserved addresses
% we've got to play with
@@ -142,7 +142,7 @@
( HighLevelCode = yes ->
assign_reserved_symbolic_addresses(
LeftOverConstants0,
- LeftOverConstants, TypeId,
+ LeftOverConstants, TypeCtor,
CtorTags1, CtorTags2,
0, NumReservedObjects)
;
@@ -212,12 +212,12 @@
% assign reserved_object(CtorName, CtorArity) representations
% to the specified constructors
:- pred assign_reserved_symbolic_addresses(list(constructor),
- list(constructor), type_id, cons_tag_values, cons_tag_values,
+ list(constructor), type_ctor, cons_tag_values, cons_tag_values,
int, int).
:- mode assign_reserved_symbolic_addresses(in, out, in, in, out, in, in) is det.
assign_reserved_symbolic_addresses([], [], _, CtorTags, CtorTags, _, _).
-assign_reserved_symbolic_addresses([Ctor | Ctors], LeftOverConstants, TypeId,
+assign_reserved_symbolic_addresses([Ctor | Ctors], LeftOverConstants, TypeCtor,
CtorTags0, CtorTags, Num, Max) :-
( Num >= Max ->
LeftOverConstants = [Ctor | Ctors],
@@ -225,11 +225,11 @@
;
Ctor = ctor(_ExistQVars, _Constraints, Name, Args),
Arity = list__length(Args),
- Tag = reserved_address(reserved_object(TypeId, Name, Arity)),
+ Tag = reserved_address(reserved_object(TypeCtor, Name, Arity)),
make_cons_id_from_qualified_sym_name(Name, Args, ConsId),
map__set(CtorTags0, ConsId, Tag, CtorTags1),
assign_reserved_symbolic_addresses(Ctors, LeftOverConstants,
- TypeId, CtorTags1, CtorTags, Num + 1, Max)
+ TypeCtor, CtorTags1, CtorTags, Num + 1, Max)
).
:- pred assign_constant_tags(list(constructor), cons_tag_values,
Index: compiler/ml_call_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_call_gen.m,v
retrieving revision 1.30
diff -u -b -r1.30 ml_call_gen.m
--- compiler/ml_call_gen.m 2002/02/06 18:44:18 1.30
+++ compiler/ml_call_gen.m 2002/02/25 16:03:29
@@ -788,13 +788,14 @@
% to the concrete instance. Also when converting to
% array(T) from array(X) we should cast to array(T).
%
- { type_to_type_id(SourceType, SourceTypeId, SourceTypeArgs) },
- { type_to_type_id(DestType, DestTypeId, DestTypeArgs) },
+ { type_to_ctor_and_args(SourceType, SourceTypeCtor,
+ SourceTypeArgs) },
+ { type_to_ctor_and_args(DestType, DestTypeCtor, DestTypeArgs) },
(
- { type_id_is_array(SourceTypeId) },
+ { type_ctor_is_array(SourceTypeCtor) },
{ SourceTypeArgs = [term__variable(_)] }
;
- { type_id_is_array(DestTypeId) },
+ { type_ctor_is_array(DestTypeCtor) },
{ DestTypeArgs = [term__variable(_)] }
)
->
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.55
diff -u -b -r1.55 ml_code_util.m
--- compiler/ml_code_util.m 2002/02/18 07:00:55 1.55
+++ compiler/ml_code_util.m 2002/02/25 16:03:29
@@ -1405,16 +1405,16 @@
->
(
special_pred_get_type(PredName, ArgTypes, Type),
- type_to_type_id(Type, TypeId, _),
- % All type_ids other than tuples here should be
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ % All type_ctors other than tuples here should be
% module qualified, since builtin types are handled
% separately in polymorphism.m.
(
- TypeId = unqualified(TypeName) - TypeArity,
- type_id_is_tuple(TypeId),
+ TypeCtor = unqualified(TypeName) - TypeArity,
+ type_ctor_is_tuple(TypeCtor),
mercury_public_builtin_module(TypeModule)
;
- TypeId = qualified(TypeModule, TypeName)
+ TypeCtor = qualified(TypeModule, TypeName)
- TypeArity
)
->
Index: compiler/ml_type_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_type_gen.m,v
retrieving revision 1.24
diff -u -b -r1.24 ml_type_gen.m
--- compiler/ml_type_gen.m 2002/02/26 02:45:48 1.24
+++ compiler/ml_type_gen.m 2002/02/26 02:49:05
@@ -33,10 +33,10 @@
:- pred ml_gen_types(module_info, mlds__defns, io__state, io__state).
:- mode ml_gen_types(in, out, di, uo) is det.
- % Given an HLDS type_id, generate the MLDS class name and arity
+ % Given an HLDS type_ctor, generate the MLDS class name and arity
% for the corresponding MLDS type.
%
-:- pred ml_gen_type_name(type_id, mlds__class, arity).
+:- pred ml_gen_type_name(type_ctor, mlds__class, arity).
:- mode ml_gen_type_name(in, out, out) is det.
% Return the declaration flags appropriate for a type.
@@ -83,29 +83,29 @@
globals__io_lookup_bool_option(highlevel_data, HighLevelData),
( { HighLevelData = yes } ->
{ module_info_types(ModuleInfo, TypeTable) },
- { map__keys(TypeTable, TypeIds) },
+ { map__keys(TypeTable, TypeCtors) },
{ list__foldl(ml_gen_type_defn(ModuleInfo, TypeTable),
- TypeIds, [], MLDS_TypeDefns) }
+ TypeCtors, [], MLDS_TypeDefns) }
;
{ MLDS_TypeDefns = [] }
).
-:- pred ml_gen_type_defn(module_info, type_table, type_id,
+:- pred ml_gen_type_defn(module_info, type_table, type_ctor,
mlds__defns, mlds__defns).
:- mode ml_gen_type_defn(in, in, in, in, out) is det.
-ml_gen_type_defn(ModuleInfo, TypeTable, TypeId, MLDS_Defns0, MLDS_Defns) :-
- map__lookup(TypeTable, TypeId, TypeDefn),
+ml_gen_type_defn(ModuleInfo, TypeTable, TypeCtor, MLDS_Defns0, MLDS_Defns) :-
+ map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_status(TypeDefn, Status),
( status_defined_in_this_module(Status, yes) ->
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
- ml_gen_type_2(TypeBody, ModuleInfo, TypeId, TypeDefn,
+ ml_gen_type_2(TypeBody, ModuleInfo, TypeCtor, TypeDefn,
MLDS_Defns0, MLDS_Defns)
;
MLDS_Defns = MLDS_Defns0
).
-:- pred ml_gen_type_2(hlds_type_body, module_info, type_id, hlds_type_defn,
+:- pred ml_gen_type_2(hlds_type_body, module_info, type_ctor, hlds_type_defn,
mlds__defns, mlds__defns).
:- mode ml_gen_type_2(in, in, in, in, in, out) is det.
@@ -114,13 +114,13 @@
% For a description of the problems with equivalence types,
% see our BABEL'01 paper "Compiling Mercury to the .NET CLR".
ml_gen_type_2(du_type(Ctors, TagValues, IsEnum, MaybeEqualityPred),
- ModuleInfo, TypeId, TypeDefn) -->
+ ModuleInfo, TypeCtor, TypeDefn) -->
{ ml_gen_equality_members(MaybeEqualityPred, MaybeEqualityMembers) },
( { IsEnum = yes } ->
- ml_gen_enum_type(TypeId, TypeDefn, Ctors, TagValues,
+ ml_gen_enum_type(TypeCtor, TypeDefn, Ctors, TagValues,
MaybeEqualityMembers)
;
- ml_gen_du_parent_type(ModuleInfo, TypeId, TypeDefn,
+ ml_gen_du_parent_type(ModuleInfo, TypeCtor, TypeDefn,
Ctors, TagValues, MaybeEqualityMembers)
).
% XXX Fixme! Same issues here as for eqv_type/1.
@@ -145,17 +145,17 @@
% generator can treat it specially if need be (e.g. generating
% a C enum rather than a class).
%
-:- pred ml_gen_enum_type(type_id, hlds_type_defn, list(constructor),
+:- pred ml_gen_enum_type(type_ctor, hlds_type_defn, list(constructor),
cons_tag_values, mlds__defns, mlds__defns, mlds__defns).
:- mode ml_gen_enum_type(in, in, in, in, in, in, out) is det.
-ml_gen_enum_type(TypeId, TypeDefn, Ctors, TagValues,
+ml_gen_enum_type(TypeCtor, TypeDefn, Ctors, TagValues,
MaybeEqualityMembers, MLDS_Defns0, MLDS_Defns) :-
hlds_data__get_type_defn_context(TypeDefn, Context),
MLDS_Context = mlds__make_context(Context),
% generate the class name
- ml_gen_type_name(TypeId, qual(_, MLDS_ClassName), MLDS_ClassArity),
+ ml_gen_type_name(TypeCtor, qual(_, MLDS_ClassName), MLDS_ClassArity),
% generate the class members
ValueMember = ml_gen_enum_value_member(Context),
@@ -296,23 +296,24 @@
%
% };
%
+ %
% If there is only one constructor which is not represented
% as a reserved_object, then we don't generate a nested derived
% class for that constructor, instead we just allocate the fields
% in the base class.
%
-:- pred ml_gen_du_parent_type(module_info, type_id, hlds_type_defn,
+:- pred ml_gen_du_parent_type(module_info, type_ctor, hlds_type_defn,
list(constructor), cons_tag_values, mlds__defns,
mlds__defns, mlds__defns).
:- mode ml_gen_du_parent_type(in, in, in, in, in, in, in, out) is det.
-ml_gen_du_parent_type(ModuleInfo, TypeId, TypeDefn, Ctors, TagValues,
+ml_gen_du_parent_type(ModuleInfo, TypeCtor, TypeDefn, Ctors, TagValues,
MaybeEqualityMembers, MLDS_Defns0, MLDS_Defns) :-
hlds_data__get_type_defn_context(TypeDefn, Context),
MLDS_Context = mlds__make_context(Context),
% generate the class name
- ml_gen_type_name(TypeId, QualBaseClassName, BaseClassArity),
+ ml_gen_type_name(TypeCtor, QualBaseClassName, BaseClassArity),
BaseClassId = mlds__class_type(QualBaseClassName, BaseClassArity,
mlds__class),
QualBaseClassName = qual(BaseClassModuleName, BaseClassName),
Index: compiler/ml_unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.52
diff -u -b -r1.52 ml_unify_gen.m
--- compiler/ml_unify_gen.m 2002/02/20 03:14:13 1.52
+++ compiler/ml_unify_gen.m 2002/02/25 16:03:31
@@ -416,9 +416,9 @@
ModuleName = ModuleName0
},
{ MLDS_Module = mercury_module_name_to_mlds(ModuleName) },
- { RttiTypeId = rtti_type_id(ModuleName, TypeName, TypeArity) },
+ { RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, TypeArity) },
{ DataAddr = data_addr(MLDS_Module,
- rtti(RttiTypeId, type_ctor_info)) },
+ rtti(RttiTypeCtor, type_ctor_info)) },
{ Rval = unop(cast(MLDS_VarType),
const(data_addr_const(DataAddr))) }.
@@ -485,11 +485,11 @@
ml_gen_reserved_address(_, null_pointer, MLDS_Type) = const(null(MLDS_Type)).
ml_gen_reserved_address(_, small_pointer(Int), MLDS_Type) =
unop(cast(MLDS_Type), const(int_const(Int))).
-ml_gen_reserved_address(ModuleInfo, reserved_object(TypeId, QualCtorName,
+ml_gen_reserved_address(ModuleInfo, reserved_object(TypeCtor, QualCtorName,
CtorArity), _Type) = Rval :-
( QualCtorName = qualified(ModuleName, CtorName) ->
MLDS_ModuleName = mercury_module_name_to_mlds(ModuleName),
- TypeId = TypeName - TypeArity,
+ TypeCtor = TypeName - TypeArity,
unqualify_name(TypeName, UnqualTypeName),
MLDS_TypeName = mlds__append_class_qualifier(MLDS_ModuleName,
UnqualTypeName, TypeArity),
@@ -1351,11 +1351,16 @@
UsesBaseClass = no,
MaybeConsId = yes(ConsId),
ConsId = cons(CtorSymName, CtorArity),
- ( MLDS_Type = mlds__class_type(QualTypeName,
+ (
+ MLDS_Type = mlds__class_type(QualTypeName,
TypeArity, _)
- ; MLDS_Type = mercury_type(MercuryType, user_type, _),
- type_to_type_id(MercuryType, TypeId, _ArgsTypes),
- ml_gen_type_name(TypeId, QualTypeName, TypeArity)
+ ;
+ MLDS_Type = mercury_type(MercuryType,
+ user_type, _),
+ type_to_ctor_and_args(MercuryType, TypeCtor,
+ _ArgsTypes),
+ ml_gen_type_name(TypeCtor, QualTypeName,
+ TypeArity)
)
->
% If so, append the name of the derived class to
@@ -1377,9 +1382,9 @@
% declarating static constants we want just the
% class type, not the pointer type.
MLDS_Type = mercury_type(MercuryType, user_type, _),
- type_to_type_id(MercuryType, TypeId, _ArgsTypes)
+ type_to_ctor_and_args(MercuryType, TypeCtor, _ArgsTypes)
->
- ml_gen_type_name(TypeId, ClassName, ClassArity),
+ ml_gen_type_name(TypeCtor, ClassName, ClassArity),
ConstType = mlds__class_type(ClassName, ClassArity,
mlds__class)
;
@@ -1468,9 +1473,9 @@
CtorId = cons(_, _),
\+ is_introduced_type_info_type(Type)
->
- % Use the type to determine the type_id
- ( type_to_type_id(Type, TypeId0, _) ->
- TypeId = TypeId0
+ % Use the type to determine the type_ctor
+ ( type_to_ctor_and_args(Type, TypeCtor0, _) ->
+ TypeCtor = TypeCtor0
;
% the type-checker should ensure that this never
% happens: the type for a ctor_id should never
@@ -1479,9 +1484,9 @@
"cons_id_to_arg_types: invalid type")
),
- % Given the type_id, lookup up the constructor
+ % Given the type_ctor, lookup up the constructor
(
- type_util__get_cons_defn(ModuleInfo, TypeId, CtorId,
+ type_util__get_cons_defn(ModuleInfo, TypeCtor, CtorId,
ConsDefn)
->
ConsDefn = hlds_cons_defn(_, _, ConsArgDefns, _, _),
@@ -2372,12 +2377,12 @@
FieldName = "data_tag",
% Figure out the type name and arity
- ( type_to_type_id(Type, TypeId0, _) ->
- TypeId = TypeId0
+ ( type_to_ctor_and_args(Type, TypeCtor0, _) ->
+ TypeCtor = TypeCtor0
;
error("ml_gen_hl_tag_field_id: invalid type")
),
- ml_gen_type_name(TypeId, qual(MLDS_Module, TypeName), TypeArity),
+ ml_gen_type_name(TypeCtor, qual(MLDS_Module, TypeName), TypeArity),
% Figure out whether this type has constructors both
% with and without secondary tags. If so, then the
@@ -2385,7 +2390,7 @@
% derived from the base class for this type,
% rather than in the base class itself.
module_info_types(ModuleInfo, TypeTable),
- TypeDefn = map__lookup(TypeTable, TypeId),
+ TypeDefn = map__lookup(TypeTable, TypeCtor),
hlds_data__get_type_defn_body(TypeDefn, TypeDefnBody),
( TypeDefnBody = du_type(Ctors, TagValues, _, _) ->
(
@@ -2425,9 +2430,9 @@
ml_gen_field_id(Type, Tag, ConsName, ConsArity, FieldName) = FieldId :-
(
- type_to_type_id(Type, TypeId, _)
+ type_to_ctor_and_args(Type, TypeCtor, _)
->
- ml_gen_type_name(TypeId, QualTypeName, TypeArity),
+ ml_gen_type_name(TypeCtor, QualTypeName, TypeArity),
QualTypeName = qual(MLDS_Module, TypeName),
TypeQualifier = mlds__append_class_qualifier(
MLDS_Module, TypeName, TypeArity),
Index: compiler/mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.83
diff -u -b -r1.83 mlds.m
--- compiler/mlds.m 2002/02/11 11:27:05 1.83
+++ compiler/mlds.m 2002/02/25 16:03:31
@@ -1493,7 +1493,7 @@
%
% Stuff for handling polymorphism/RTTI and type classes.
%
- ; rtti(rtti_type_id, rtti_name)
+ ; rtti(rtti_type_ctor, rtti_name)
; base_typeclass_info(
hlds_data__class_id, % class name & class arity,
string % a mangled string that encodes
@@ -1618,15 +1618,15 @@
mercury_type_to_mlds_type(ModuleInfo, Type) = MLDSType :-
(
- type_to_type_id(Type, TypeId, [ElemType]),
- TypeId = qualified(unqualified("array"), "array") - 1
+ type_to_ctor_and_args(Type, TypeCtor, [ElemType]),
+ TypeCtor = qualified(unqualified("array"), "array") - 1
->
MLDSElemType = mercury_type_to_mlds_type(ModuleInfo, ElemType),
MLDSType = mlds__mercury_array_type(MLDSElemType)
;
- type_to_type_id(Type, TypeId, _),
+ type_to_ctor_and_args(Type, TypeCtor, _),
module_info_types(ModuleInfo, Types),
- map__search(Types, TypeId, TypeDefn),
+ map__search(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, Body),
Body = foreign_type(IsBoxed, ForeignType, ForeignLocation)
->
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.120
diff -u -b -r1.120 mlds_to_c.m
--- compiler/mlds_to_c.m 2002/02/18 07:00:56 1.120
+++ compiler/mlds_to_c.m 2002/02/25 16:03:32
@@ -908,8 +908,8 @@
ClassType = Type
;
Type = mercury_type(MercuryType, user_type, _),
- type_to_type_id(MercuryType, TypeId, _ArgsTypes),
- ml_gen_type_name(TypeId, ClassName, ClassArity),
+ type_to_ctor_and_args(MercuryType, TypeCtor, _ArgsTypes),
+ ml_gen_type_name(TypeCtor, ClassName, ClassArity),
ClassType = mlds__class_type(ClassName, ClassArity,
mlds__class)
}
@@ -1560,8 +1560,8 @@
mlds_output_data_name(common(Num)) -->
io__write_string("common_"),
io__write_int(Num).
-mlds_output_data_name(rtti(RttiTypeId, RttiName)) -->
- { rtti__addr_to_string(RttiTypeId, RttiName, RttiAddrName) },
+mlds_output_data_name(rtti(RttiTypeCtor, RttiName)) -->
+ { rtti__addr_to_string(RttiTypeCtor, RttiName, RttiAddrName) },
io__write_string(RttiAddrName).
mlds_output_data_name(base_typeclass_info(ClassId, InstanceStr)) -->
{ llds_out__make_base_typeclass_info_name(ClassId, InstanceStr,
@@ -1733,8 +1733,8 @@
mlds_output_mercury_user_type_prefix(Type, TypeCategory) -->
globals__io_lookup_bool_option(highlevel_data, HighLevelData),
( { HighLevelData = yes } ->
- ( { type_to_type_id(Type, TypeId, _ArgsTypes) } ->
- mlds_output_mercury_user_type_name(TypeId,
+ ( { type_to_ctor_and_args(Type, TypeCtor, _ArgsTypes) } ->
+ mlds_output_mercury_user_type_name(TypeCtor,
TypeCategory)
;
{ error("mlds_output_mercury_user_type_prefix") }
@@ -1745,12 +1745,12 @@
io__write_string("MR_Word")
).
-:- pred mlds_output_mercury_user_type_name(type_id, builtin_type,
+:- pred mlds_output_mercury_user_type_name(type_ctor, builtin_type,
io__state, io__state).
:- mode mlds_output_mercury_user_type_name(in, in, di, uo) is det.
-mlds_output_mercury_user_type_name(TypeId, TypeCategory) -->
- { ml_gen_type_name(TypeId, ClassName, ClassArity) },
+mlds_output_mercury_user_type_name(TypeCtor, TypeCategory) -->
+ { ml_gen_type_name(TypeCtor, ClassName, ClassArity) },
{ TypeCategory = enum_type ->
MLDS_Type = mlds__class_type(ClassName,
ClassArity, mlds__enum)
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.63
diff -u -b -r1.63 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m 2002/02/18 07:00:57 1.63
+++ compiler/mlds_to_gcc.m 2002/02/25 16:03:32
@@ -2062,7 +2062,7 @@
{ error("mlds_rtti_type: type_var") }.
build_pseudo_type_info_type(type_ctor_info(_), GCC_Type) -->
build_rtti_type(type_ctor_info, no_size, GCC_Type).
-build_pseudo_type_info_type(type_info(_TypeId, ArgTypes), GCC_Type) -->
+build_pseudo_type_info_type(type_info(_TypeCtor, ArgTypes), GCC_Type) -->
{ Arity = list__length(ArgTypes) },
% typedef struct {
% MR_TypeCtorInfo MR_pti_type_ctor_info;
@@ -2077,7 +2077,7 @@
[MR_TypeCtorInfo - "MR_pti_type_ctor_info",
MR_PseudoTypeInfoArray - "MR_pti_first_order_arg_pseudo_typeinfos"],
GCC_Type).
-build_pseudo_type_info_type(higher_order_type_info(_TypeId, _Arity,
+build_pseudo_type_info_type(higher_order_type_info(_TypeCtor, _Arity,
ArgTypes), GCC_Type) -->
{ Arity = list__length(ArgTypes) },
% struct NAME { \
@@ -2262,10 +2262,10 @@
llds_out__name_mangle(ml_var_name_to_string(Name), MangledName).
build_data_name(common(Num)) =
string__format("common_%d", [i(Num)]).
-build_data_name(rtti(RttiTypeId0, RttiName0)) = RttiAddrName :-
- RttiTypeId = fixup_rtti_type_id(RttiTypeId0),
+build_data_name(rtti(RttiTypeCtor0, RttiName0)) = RttiAddrName :-
+ RttiTypeCtor = fixup_rtti_type_ctor(RttiTypeCtor0),
RttiName = fixup_rtti_name(RttiName0),
- rtti__addr_to_string(RttiTypeId, RttiName, RttiAddrName).
+ rtti__addr_to_string(RttiTypeCtor, RttiName, RttiAddrName).
build_data_name(base_typeclass_info(ClassId, InstanceStr)) = Name :-
llds_out__make_base_typeclass_info_name(ClassId, InstanceStr,
Name).
@@ -2288,36 +2288,36 @@
% XXX sometimes earlier stages of the compiler forget to add
% the appropriate qualifiers for stuff in the `builtin' module;
% we fix that here.
-:- func fixup_rtti_type_id(rtti_type_id) = rtti_type_id.
-fixup_rtti_type_id(RttiTypeId0) = RttiTypeId :-
+:- func fixup_rtti_type_ctor(rtti_type_ctor) = rtti_type_ctor.
+fixup_rtti_type_ctor(RttiTypeCtor0) = RttiTypeCtor :-
(
- RttiTypeId0 = rtti_type_id(ModuleName0, Name, Arity),
+ RttiTypeCtor0 = rtti_type_ctor(ModuleName0, Name, Arity),
ModuleName0 = unqualified("")
->
ModuleName = unqualified("builtin"),
- RttiTypeId = rtti_type_id(ModuleName, Name, Arity)
+ RttiTypeCtor = rtti_type_ctor(ModuleName, Name, Arity)
;
- RttiTypeId = RttiTypeId0
+ RttiTypeCtor = RttiTypeCtor0
).
:- func fixup_rtti_name(rtti_name) = rtti_name.
-fixup_rtti_name(RttiTypeId0) = RttiTypeId :-
+fixup_rtti_name(RttiTypeCtor0) = RttiTypeCtor :-
(
- RttiTypeId0 = pseudo_type_info(PseudoTypeInfo0)
+ RttiTypeCtor0 = pseudo_type_info(PseudoTypeInfo0)
->
- RttiTypeId = pseudo_type_info(
+ RttiTypeCtor = pseudo_type_info(
fixup_pseudo_type_info(PseudoTypeInfo0))
;
- RttiTypeId = RttiTypeId0
+ RttiTypeCtor = RttiTypeCtor0
).
:- func fixup_pseudo_type_info(pseudo_type_info) = pseudo_type_info.
fixup_pseudo_type_info(PseudoTypeInfo0) = PseudoTypeInfo :-
(
- PseudoTypeInfo0 = type_ctor_info(RttiTypeId0)
+ PseudoTypeInfo0 = type_ctor_info(RttiTypeCtor0)
->
PseudoTypeInfo = type_ctor_info(
- fixup_rtti_type_id(RttiTypeId0))
+ fixup_rtti_type_ctor(RttiTypeCtor0))
;
PseudoTypeInfo = PseudoTypeInfo0
).
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.104
diff -u -b -r1.104 mlds_to_il.m
--- compiler/mlds_to_il.m 2002/02/12 17:06:53 1.104
+++ compiler/mlds_to_il.m 2002/02/25 16:03:32
@@ -1198,8 +1198,8 @@
= mangle_mlds_var_name(MLDSVarName).
mangle_dataname(common(Int))
= string__format("common_%s", [i(Int)]).
-mangle_dataname(rtti(RttiTypeId, RttiName)) = MangledName :-
- rtti__addr_to_string(RttiTypeId, RttiName, MangledName).
+mangle_dataname(rtti(RttiTypeCtor, RttiName)) = MangledName :-
+ rtti__addr_to_string(RttiTypeCtor, RttiName, MangledName).
mangle_dataname(base_typeclass_info(ClassId, InstanceStr)) = MangledName :-
llds_out__make_base_typeclass_info_name(ClassId, InstanceStr,
MangledName).
@@ -2983,13 +2983,13 @@
:- func mercury_type_to_highlevel_class_type(mercury_type) = ilds__type.
mercury_type_to_highlevel_class_type(MercuryType) = ILType :-
- ( type_to_type_id(MercuryType, TypeId, _Args) ->
- ml_gen_type_name(TypeId, ClassName, Arity),
+ ( type_to_ctor_and_args(MercuryType, TypeCtor, _Args) ->
+ ml_gen_type_name(TypeCtor, ClassName, Arity),
ILType = ilds__type([], class(
mlds_class_name_to_ilds_class_name(ClassName, Arity)
))
;
- unexpected(this_file, "type_to_type_id failed")
+ unexpected(this_file, "type_to_ctor_and_args failed")
).
:- func mlds_class_name_to_ilds_class_name(mlds__class, arity) =
@@ -3217,14 +3217,16 @@
SymName = qualified(qualified(unqualified("mercury"),
LibModuleName0), wrapper_class_name),
(
- DataName = rtti(RttiTypeId, RttiName),
- RttiTypeId = rtti_type_id(_, Name, Arity),
+ DataName = rtti(RttiTypeCtor, RttiName),
+ RttiTypeCtor = rtti_type_ctor(_, Name, Arity),
% Only the type_ctor_infos for the following
% RTTI names are defined in MC++.
- ( RttiName = type_ctor_info
- ; RttiName = pseudo_type_info(PseudoTypeInfo),
- PseudoTypeInfo = type_ctor_info(RttiTypeId)
+ (
+ RttiName = type_ctor_info
+ ;
+ RttiName = pseudo_type_info(PseudoTypeInfo),
+ PseudoTypeInfo = type_ctor_info(RttiTypeCtor)
),
( LibModuleName0 = "builtin",
(
@@ -3277,8 +3279,8 @@
Name = mangle_mlds_var_name(MLDSVarName).
mangle_dataname(common(Int), MangledName) :-
string__format("common_%s", [i(Int)], MangledName).
-mangle_dataname(rtti(RttiTypeId, RttiName), MangledName) :-
- rtti__addr_to_string(RttiTypeId, RttiName, MangledName).
+mangle_dataname(rtti(RttiTypeCtor, RttiName), MangledName) :-
+ rtti__addr_to_string(RttiTypeCtor, RttiName, MangledName).
mangle_dataname(base_typeclass_info(ClassId, InstanceStr), MangledName) :-
llds_out__make_base_typeclass_info_name(ClassId, InstanceStr,
MangledName).
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.24
diff -u -b -r1.24 mlds_to_java.m
--- compiler/mlds_to_java.m 2002/02/22 01:51:09 1.24
+++ compiler/mlds_to_java.m 2002/02/25 16:03:33
@@ -1390,7 +1390,6 @@
io__write_string("}\n") % end the function
).
-
:- pred output_func_decl(indent, qualified_entity_name, ctor_data,
mlds__context, func_params, io__state, io__state).
:- mode output_func_decl(in, in, in, in, in, di, uo) is det.
@@ -1583,8 +1582,8 @@
% XXX Most of this code doesn't yet work/hasn't been implemented in the Java
% backend.
%
-output_data_name(rtti(RttiTypeId, RttiName)) -->
- { rtti__addr_to_string(RttiTypeId, RttiName, RttiAddrName) },
+output_data_name(rtti(RttiTypeCtor, RttiName)) -->
+ { rtti__addr_to_string(RttiTypeCtor, RttiName, RttiAddrName) },
io__write_string(RttiAddrName).
output_data_name(base_typeclass_info(ClassId, InstanceStr)) -->
{ llds_out__make_base_typeclass_info_name(ClassId, InstanceStr,
@@ -1701,8 +1700,8 @@
:- mode output_mercury_user_type(in, in, di, uo) is det.
output_mercury_user_type(Type, TypeCategory) -->
- ( { type_to_type_id(Type, TypeId, _ArgsTypes) } ->
- { ml_gen_type_name(TypeId, ClassName, ClassArity) },
+ ( { type_to_ctor_and_args(Type, TypeCtor, _ArgsTypes) } ->
+ { ml_gen_type_name(TypeCtor, ClassName, ClassArity) },
( { TypeCategory = enum_type } ->
{ MLDS_Type = mlds__class_type(ClassName,
ClassArity, mlds__enum) }
Index: compiler/mode_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mode_util.m,v
retrieving revision 1.139
diff -u -b -r1.139 mode_util.m
--- compiler/mode_util.m 2001/11/08 05:56:01 1.139
+++ compiler/mode_util.m 2002/02/25 16:03:33
@@ -337,7 +337,7 @@
mode_to_arg_mode(ModuleInfo, Mode, Type, ArgMode) :-
mode_to_arg_mode_2(ModuleInfo, Mode, Type, [], ArgMode).
-:- pred mode_to_arg_mode_2(module_info, mode, type, list(type_id), arg_mode).
+:- pred mode_to_arg_mode_2(module_info, mode, type, list(type_ctor), arg_mode).
:- mode mode_to_arg_mode_2(in, in, in, in, out) is det.
mode_to_arg_mode_2(ModuleInfo, Mode, Type, ContainingTypes, ArgMode) :-
@@ -353,8 +353,8 @@
% is this a no_tag type?
type_is_no_tag_type(ModuleInfo, Type, FunctorName, ArgType),
% avoid infinite recursion
- type_to_type_id(Type, TypeId, _TypeArgs),
- \+ list__member(TypeId, ContainingTypes)
+ type_to_ctor_and_args(Type, TypeCtor, _TypeArgs),
+ \+ list__member(TypeCtor, ContainingTypes)
->
% the arg_mode will be determined by the mode and
% type of the functor's argument,
@@ -368,7 +368,7 @@
FinalArgInst),
ModeOfArg = (InitialArgInst -> FinalArgInst),
mode_to_arg_mode_2(ModuleInfo, ModeOfArg, ArgType,
- [TypeId | ContainingTypes], ArgMode)
+ [TypeCtor | ContainingTypes], ArgMode)
;
base_mode_to_arg_mode(ModuleInfo, Mode, ArgMode)
).
@@ -875,10 +875,10 @@
BoundInst = functor(Functor, ArgInsts)
), BoundInsts0, BoundInsts)
;
- type_to_type_id(Type, TypeId, TypeArgs),
- TypeId = qualified(TypeModule, _) - _,
+ type_to_ctor_and_args(Type, TypeCtor, TypeArgs),
+ TypeCtor = qualified(TypeModule, _) - _,
module_info_types(ModuleInfo, TypeTable),
- map__search(TypeTable, TypeId, TypeDefn),
+ map__search(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_tparams(TypeDefn, TypeParams0),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody = du_type(Constructors, _, _, _)
Index: compiler/modecheck_unify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modecheck_unify.m,v
retrieving revision 1.47
diff -u -b -r1.47 modecheck_unify.m
--- compiler/modecheck_unify.m 2001/07/31 18:37:18 1.47
+++ compiler/modecheck_unify.m 2002/02/25 16:03:34
@@ -404,8 +404,8 @@
%
(
ConsId0 = cons(Name0, OrigArity),
- type_to_type_id(TypeOfX, TypeId, _),
- TypeId = qualified(TypeModule, _) - _
+ type_to_ctor_and_args(TypeOfX, TypeCtor, _),
+ TypeCtor = qualified(TypeModule, _) - _
->
unqualify_name(Name0, UnqualName),
Name = qualified(TypeModule, UnqualName),
@@ -949,11 +949,11 @@
% procedure that will be used to implement this complicated
% unification.
%
- type_to_type_id(Type, TypeId, _)
+ type_to_ctor_and_args(Type, TypeCtor, _)
->
mode_info_get_context(ModeInfo3, Context),
mode_info_get_instvarset(ModeInfo3, InstVarSet),
- unify_proc__request_unify(TypeId - UniMode, InstVarSet,
+ unify_proc__request_unify(TypeCtor - UniMode, InstVarSet,
Det, Context, ModuleInfo3, ModuleInfo),
mode_info_set_module_info(ModeInfo3, ModuleInfo,
ModeInfo)
Index: compiler/modes.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modes.m,v
retrieving revision 1.254
diff -u -b -r1.254 modes.m
--- compiler/modes.m 2001/07/20 14:14:05 1.254
+++ compiler/modes.m 2002/02/25 16:03:34
@@ -2141,8 +2141,8 @@
CallUnifyContext = yes(call_unify_context(
Var, var(Var), UnifyContext)),
(
- type_to_type_id(VarType, TypeId, _TypeArgs),
- TypeId = qualified(TypeModule, TypeName) -
+ type_to_ctor_and_args(VarType, TypeCtor, _TypeArgs),
+ TypeCtor = qualified(TypeModule, TypeName) -
_TypeArity,
string__append(TypeName, "_init_any", PredName),
modes__build_call(TypeModule, PredName, [Var],
Index: compiler/module_qual.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/module_qual.m,v
retrieving revision 1.73
diff -u -b -r1.73 module_qual.m
--- compiler/module_qual.m 2002/02/26 02:45:48 1.73
+++ compiler/module_qual.m 2002/02/26 02:49:06
@@ -248,7 +248,7 @@
collect_mq_info_2(pred_or_func_mode(_,_,_,_,_,_), Info, Info).
collect_mq_info_2(pragma(Pragma), Info0, Info) :-
( Pragma = foreign_type(_, Type, SymName) ->
- ( type_to_type_id(Type, _ - Arity0, _) ->
+ ( type_to_ctor_and_args(Type, _ - Arity0, _) ->
Arity = Arity0
;
Arity = 0
@@ -840,23 +840,23 @@
qualify_type(term__variable(Var), term__variable(Var), Info, Info) --> [].
qualify_type(Type0, Type, Info0, Info) -->
{ Type0 = term__functor(_, _, _) },
- ( { type_to_type_id(Type0, TypeId0, Args0) } ->
- ( { is_builtin_atomic_type(TypeId0) } ->
- { TypeId = TypeId0 },
+ ( { type_to_ctor_and_args(Type0, TypeCtor0, Args0) } ->
+ ( { is_builtin_atomic_type(TypeCtor0) } ->
+ { TypeCtor = TypeCtor0 },
{ Info1 = Info0 }
- ; { type_id_is_higher_order(TypeId0, _, _) } ->
- { TypeId = TypeId0 },
+ ; { type_ctor_is_higher_order(TypeCtor0, _, _) } ->
+ { TypeCtor = TypeCtor0 },
{ Info1 = Info0 }
- ; { type_id_is_tuple(TypeId0) } ->
- { TypeId = TypeId0 },
+ ; { type_ctor_is_tuple(TypeCtor0) } ->
+ { TypeCtor = TypeCtor0 },
{ Info1 = Info0 }
;
{ mq_info_get_types(Info0, Types) },
- find_unique_match(TypeId0, TypeId, Types,
+ find_unique_match(TypeCtor0, TypeCtor, Types,
type_id, Info0, Info1)
),
qualify_type_list(Args0, Args, Info1, Info2),
- { construct_type(TypeId, Args, Type) }
+ { construct_type(TypeCtor, Args, Type) }
;
{ mq_info_get_error_context(Info0, ErrorContext) },
report_invalid_type(Type0, ErrorContext),
@@ -1399,10 +1399,10 @@
%-----------------------------------------------------------------------------%
- % is_builtin_atomic_type(TypeId)
- % is true iff 'TypeId' is the type_id of a builtin atomic type
+ % is_builtin_atomic_type(TypeCtor)
+ % is true iff 'TypeCtor' is the type_ctor of a builtin atomic type
-:- pred is_builtin_atomic_type(type_id).
+:- pred is_builtin_atomic_type(type_ctor).
:- mode is_builtin_atomic_type(in) is semidet.
is_builtin_atomic_type(unqualified("int") - 0).
Index: compiler/opt_debug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/opt_debug.m,v
retrieving revision 1.118
diff -u -b -r1.118 opt_debug.m
--- compiler/opt_debug.m 2002/02/20 03:14:14 1.118
+++ compiler/opt_debug.m 2002/02/25 16:03:35
@@ -64,8 +64,8 @@
:- pred opt_debug__dump_data_name(data_name, string).
:- mode opt_debug__dump_data_name(in, out) is det.
-:- pred opt_debug__dump_rtti_type_id(rtti_type_id, string).
-:- mode opt_debug__dump_rtti_type_id(in, out) is det.
+:- pred opt_debug__dump_rtti_type_ctor(rtti_type_ctor, string).
+:- mode opt_debug__dump_rtti_type_ctor(in, out) is det.
:- pred opt_debug__dump_rtti_name(rtti_name, string).
:- mode opt_debug__dump_rtti_name(in, out) is det.
@@ -334,11 +334,12 @@
opt_debug__dump_data_name(DataName, DataName_str),
string__append_list(
["data_addr(", ModuleName_str, ", ", DataName_str, ")"], Str).
-opt_debug__dump_data_addr(rtti_addr(RttiTypeId, DataName), Str) :-
- opt_debug__dump_rtti_type_id(RttiTypeId, RttiTypeId_str),
+opt_debug__dump_data_addr(rtti_addr(RttiTypeCtor, DataName), Str) :-
+ opt_debug__dump_rtti_type_ctor(RttiTypeCtor, RttiTypeCtor_str),
opt_debug__dump_rtti_name(DataName, DataName_str),
string__append_list(
- ["rtti_addr(", RttiTypeId_str, ", ", DataName_str, ")"], Str).
+ ["rtti_addr(", RttiTypeCtor_str, ", ", DataName_str, ")"],
+ Str).
opt_debug__dump_data_addr(layout_addr(LayoutName), Str) :-
opt_debug__dump_layout_name(LayoutName, LayoutName_str),
string__append_list(["layout_addr(", LayoutName_str, ")"], Str).
@@ -356,11 +357,12 @@
string__append_list(["deep_profiling_procedure_data(",
ProcLabelStr, ")"], Str).
-opt_debug__dump_rtti_type_id(rtti_type_id(ModuleName, TypeName, Arity), Str) :-
+opt_debug__dump_rtti_type_ctor(rtti_type_ctor(ModuleName, TypeName, Arity),
+ Str) :-
llds_out__sym_name_mangle(ModuleName, ModuleName_str),
llds_out__name_mangle(TypeName, TypeName_str),
string__int_to_string(Arity, Arity_str),
- string__append_list(["rtti_type_id(", ModuleName_str, ", ",
+ string__append_list(["rtti_type_ctor(", ModuleName_str, ", ",
TypeName_str, Arity_str, ")"], Str).
opt_debug__dump_rtti_name(exist_locns(Ordinal), Str) :-
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.218
diff -u -b -r1.218 polymorphism.m
--- compiler/polymorphism.m 2002/01/11 07:41:31 1.218
+++ compiler/polymorphism.m 2002/02/25 16:03:37
@@ -2618,10 +2618,10 @@
TypeArgs = TypeArgs0,
hlds_out__pred_or_func_to_str(PredOrFunc,
PredOrFuncStr),
- TypeId = unqualified(PredOrFuncStr) - 0
+ TypeCtor = unqualified(PredOrFuncStr) - 0
; type_is_tuple(Type, TypeArgs1) ->
TypeArgs = TypeArgs1,
- TypeId = unqualified("tuple") - 0
+ TypeCtor = unqualified("tuple") - 0
;
fail
)
@@ -2636,17 +2636,17 @@
% To allow univ_to_type to check the type_infos
% correctly, the actual arity of the pred is added to
% the type_info of higher-order types.
- polymorphism__construct_type_info(Type, TypeId, TypeArgs,
+ polymorphism__construct_type_info(Type, TypeCtor, TypeArgs,
yes, Context, Var, ExtraGoals, Info0, Info)
;
- type_to_type_id(Type, TypeId, TypeArgs)
+ type_to_ctor_and_args(Type, TypeCtor, TypeArgs)
->
% This occurs for code where a predicate calls a polymorphic
% predicate with a known value of the type variable.
% The transformation we perform is shown in the comment
% at the top of the module.
- polymorphism__construct_type_info(Type, TypeId, TypeArgs,
+ polymorphism__construct_type_info(Type, TypeCtor, TypeArgs,
no, Context, Var, ExtraGoals, Info0, Info)
;
%
@@ -2681,14 +2681,14 @@
error("polymorphism__make_var: unknown type")
).
-:- pred polymorphism__construct_type_info(type, type_id, list(type),
+:- pred polymorphism__construct_type_info(type, type_ctor, list(type),
bool, prog_context, prog_var, list(hlds_goal),
poly_info, poly_info).
:- mode polymorphism__construct_type_info(in, in, in, in, in, out, out,
in, out) is det.
-polymorphism__construct_type_info(Type, TypeId, TypeArgs, IsHigherOrderOrTuple,
- Context, Var, ExtraGoals, Info0, Info) :-
+polymorphism__construct_type_info(Type, TypeCtor, TypeArgs,
+ IsHigherOrderOrTuple, Context, Var, ExtraGoals, Info0, Info) :-
% Create the typeinfo vars for the arguments
polymorphism__make_type_info_vars(TypeArgs, Context,
@@ -2699,7 +2699,7 @@
poly_info_get_module_info(Info1, ModuleInfo),
polymorphism__init_const_type_ctor_info_var(Type,
- TypeId, ModuleInfo, VarSet1, VarTypes1,
+ TypeCtor, ModuleInfo, VarSet1, VarTypes1,
BaseVar, BaseGoal, VarSet2, VarTypes2),
polymorphism__maybe_init_second_cell(ArgTypeInfoVars,
ArgTypeInfoGoals, Type, IsHigherOrderOrTuple,
@@ -2812,12 +2812,12 @@
classify_type(Type, ModuleInfo, TypeCategory),
( ( TypeCategory = user_type ; TypeCategory = enum_type ) ->
module_info_get_special_pred_map(ModuleInfo, SpecialPredMap),
- ( type_to_type_id(Type, TypeId, _TypeArgs) ->
- map__search(SpecialPredMap, SpecialPredId - TypeId,
+ ( type_to_ctor_and_args(Type, TypeCtor, _TypeArgs) ->
+ map__search(SpecialPredMap, SpecialPredId - TypeCtor,
PredId)
;
error(
- "polymorphism__get_special_proc: type_to_type_id failed")
+ "polymorphism__get_special_proc: type_to_ctor_and_args failed")
),
module_info_pred_info(ModuleInfo, PredId, PredInfo),
pred_info_module(PredInfo, Module),
@@ -2937,19 +2937,19 @@
% statically allocated type_ctor_info cell for the type, allocated
% in the module that defines the type.
-:- pred polymorphism__init_const_type_ctor_info_var(type, type_id,
+:- pred polymorphism__init_const_type_ctor_info_var(type, type_ctor,
module_info, prog_varset, map(prog_var, type), prog_var, hlds_goal,
prog_varset, map(prog_var, type)).
:- mode polymorphism__init_const_type_ctor_info_var(in, in, in, in, in,
out, out, out, out) is det.
-polymorphism__init_const_type_ctor_info_var(Type, TypeId,
+polymorphism__init_const_type_ctor_info_var(Type, TypeCtor,
ModuleInfo, VarSet0, VarTypes0, TypeCtorInfoVar,
TypeCtorInfoGoal, VarSet, VarTypes) :-
- type_util__type_id_module(ModuleInfo, TypeId, ModuleName),
- type_util__type_id_name(ModuleInfo, TypeId, TypeName),
- TypeId = _ - Arity,
+ type_util__type_ctor_module(ModuleInfo, TypeCtor, ModuleName),
+ type_util__type_ctor_name(ModuleInfo, TypeCtor, TypeName),
+ TypeCtor = _ - Arity,
ConsId = type_ctor_info_const(ModuleName, TypeName, Arity),
TypeInfoTerm = functor(ConsId, []),
@@ -3233,7 +3233,7 @@
% `constraint/n' is not really a type - it is a representation of a
% class constraint about which a typeclass_info holds information.
- % `type_util:type_to_type_id' treats it as a type variable.
+ % `type_util:type_to_ctor_and_args' treats it as a type variable.
construct_qualified_term(SymName, [], ClassNameTerm),
mercury_private_builtin_module(PrivateBuiltin),
construct_qualified_term(qualified(PrivateBuiltin, "constraint"),
@@ -3246,11 +3246,11 @@
polymorphism__typeclass_info_class_constraint(TypeClassInfoType, Constraint) :-
mercury_private_builtin_module(PrivateBuiltin),
- type_to_type_id(TypeClassInfoType,
+ type_to_ctor_and_args(TypeClassInfoType,
qualified(PrivateBuiltin, "typeclass_info") - 1,
[ConstraintTerm]),
- % type_to_type_id fails on `constraint/n', so we use
+ % type_to_ctor_and_args fails on `constraint/n', so we use
% `sym_name_and_args' instead.
mercury_private_builtin_module(PrivateBuiltin),
sym_name_and_args(ConstraintTerm,
@@ -3261,7 +3261,7 @@
polymorphism__type_info_type(TypeInfoType, Type) :-
mercury_private_builtin_module(PrivateBuiltin),
- type_to_type_id(TypeInfoType,
+ type_to_ctor_and_args(TypeInfoType,
qualified(PrivateBuiltin, "type_info") - 1,
[Type]).
Index: compiler/post_typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/post_typecheck.m,v
retrieving revision 1.35
diff -u -b -r1.35 post_typecheck.m
--- compiler/post_typecheck.m 2002/02/22 01:20:53 1.35
+++ compiler/post_typecheck.m 2002/02/25 16:03:37
@@ -1186,8 +1186,8 @@
VarSet = VarSet0,
(
ConsId0 = cons(Name0, Arity),
- type_to_type_id(TypeOfX, TypeIdOfX, _),
- TypeIdOfX = qualified(TypeModule, _) - _
+ type_to_ctor_and_args(TypeOfX, TypeCtorOfX, _),
+ TypeCtorOfX = qualified(TypeModule, _) - _
->
unqualify_name(Name0, Name),
ConsId = cons(qualified(TypeModule, Name), Arity)
@@ -1207,18 +1207,18 @@
:- mode find_matching_constructor(in, in, in, in, in) is semidet.
find_matching_constructor(ModuleInfo, TVarSet, ConsId, Type, ArgTypes) :-
- type_to_type_id(Type, TypeId, _),
+ type_to_ctor_and_args(Type, TypeCtor, _),
module_info_ctors(ModuleInfo, ConsTable),
map__search(ConsTable, ConsId, ConsDefns),
list__member(ConsDefn, ConsDefns),
% Overloading resolution ignores the class constraints.
ConsDefn = hlds_cons_defn(ConsExistQVars, _,
- ConsArgs, ConsTypeId, _),
- ConsTypeId = TypeId,
+ ConsArgs, ConsTypeCtor, _),
+ ConsTypeCtor = TypeCtor,
module_info_types(ModuleInfo, Types),
- map__search(Types, TypeId, TypeDefn),
+ map__search(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_tvarset(TypeDefn, TypeTVarSet),
assoc_list__values(ConsArgs, ConsArgTypes),
@@ -1432,11 +1432,11 @@
),
hlds_data__get_type_defn_tparams(TypeDefn, TypeParams),
term__term_list_to_var_list(TypeParams, TypeDefnArgs),
- ( type_to_type_id(TermType, _, TypeArgs) ->
+ ( type_to_ctor_and_args(TermType, _, TypeArgs) ->
map__from_corresponding_lists(TypeDefnArgs, TypeArgs, TSubst)
;
error(
- "get_cons_id_arg_types_adding_existq_tvars: type_to_type_id failed")
+ "get_cons_id_arg_types_adding_existq_tvars: type_to_ctor_and_args failed")
),
term__apply_substitution_to_list(ArgTypes1, TSubst, ArgTypes).
@@ -1466,14 +1466,14 @@
get_constructor_containing_field(ModuleInfo, TermType, FieldName,
ConsId, FieldNumber) :-
- ( type_to_type_id(TermType, TermTypeId0, _) ->
- TermTypeId = TermTypeId0
+ ( type_to_ctor_and_args(TermType, TermTypeCtor0, _) ->
+ TermTypeCtor = TermTypeCtor0
;
error(
- "get_constructor_containing_field: type_to_type_id failed")
+ "get_constructor_containing_field: type_to_ctor_and_args failed")
),
module_info_types(ModuleInfo, Types),
- map__lookup(Types, TermTypeId, TermTypeDefn),
+ map__lookup(Types, TermTypeCtor, TermTypeDefn),
hlds_data__get_type_defn_body(TermTypeDefn, TermTypeBody),
( TermTypeBody = du_type(Ctors, _, _, _) ->
get_constructor_containing_field_2(Ctors, FieldName, ConsId,
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.79
diff -u -b -r1.79 prog_data.m
--- compiler/prog_data.m 2002/02/26 02:45:49 1.79
+++ compiler/prog_data.m 2002/02/26 02:49:07
@@ -194,7 +194,7 @@
% foreign function name.
; type_spec(sym_name, sym_name, arity, maybe(pred_or_func),
- maybe(list(mode)), type_subst, tvarset, set(type_id))
+ maybe(list(mode)), type_subst, tvarset, set(type_ctor))
% PredName, SpecializedPredName, Arity,
% PredOrFunc, Modes if a specific procedure was
% specified, type substitution (using the variable
@@ -770,9 +770,9 @@
:- type type_param == term(tvar_type).
% Module qualified types are represented as ':'/2 terms.
- % Use type_util:type_to_type_id to convert a type to a qualified
- % type_id and a list of arguments.
- % type_util:construct_type to construct a type from a type_id
+ % Use type_util:type_to_ctor_and_args to convert a type to a qualified
+ % type_ctor and a list of arguments.
+ % type_util:construct_type to construct a type from a type_ctor
% and a list of arguments.
%
% The `term__context's of the type terms must be empty (as
@@ -794,7 +794,7 @@
% used for sets of type variables
:- type tsubst == map(tvar, type). % used for type substitutions
-:- type type_id == pair(sym_name, arity).
+:- type type_ctor == pair(sym_name, arity).
% existq_tvars is used to record the set of type variables which are
% existentially quantified
Index: compiler/pseudo_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/pseudo_type_info.m,v
retrieving revision 1.5
diff -u -b -r1.5 pseudo_type_info.m
--- compiler/pseudo_type_info.m 2000/12/21 06:10:23 1.5
+++ compiler/pseudo_type_info.m 2002/02/25 16:03:39
@@ -45,7 +45,7 @@
% This represents a zero-arity type,
% i.e. a type constructor with no arguments.
%
- rtti_type_id
+ rtti_type_ctor
)
; type_info(
%
@@ -53,17 +53,17 @@
% i.e. a type constructor applied to some arguments.
% The argument list should not be empty.
%
- rtti_type_id,
+ rtti_type_ctor,
list(pseudo_type_info)
)
; higher_order_type_info(
%
% This represents a higher-order or tuple type.
- % The rtti_type_id field will be pred/0,
+ % The rtti_type_ctor field will be pred/0,
% func/0 or tuple/0; the real arity is
% given in the arity field.
%
- rtti_type_id,
+ rtti_type_ctor,
arity,
list(pseudo_type_info)
)
@@ -82,14 +82,14 @@
pseudo_type_info__construct_pseudo_type_info(Type, NumUnivQTvars,
ExistQTvars, Pseudo) :-
(
- type_to_type_id(Type, TypeId, TypeArgs0)
+ type_to_ctor_and_args(Type, TypeCtor, TypeArgs0)
->
(
% The argument to typeclass_info types is not
% a type - it encodes the class constraint.
% So we replace the argument with type `void'.
mercury_private_builtin_module(PrivateBuiltin),
- TypeId = qualified(PrivateBuiltin, TName) - 1,
+ TypeCtor = qualified(PrivateBuiltin, TName) - 1,
( TName = "typeclass_info"
; TName = "base_typeclass_info"
)
@@ -119,24 +119,26 @@
->
TypeModule = unqualified(""),
Arity = 0,
- RttiTypeId = rtti_type_id(TypeModule, TypeName, Arity),
- TypeId = _QualTypeName - RealArity,
+ RttiTypeCtor = rtti_type_ctor(TypeModule, TypeName,
+ Arity),
+ TypeCtor = _QualTypeName - RealArity,
pseudo_type_info__generate_args(TypeArgs,
NumUnivQTvars, ExistQTvars, PseudoArgs),
- Pseudo = higher_order_type_info(RttiTypeId, RealArity,
+ Pseudo = higher_order_type_info(RttiTypeCtor, RealArity,
PseudoArgs)
;
- TypeId = QualTypeName - Arity,
+ TypeCtor = QualTypeName - Arity,
unqualify_name(QualTypeName, TypeName),
sym_name_get_module_name(QualTypeName, unqualified(""),
TypeModule),
- RttiTypeId = rtti_type_id(TypeModule, TypeName, Arity),
+ RttiTypeCtor = rtti_type_ctor(TypeModule, TypeName,
+ Arity),
pseudo_type_info__generate_args(TypeArgs,
NumUnivQTvars, ExistQTvars, PseudoArgs),
( PseudoArgs = [] ->
- Pseudo = type_ctor_info(RttiTypeId)
+ Pseudo = type_ctor_info(RttiTypeCtor)
;
- Pseudo = type_info(RttiTypeId, PseudoArgs)
+ Pseudo = type_info(RttiTypeCtor, PseudoArgs)
)
)
;
Index: compiler/recompilation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation.m,v
retrieving revision 1.2
diff -u -b -r1.2 recompilation.m
--- compiler/recompilation.m 2001/07/11 15:44:21 1.2
+++ compiler/recompilation.m 2002/02/25 16:03:40
@@ -124,7 +124,7 @@
% equivalence types, and at that point we don't know which imported
% items are going to be used by the compilation.
:- pred recompilation__record_used_equivalence_types(item_id::in,
- set(type_id)::in, recompilation_info::in,
+ set(type_ctor)::in, recompilation_info::in,
recompilation_info::out) is det.
%-----------------------------------------------------------------------------%
@@ -384,7 +384,8 @@
;
set__init(Deps1)
),
- UsedItems = list__map((func(TypeId) = item_id(type, TypeId)),
+ UsedItems = list__map(
+ (func(TypeCtor) = item_id(type, TypeCtor)),
set__to_sorted_list(UsedTypes)),
set__insert_list(Deps1, UsedItems, Deps),
map__set(DepsMap0, Item, Deps, DepsMap),
Index: compiler/recompilation_check.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_check.m,v
retrieving revision 1.9
diff -u -b -r1.9 recompilation_check.m
--- compiler/recompilation_check.m 2002/02/26 02:45:52 1.9
+++ compiler/recompilation_check.m 2002/02/26 02:49:07
@@ -1091,29 +1091,29 @@
% with functors used during the last compilation.
%
:- pred check_type_defn_ambiguity_with_functor(need_qualifier::in,
- type_id::in, type_defn::in, recompilation_check_info::in,
+ type_ctor::in, type_defn::in, recompilation_check_info::in,
recompilation_check_info::out) is det.
check_type_defn_ambiguity_with_functor(_, _, abstract_type) --> [].
check_type_defn_ambiguity_with_functor(_, _, eqv_type(_)) --> [].
check_type_defn_ambiguity_with_functor(NeedQualifier,
- TypeId, du_type(Ctors, _)) -->
- list__foldl(check_functor_ambiguities(NeedQualifier, TypeId),
+ TypeCtor, du_type(Ctors, _)) -->
+ list__foldl(check_functor_ambiguities(NeedQualifier, TypeCtor),
Ctors).
-:- pred check_functor_ambiguities(need_qualifier::in, type_id::in,
+:- pred check_functor_ambiguities(need_qualifier::in, type_ctor::in,
constructor::in, recompilation_check_info::in,
recompilation_check_info::out) is det.
-check_functor_ambiguities(NeedQualifier, TypeId,
+check_functor_ambiguities(NeedQualifier, TypeCtor,
ctor(_, _, Name, Args)) -->
- { ResolvedCtor = constructor(TypeId) },
+ { ResolvedCtor = constructor(TypeCtor) },
{ Arity = list__length(Args) },
check_functor_ambiguities(NeedQualifier, Name, exact(Arity),
ResolvedCtor),
list__foldl(
check_field_ambiguities(NeedQualifier,
- field(TypeId, Name - Arity)),
+ field(TypeCtor, Name - Arity)),
Args).
:- pred check_field_ambiguities(need_qualifier::in, resolved_functor::in,
Index: compiler/recompilation_usage.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_usage.m,v
retrieving revision 1.5
diff -u -b -r1.5 recompilation_usage.m
--- compiler/recompilation_usage.m 2002/02/26 02:45:53 1.5
+++ compiler/recompilation_usage.m 2002/02/26 02:49:07
@@ -55,10 +55,10 @@
% predicate or function
)
; constructor(
- item_name % type_id
+ item_name % type_ctor
)
; field(
- item_name, % type_id
+ item_name, % type_ctor
item_name % cons_id
)
.
@@ -796,8 +796,8 @@
MatchingConstructors =
list__map(
(func(ConsDefn) = Ctor :-
- ConsDefn = hlds_cons_defn(_, _, _, TypeId, _),
- Ctor = constructor(TypeId)
+ ConsDefn = hlds_cons_defn(_,_,_, TypeCtor, _),
+ Ctor = constructor(TypeCtor)
),
ConsDefns),
@@ -826,9 +826,9 @@
MatchingFields = list__map(
(func(FieldDefn) = FieldCtor :-
FieldDefn = hlds_ctor_field_defn(_, _,
- TypeId, ConsId, _),
+ TypeCtor, ConsId, _),
( ConsId = cons(ConsName, ConsArity) ->
- FieldCtor = field(TypeId,
+ FieldCtor = field(TypeCtor,
ConsName - ConsArity)
;
error(
@@ -880,10 +880,10 @@
item_name::in, recompilation_usage_info::in,
recompilation_usage_info::out) is det.
-recompilation_usage__find_items_used_by_item((type), TypeId) -->
+recompilation_usage__find_items_used_by_item((type), TypeCtor) -->
ModuleInfo =^ module_info,
{ module_info_types(ModuleInfo, Types) },
- { map__lookup(Types, TypeId, TypeDefn) },
+ { map__lookup(Types, TypeCtor, TypeDefn) },
{ hlds_data__get_type_defn_body(TypeDefn, TypeBody) },
( { TypeBody = eqv_type(Type) } ->
% If we use an equivalence type we also use the
@@ -892,10 +892,10 @@
;
[]
).
-recompilation_usage__find_items_used_by_item(type_body, TypeId) -->
+recompilation_usage__find_items_used_by_item(type_body, TypeCtor) -->
ModuleInfo =^ module_info,
{ module_info_types(ModuleInfo, Types) },
- { map__lookup(Types, TypeId, TypeDefn) },
+ { map__lookup(Types, TypeCtor, TypeDefn) },
{ hlds_data__get_type_defn_body(TypeDefn, TypeBody) },
recompilation_usage__find_items_used_by_type_body(TypeBody).
recompilation_usage__find_items_used_by_item((mode), ModeId) -->
@@ -1180,10 +1180,10 @@
recompilation_usage__find_items_used_by_pred(PredOrFunc,
Name - PredArity, PredId - PredModule).
recompilation_usage__find_items_used_by_functor(_, _,
- constructor(TypeId)) -->
- recompilation_usage__maybe_record_item_to_process(type_body, TypeId).
-recompilation_usage__find_items_used_by_functor(_, _, field(TypeId, _)) -->
- recompilation_usage__maybe_record_item_to_process(type_body, TypeId).
+ constructor(TypeCtor)) -->
+ recompilation_usage__maybe_record_item_to_process(type_body, TypeCtor).
+recompilation_usage__find_items_used_by_functor(_, _, field(TypeCtor, _)) -->
+ recompilation_usage__maybe_record_item_to_process(type_body, TypeCtor).
:- pred recompilation_usage__find_items_used_by_simple_item_set(
item_type::in, simple_item_set::in,
@@ -1210,15 +1210,15 @@
recompilation_usage__find_items_used_by_type(Type) -->
(
- { type_to_type_id(Type, TypeId, TypeArgs) }
+ { type_to_ctor_and_args(Type, TypeCtor, TypeArgs) }
->
(
% Unqualified type-ids are builtin types.
- { TypeId = qualified(_, _) - _ },
- \+ { type_id_is_higher_order(TypeId, _, _) }
+ { TypeCtor = qualified(_, _) - _ },
+ \+ { type_ctor_is_higher_order(TypeCtor, _, _) }
->
recompilation_usage__maybe_record_item_to_process(
- (type), TypeId)
+ (type), TypeCtor)
;
[]
),
Index: compiler/recompilation_version.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_version.m,v
retrieving revision 1.13
diff -u -b -r1.13 recompilation_version.m
--- compiler/recompilation_version.m 2002/02/26 02:45:53 1.13
+++ compiler/recompilation_version.m 2002/02/26 02:49:07
@@ -248,13 +248,13 @@
{ NameItem = Item },
{ BodyItem = Item }
),
- { TypeId = Name - list__length(Args) },
+ { TypeCtor = Name - list__length(Args) },
GatheredItems0 =^ gathered_items,
{ recompilation_version__add_gathered_item(NameItem,
- item_id((type), TypeId), ItemContext,
+ item_id((type), TypeCtor), ItemContext,
yes, GatheredItems0, GatheredItems1) },
{ recompilation_version__add_gathered_item(BodyItem,
- item_id(type_body, TypeId), ItemContext,
+ item_id(type_body, TypeCtor), ItemContext,
yes, GatheredItems1, GatheredItems) },
^ gathered_items := GatheredItems
;
Index: compiler/rl.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl.m,v
retrieving revision 1.17
diff -u -b -r1.17 rl.m
--- compiler/rl.m 2001/06/27 05:04:29 1.17
+++ compiler/rl.m 2002/02/25 16:03:43
@@ -656,14 +656,14 @@
% Produce names acceptable to Aditi (just wrap single
% quotes around non-alphanumeric-and-underscore names).
-:- pred rl__mangle_and_quote_type_name(type_id::in, list(type)::in,
+:- pred rl__mangle_and_quote_type_name(type_ctor::in, list(type)::in,
string::out) is det.
:- pred rl__mangle_and_quote_ctor_name(sym_name::in,
int::in, string::out) is det.
% The expression stuff expects that constructor
% and type names are unquoted.
-:- pred rl__mangle_type_name(type_id::in, list(type)::in,
+:- pred rl__mangle_type_name(type_ctor::in, list(type)::in,
string::out) is det.
:- pred rl__mangle_ctor_name(sym_name::in, int::in, string::out) is det.
@@ -1200,8 +1200,8 @@
string__append_list([Decls, "(", SchemaString0, ")"], SchemaString).
% Map from type to name and type definition string
-:- type gathered_types == map(pair(type_id, list(type)), string).
-:- type full_type_id == pair(type_id, list(type)).
+:- type gathered_types == map(pair(type_ctor, list(type)), string).
+:- type full_type_id == pair(type_ctor, list(type)).
% Go over a list of types collecting declarations for all the
% types used in the list.
@@ -1298,17 +1298,17 @@
rl__gather_du_type(ModuleInfo, Parents, Type, GatheredTypes0, GatheredTypes,
RecursiveTypes0, RecursiveTypes, Decls0, Decls, ThisType) :-
(
- type_to_type_id(Type, TypeId, Args),
+ type_to_ctor_and_args(Type, TypeCtor, Args),
type_constructors(Type, ModuleInfo, Ctors)
->
- ( set__member(TypeId - Args, Parents) ->
- set__insert(RecursiveTypes0, TypeId - Args,
+ ( set__member(TypeCtor - Args, Parents) ->
+ set__insert(RecursiveTypes0, TypeCtor - Args,
RecursiveTypes1)
;
RecursiveTypes1 = RecursiveTypes0
),
(
- map__search(GatheredTypes0, TypeId - Args,
+ map__search(GatheredTypes0, TypeCtor - Args,
MangledTypeName0)
->
GatheredTypes = GatheredTypes0,
@@ -1316,13 +1316,13 @@
MangledTypeName = MangledTypeName0,
RecursiveTypes = RecursiveTypes1
;
- set__insert(Parents, TypeId - Args, Parents1),
- rl__mangle_and_quote_type_name(TypeId,
+ set__insert(Parents, TypeCtor - Args, Parents1),
+ rl__mangle_and_quote_type_name(TypeCtor,
Args, MangledTypeName),
% Record that we have seen this type
% before processing the sub-terms.
- map__det_insert(GatheredTypes0, TypeId - Args,
+ map__det_insert(GatheredTypes0, TypeCtor - Args,
MangledTypeName, GatheredTypes1),
rl__gather_constructors(ModuleInfo,
@@ -1333,7 +1333,7 @@
% Recursive types are marked by a
% second colon before their declaration.
- ( set__member(TypeId - Args, RecursiveTypes) ->
+ ( set__member(TypeCtor - Args, RecursiveTypes) ->
RecursiveSpec = ":"
;
RecursiveSpec = ""
@@ -1382,24 +1382,24 @@
%-----------------------------------------------------------------------------%
-rl__mangle_and_quote_type_name(TypeId, Args, MangledTypeName) :-
- rl__mangle_type_name(TypeId, Args, MangledTypeName0),
+rl__mangle_and_quote_type_name(TypeCtor, Args, MangledTypeName) :-
+ rl__mangle_type_name(TypeCtor, Args, MangledTypeName0),
rl__maybe_quote_name(MangledTypeName0, MangledTypeName).
-rl__mangle_type_name(TypeId, Args, MangledTypeName) :-
- rl__mangle_type_name_2(TypeId, Args, "", MangledTypeName).
+rl__mangle_type_name(TypeCtor, Args, MangledTypeName) :-
+ rl__mangle_type_name_2(TypeCtor, Args, "", MangledTypeName).
-:- pred rl__mangle_type_name_2(type_id::in, list(type)::in,
+:- pred rl__mangle_type_name_2(type_ctor::in, list(type)::in,
string::in, string::out) is det.
-rl__mangle_type_name_2(TypeId, Args, MangledTypeName0, MangledTypeName) :-
+rl__mangle_type_name_2(TypeCtor, Args, MangledTypeName0, MangledTypeName) :-
(
- TypeId = qualified(Module0, Name) - Arity,
+ TypeCtor = qualified(Module0, Name) - Arity,
prog_out__sym_name_to_string(Module0, Module),
string__append_list([MangledTypeName0, Module, "__", Name],
MangledTypeName1)
;
- TypeId = unqualified(TypeName) - Arity,
+ TypeCtor = unqualified(TypeName) - Arity,
string__append(MangledTypeName0, TypeName, MangledTypeName1)
),
string__int_to_string(Arity, ArStr),
@@ -1416,11 +1416,11 @@
rl__mangle_type_arg(Arg, String0, String) :-
string__append(String0, "___", String1),
- ( type_to_type_id(Arg, ArgTypeId, ArgTypeArgs) ->
- rl__mangle_type_name_2(ArgTypeId, ArgTypeArgs,
+ ( type_to_ctor_and_args(Arg, ArgTypeCtor, ArgTypeArgs) ->
+ rl__mangle_type_name_2(ArgTypeCtor, ArgTypeArgs,
String1, String)
;
- error("rl__mangle_type_arg: type_to_type_id failed")
+ error("rl__mangle_type_arg: type_to_ctor_and_args failed")
).
rl__mangle_ctor_name(CtorName, _Arity, MangledCtorName) :-
Index: compiler/rl_exprn.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.22
diff -u -b -r1.22 rl_exprn.m
--- compiler/rl_exprn.m 2002/02/20 03:14:19 1.22
+++ compiler/rl_exprn.m 2002/02/25 16:03:44
@@ -1272,7 +1272,7 @@
rl_exprn__is_char_cons_id(ConsId, Type, Int) :-
ConsId = cons(unqualified(CharStr), 0),
- type_to_type_id(Type, unqualified("character") - 0, _),
+ type_to_ctor_and_args(Type, unqualified("character") - 0, _),
% Convert characters to integers.
( string__to_char_list(CharStr, [Char]) ->
char__to_int(Char, Int)
@@ -1363,11 +1363,11 @@
rl_exprn__cons_id_to_rule_number(ConsId, Type, ExprnTuple, RuleNo) -->
(
{ ConsId = cons(ConsName, Arity) },
- { type_to_type_id(Type, TypeId, Args) }
+ { type_to_ctor_and_args(Type, TypeCtor, Args) }
->
% These names should not be quoted, since they are not
% being parsed, just compared against other strings.
- { rl__mangle_type_name(TypeId, Args, MangledTypeName) },
+ { rl__mangle_type_name(TypeCtor, Args, MangledTypeName) },
{ rl__mangle_ctor_name(ConsName, Arity, MangledConsName) },
{ Rule = rl_rule(MangledTypeName, MangledConsName, Arity) },
rl_exprn_info_lookup_rule(Rule - ExprnTuple, RuleNo)
@@ -2006,14 +2006,14 @@
:- pred rl_exprn__type_to_aditi_type((type)::in, aditi_type::out) is det.
rl_exprn__type_to_aditi_type(Type, AditiType) :-
- ( type_to_type_id(Type, TypeId, _) ->
- ( TypeId = unqualified("int") - 0 ->
+ ( type_to_ctor_and_args(Type, TypeCtor, _) ->
+ ( TypeCtor = unqualified("int") - 0 ->
AditiType = int
- ; TypeId = unqualified("character") - 0 ->
+ ; TypeCtor = unqualified("character") - 0 ->
AditiType = int
- ; TypeId = unqualified("string") - 0 ->
+ ; TypeCtor = unqualified("string") - 0 ->
AditiType = string
- ; TypeId = unqualified("float") - 0 ->
+ ; TypeCtor = unqualified("float") - 0 ->
AditiType = float
;
AditiType = term(Type)
Index: compiler/rl_key.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rl_key.m,v
retrieving revision 1.8
diff -u -b -r1.8 rl_key.m
--- compiler/rl_key.m 2000/10/06 10:18:33 1.8
+++ compiler/rl_key.m 2002/02/25 16:03:45
@@ -127,8 +127,8 @@
; TypeClass = enum_type
),
module_info_types(ModuleInfo, Types),
- type_to_type_id(Type, TypeId, _),
- map__search(Types, TypeId, TypeDefn),
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ map__search(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, Body),
Body = du_type(Ctors, _, _, _),
Ctors = [_]
@@ -1022,8 +1022,8 @@
ConsId2 = cons(_, _)
->
module_info_types(ModuleInfo, Types),
- type_to_type_id(Type, TypeId, _),
- map__search(Types, TypeId, TypeDefn),
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ map__search(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, Body),
% If there's a user defined equality pred we're in trouble.
Body = du_type(Ctors, _, _, no),
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.15
diff -u -b -r1.15 rtti.m
--- compiler/rtti.m 2002/01/25 08:22:52 1.15
+++ compiler/rtti.m 2002/02/25 16:03:46
@@ -132,8 +132,8 @@
).
% Values of this type uniquely identify a type in the program.
-:- type rtti_type_id
- ---> rtti_type_id(
+:- type rtti_type_ctor
+ ---> rtti_type_ctor(
module_name, % module name
string, % type ctor's name
arity % type ctor's arity
@@ -145,7 +145,7 @@
% code initializers.
:- type rtti_data
---> exist_locns(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
int, % identifies functor in type
% The remaining argument of this function symbol
@@ -154,7 +154,7 @@
list(exist_typeinfo_locn)
)
; exist_info(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
int, % identifies functor in type
% The remaining arguments of this function symbol
@@ -166,13 +166,13 @@
rtti_name % table of typeinfo locations
)
; field_names(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
int, % identifies functor in type
list(maybe(string)) % gives the field names
)
; field_types(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
int, % identifies functor in type
list(rtti_data) % gives the field types
@@ -180,7 +180,7 @@
% rtti_data)
)
; reserved_addrs(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to an array of const void *.
@@ -190,7 +190,7 @@
% type
)
; reserved_addr_functors(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to an array of MR_ReservedAddrFunctorDesc
@@ -200,7 +200,7 @@
% functors for that type
)
; enum_functor_desc(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining arguments of this function symbol
% correspond one-to-one to the fields of
@@ -211,7 +211,7 @@
% (also its value)
)
; notag_functor_desc(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining arguments of this function symbol
% correspond one-to-one to the fields of
@@ -224,7 +224,7 @@
maybe(string) % the argument's name, if any
)
; du_functor_desc(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining arguments of this function symbol
% correspond one-to-one to the fields of
@@ -260,7 +260,7 @@
% (an exist_info rtti_name)
)
; reserved_addr_functor_desc(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining arguments of this function symbol
% correspond one-to-one to the fields of
@@ -271,7 +271,7 @@
reserved_address % value
)
; enum_name_ordered_table(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to the functors_enum alternative of
@@ -280,7 +280,7 @@
list(rtti_name)
)
; enum_value_ordered_table(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to the MR_EnumTypeLayout C type.
@@ -288,7 +288,7 @@
list(rtti_name)
)
; reserved_addr_table(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to the functors_du alternative of
@@ -303,7 +303,7 @@
% the remaining functors
)
; du_name_ordered_table(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to the functors_du alternative of
@@ -312,7 +312,7 @@
list(rtti_name)
)
; du_stag_ordered_table(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
int, % primary tag value
% The remaining argument of this function symbol
@@ -322,7 +322,7 @@
list(rtti_name)
)
; du_ptag_ordered_table(
- rtti_type_id, % identifies the type
+ rtti_type_ctor, % identifies the type
% The remaining argument of this function symbol
% corresponds to the elements of the MR_DuTypeLayout
@@ -335,7 +335,7 @@
% one-to-one to the fields of the MR_TypeCtorInfo
% C type.
- rtti_type_id, % identifies the type ctor
+ rtti_type_ctor, % identifies the type ctor
maybe(rtti_proc_label), % unify
maybe(rtti_proc_label), % compare
type_ctor_rep,
@@ -413,10 +413,10 @@
methods :: list(rtti_proc_label)
).
- % convert a rtti_data to an rtti_type_id and an rtti_name.
+ % convert a rtti_data to an rtti_type_ctor and an rtti_name.
% This calls error/1 if the argument is a type_var/1 rtti_data,
- % since there is no rtti_type_id to return in that case.
-:- pred rtti_data_to_name(rtti_data::in, rtti_type_id::out, rtti_name::out)
+ % since there is no rtti_type_ctor to return in that case.
+:- pred rtti_data_to_name(rtti_data::in, rtti_type_ctor::out, rtti_name::out)
is det.
% return yes iff the specified rtti_name is an array
@@ -476,7 +476,7 @@
% Return the C variable name of the RTTI data structure identified
% by the input arguments.
% XXX this should be in rtti_out.m
-:- pred rtti__addr_to_string(rtti_type_id::in, rtti_name::in, string::out)
+:- pred rtti__addr_to_string(rtti_type_ctor::in, rtti_name::in, string::out)
is det.
% Return the C representation of a secondary tag location.
@@ -495,53 +495,55 @@
:- import_module string, require.
-rtti_data_to_name(exist_locns(RttiTypeId, Ordinal, _),
- RttiTypeId, exist_locns(Ordinal)).
-rtti_data_to_name(exist_info(RttiTypeId, Ordinal, _, _, _, _),
- RttiTypeId, exist_info(Ordinal)).
-rtti_data_to_name(field_names(RttiTypeId, Ordinal, _),
- RttiTypeId, field_names(Ordinal)).
-rtti_data_to_name(field_types(RttiTypeId, Ordinal, _),
- RttiTypeId, field_types(Ordinal)).
-rtti_data_to_name(reserved_addrs(RttiTypeId, _),
- RttiTypeId, reserved_addrs).
-rtti_data_to_name(reserved_addr_functors(RttiTypeId, _),
- RttiTypeId, reserved_addr_functors).
-rtti_data_to_name(enum_functor_desc(RttiTypeId, _, Ordinal),
- RttiTypeId, enum_functor_desc(Ordinal)).
-rtti_data_to_name(notag_functor_desc(RttiTypeId, _, _, _),
- RttiTypeId, notag_functor_desc).
-rtti_data_to_name(du_functor_desc(RttiTypeId, _,_,_,_, Ordinal, _,_,_,_,_),
- RttiTypeId, du_functor_desc(Ordinal)).
-rtti_data_to_name(reserved_addr_functor_desc(RttiTypeId, _, Ordinal, _),
- RttiTypeId, reserved_addr_functor_desc(Ordinal)).
-rtti_data_to_name(enum_name_ordered_table(RttiTypeId, _),
- RttiTypeId, enum_name_ordered_table).
-rtti_data_to_name(enum_value_ordered_table(RttiTypeId, _),
- RttiTypeId, enum_value_ordered_table).
-rtti_data_to_name(du_name_ordered_table(RttiTypeId, _),
- RttiTypeId, du_name_ordered_table).
-rtti_data_to_name(du_stag_ordered_table(RttiTypeId, Ptag, _),
- RttiTypeId, du_stag_ordered_table(Ptag)).
-rtti_data_to_name(du_ptag_ordered_table(RttiTypeId, _),
- RttiTypeId, du_ptag_ordered_table).
-rtti_data_to_name(reserved_addr_table(RttiTypeId, _, _, _, _, _),
- RttiTypeId, reserved_addr_table).
-rtti_data_to_name(type_ctor_info(RttiTypeId, _,_,_,_,_,_,_,_),
- RttiTypeId, type_ctor_info).
+rtti_data_to_name(exist_locns(RttiTypeCtor, Ordinal, _),
+ RttiTypeCtor, exist_locns(Ordinal)).
+rtti_data_to_name(exist_info(RttiTypeCtor, Ordinal, _, _, _, _),
+ RttiTypeCtor, exist_info(Ordinal)).
+rtti_data_to_name(field_names(RttiTypeCtor, Ordinal, _),
+ RttiTypeCtor, field_names(Ordinal)).
+rtti_data_to_name(field_types(RttiTypeCtor, Ordinal, _),
+ RttiTypeCtor, field_types(Ordinal)).
+rtti_data_to_name(reserved_addrs(RttiTypeCtor, _),
+ RttiTypeCtor, reserved_addrs).
+rtti_data_to_name(reserved_addr_functors(RttiTypeCtor, _),
+ RttiTypeCtor, reserved_addr_functors).
+rtti_data_to_name(enum_functor_desc(RttiTypeCtor, _, Ordinal),
+ RttiTypeCtor, enum_functor_desc(Ordinal)).
+rtti_data_to_name(notag_functor_desc(RttiTypeCtor, _, _, _),
+ RttiTypeCtor, notag_functor_desc).
+rtti_data_to_name(du_functor_desc(RttiTypeCtor, _,_,_,_, Ordinal, _,_,_,_,_),
+ RttiTypeCtor, du_functor_desc(Ordinal)).
+rtti_data_to_name(reserved_addr_functor_desc(RttiTypeCtor, _, Ordinal, _),
+ RttiTypeCtor, reserved_addr_functor_desc(Ordinal)).
+rtti_data_to_name(enum_name_ordered_table(RttiTypeCtor, _),
+ RttiTypeCtor, enum_name_ordered_table).
+rtti_data_to_name(enum_value_ordered_table(RttiTypeCtor, _),
+ RttiTypeCtor, enum_value_ordered_table).
+rtti_data_to_name(du_name_ordered_table(RttiTypeCtor, _),
+ RttiTypeCtor, du_name_ordered_table).
+rtti_data_to_name(du_stag_ordered_table(RttiTypeCtor, Ptag, _),
+ RttiTypeCtor, du_stag_ordered_table(Ptag)).
+rtti_data_to_name(du_ptag_ordered_table(RttiTypeCtor, _),
+ RttiTypeCtor, du_ptag_ordered_table).
+rtti_data_to_name(reserved_addr_table(RttiTypeCtor, _, _, _, _, _),
+ RttiTypeCtor, reserved_addr_table).
+rtti_data_to_name(type_ctor_info(RttiTypeCtor, _,_,_,_,_,_,_,_),
+ RttiTypeCtor, type_ctor_info).
rtti_data_to_name(base_typeclass_info(_, _, _, _), _, _) :-
- % there's no rtti_type_id associated with a base_typeclass_info
+ % there's no rtti_type_ctor associated with a base_typeclass_info
error("rtti_data_to_name: base_typeclass_info").
-rtti_data_to_name(pseudo_type_info(PseudoTypeInfo), RttiTypeId,
+rtti_data_to_name(pseudo_type_info(PseudoTypeInfo), RttiTypeCtor,
pseudo_type_info(PseudoTypeInfo)) :-
- RttiTypeId = pti_get_rtti_type_id(PseudoTypeInfo).
+ RttiTypeCtor = pti_get_rtti_type_ctor(PseudoTypeInfo).
-:- func pti_get_rtti_type_id(pseudo_type_info) = rtti_type_id.
-pti_get_rtti_type_id(type_ctor_info(RttiTypeId)) = RttiTypeId.
-pti_get_rtti_type_id(type_info(RttiTypeId, _)) = RttiTypeId.
-pti_get_rtti_type_id(higher_order_type_info(RttiTypeId, _, _)) = RttiTypeId.
-pti_get_rtti_type_id(type_var(_)) = _ :-
- % there's no rtti_type_id associated with a type_var
+:- func pti_get_rtti_type_ctor(pseudo_type_info) = rtti_type_ctor.
+
+pti_get_rtti_type_ctor(type_ctor_info(RttiTypeCtor)) = RttiTypeCtor.
+pti_get_rtti_type_ctor(type_info(RttiTypeCtor, _)) = RttiTypeCtor.
+pti_get_rtti_type_ctor(higher_order_type_info(RttiTypeCtor, _, _)) =
+ RttiTypeCtor.
+pti_get_rtti_type_ctor(type_var(_)) = _ :-
+ % there's no rtti_type_ctor associated with a type_var
error("rtti_data_to_name: type_var").
rtti_name_has_array_type(exist_locns(_)) = yes.
@@ -621,8 +623,8 @@
ProcLabel = rtti_proc_label(_, _, _, _, _, _, PredId, ProcId,
_, _, _, _, _, _, _, _).
-rtti__addr_to_string(RttiTypeId, RttiName, Str) :-
- rtti__mangle_rtti_type_id(RttiTypeId, ModuleName, TypeName, A_str),
+rtti__addr_to_string(RttiTypeCtor, RttiName, Str) :-
+ rtti__mangle_rtti_type_ctor(RttiTypeCtor, ModuleName, TypeName, A_str),
(
RttiName = exist_locns(Ordinal),
string__int_to_string(Ordinal, O_str),
@@ -718,11 +720,11 @@
TypeName, "_", A_str], Str)
).
-:- pred rtti__mangle_rtti_type_id(rtti_type_id::in,
+:- pred rtti__mangle_rtti_type_ctor(rtti_type_ctor::in,
string::out, string::out, string::out) is det.
-rtti__mangle_rtti_type_id(RttiTypeId, ModuleName, TypeName, A_str) :-
- RttiTypeId = rtti_type_id(ModuleName0, TypeName0, TypeArity),
+rtti__mangle_rtti_type_ctor(RttiTypeCtor, ModuleName, TypeName, A_str) :-
+ RttiTypeCtor = rtti_type_ctor(ModuleName0, TypeName0, TypeArity),
llds_out__sym_name_mangle(ModuleName0, ModuleName),
llds_out__name_mangle(TypeName0, TypeName),
string__int_to_string(TypeArity, A_str).
@@ -735,19 +737,19 @@
PseudoTypeInfo = type_var(VarNum),
string__int_to_string(VarNum, Str)
;
- PseudoTypeInfo = type_ctor_info(RttiTypeId),
- rtti__addr_to_string(RttiTypeId, type_ctor_info, Str)
+ PseudoTypeInfo = type_ctor_info(RttiTypeCtor),
+ rtti__addr_to_string(RttiTypeCtor, type_ctor_info, Str)
;
- PseudoTypeInfo = type_info(RttiTypeId, ArgTypes),
- rtti__mangle_rtti_type_id(RttiTypeId,
+ PseudoTypeInfo = type_info(RttiTypeCtor, ArgTypes),
+ rtti__mangle_rtti_type_ctor(RttiTypeCtor,
ModuleName, TypeName, A_str),
ATs_str = pseudo_type_list_to_string(ArgTypes),
string__append_list([ModuleName, "__type_info_",
TypeName, "_", A_str, ATs_str], Str)
;
- PseudoTypeInfo = higher_order_type_info(RttiTypeId, RealArity,
- ArgTypes),
- rtti__mangle_rtti_type_id(RttiTypeId,
+ PseudoTypeInfo = higher_order_type_info(RttiTypeCtor,
+ RealArity, ArgTypes),
+ rtti__mangle_rtti_type_ctor(RttiTypeCtor,
ModuleName, TypeName, _A_str),
ATs_str = pseudo_type_list_to_string(ArgTypes),
string__int_to_string(RealArity, RA_str),
@@ -762,23 +764,23 @@
:- func pseudo_type_to_string(pseudo_type_info) = string.
pseudo_type_to_string(type_var(Int)) =
string__append("__var_", string__int_to_string(Int)).
-pseudo_type_to_string(type_ctor_info(TypeId)) =
- string__append("__type0_", rtti__type_id_to_string(TypeId)).
-pseudo_type_to_string(type_info(TypeId, ArgTypes)) =
+pseudo_type_to_string(type_ctor_info(TypeCtor)) =
+ string__append("__type0_", rtti__type_ctor_to_string(TypeCtor)).
+pseudo_type_to_string(type_info(TypeCtor, ArgTypes)) =
string__append_list([
- "__type_", rtti__type_id_to_string(TypeId),
+ "__type_", rtti__type_ctor_to_string(TypeCtor),
pseudo_type_list_to_string(ArgTypes)
]).
-pseudo_type_to_string(higher_order_type_info(TypeId, Arity, ArgTypes)) =
+pseudo_type_to_string(higher_order_type_info(TypeCtor, Arity, ArgTypes)) =
string__append_list([
- "__ho_type_", rtti__type_id_to_string(TypeId),
+ "__ho_type_", rtti__type_ctor_to_string(TypeCtor),
"_", string__int_to_string(Arity),
pseudo_type_list_to_string(ArgTypes)
]).
-:- func rtti__type_id_to_string(rtti_type_id) = string.
-rtti__type_id_to_string(RttiTypeId) = String :-
- rtti__mangle_rtti_type_id(RttiTypeId, ModuleName, TypeName, A_Str),
+:- func rtti__type_ctor_to_string(rtti_type_ctor) = string.
+rtti__type_ctor_to_string(RttiTypeCtor) = String :-
+ rtti__mangle_rtti_type_ctor(RttiTypeCtor, ModuleName, TypeName, A_Str),
String0 = string__append_list([ModuleName, "__", TypeName, "_", A_Str]),
% To ensure that the mapping is one-to-one, and to make demangling
% easier, we insert the length of the string at the start of the string.
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.24
diff -u -b -r1.24 rtti_out.m
--- compiler/rtti_out.m 2002/01/25 08:22:53 1.24
+++ compiler/rtti_out.m 2002/02/25 16:03:47
@@ -54,15 +54,15 @@
bool::in, io__state::di, io__state::uo) is det.
% Output the C name of the rtti_data specified by the given
- % rtti_type_id and rtti_name.
-:- pred output_rtti_addr(rtti_type_id::in, rtti_name::in,
+ % rtti_type_ctor and rtti_name.
+:- pred output_rtti_addr(rtti_type_ctor::in, rtti_name::in,
io__state::di, io__state::uo) is det.
% Output the C storage class, C type, and C name of the rtti_data
- % specified by the given rtti_type_id and rtti_name,
+ % specified by the given rtti_type_ctor and rtti_name,
% for use in a declaration or definition.
% The bool should be `yes' iff it is for a definition.
-:- pred output_rtti_addr_storage_type_name(rtti_type_id::in, rtti_name::in,
+:- pred output_rtti_addr_storage_type_name(rtti_type_ctor::in, rtti_name::in,
bool::in, io__state::di, io__state::uo) is det.
% The same as output_rtti_addr_storage_type_name,
@@ -94,9 +94,9 @@
%-----------------------------------------------------------------------------%
-output_rtti_data_defn(exist_locns(RttiTypeId, Ordinal, Locns),
+output_rtti_data_defn(exist_locns(RttiTypeCtor, Ordinal, Locns),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_defn_start(RttiTypeId, exist_locns(Ordinal),
+ output_generic_rtti_data_defn_start(RttiTypeCtor, exist_locns(Ordinal),
DeclSet0, DeclSet),
(
% ANSI/ISO C doesn't allow empty arrays, so
@@ -109,11 +109,11 @@
output_exist_locns(Locns),
io__write_string("};\n")
).
-output_rtti_data_defn(exist_info(RttiTypeId, Ordinal, Plain, InTci, Tci,
+output_rtti_data_defn(exist_info(RttiTypeCtor, Ordinal, Plain, InTci, Tci,
Locns), DeclSet0, DeclSet) -->
- output_rtti_addr_decls(RttiTypeId, Locns, "", "", 0, _,
+ output_rtti_addr_decls(RttiTypeCtor, Locns, "", "", 0, _,
DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId, exist_info(Ordinal),
+ output_generic_rtti_data_defn_start(RttiTypeCtor, exist_info(Ordinal),
DeclSet1, DeclSet),
io__write_string(" = {\n\t"),
io__write_int(Plain),
@@ -122,11 +122,11 @@
io__write_string(",\n\t"),
io__write_int(Tci),
io__write_string(",\n\t"),
- output_rtti_addr(RttiTypeId, Locns),
+ output_rtti_addr(RttiTypeCtor, Locns),
io__write_string("\n};\n").
-output_rtti_data_defn(field_names(RttiTypeId, Ordinal, MaybeNames),
+output_rtti_data_defn(field_names(RttiTypeCtor, Ordinal, MaybeNames),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_defn_start(RttiTypeId, field_names(Ordinal),
+ output_generic_rtti_data_defn_start(RttiTypeCtor, field_names(Ordinal),
DeclSet0, DeclSet),
(
% ANSI/ISO C doesn't allow empty arrays, so
@@ -139,10 +139,10 @@
output_maybe_quoted_strings(MaybeNames),
io__write_string("};\n")
).
-output_rtti_data_defn(field_types(RttiTypeId, Ordinal, Types),
+output_rtti_data_defn(field_types(RttiTypeCtor, Ordinal, Types),
DeclSet0, DeclSet) -->
output_rtti_datas_decls(Types, "", "", 0, _, DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId, field_types(Ordinal),
+ output_generic_rtti_data_defn_start(RttiTypeCtor, field_types(Ordinal),
DeclSet1, DeclSet),
(
% ANSI/ISO C doesn't allow empty arrays, so
@@ -155,9 +155,9 @@
output_addr_of_rtti_datas(Types),
io__write_string("};\n")
).
-output_rtti_data_defn(reserved_addrs(RttiTypeId, ReservedAddrs),
+output_rtti_data_defn(reserved_addrs(RttiTypeCtor, ReservedAddrs),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_defn_start(RttiTypeId, reserved_addrs,
+ output_generic_rtti_data_defn_start(RttiTypeCtor, reserved_addrs,
DeclSet0, DeclSet),
(
% ANSI/ISO C doesn't allow empty arrays, so
@@ -170,12 +170,12 @@
io__write_list(ReservedAddrs, ",\n\t", output_reserved_address),
io__write_string("\n};\n")
).
-output_rtti_data_defn(reserved_addr_functors(RttiTypeId, FunctorDescs),
+output_rtti_data_defn(reserved_addr_functors(RttiTypeCtor, FunctorDescs),
DeclSet0, DeclSet) -->
- output_rtti_addrs_decls(RttiTypeId, FunctorDescs, "", "", 0, _,
+ output_rtti_addrs_decls(RttiTypeCtor, FunctorDescs, "", "", 0, _,
DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId, reserved_addr_functors,
- DeclSet1, DeclSet),
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
+ reserved_addr_functors, DeclSet1, DeclSet),
(
% ANSI/ISO C doesn't allow empty arrays, so
% place a dummy value in the array if necessary.
@@ -184,22 +184,22 @@
io__write_string("= { NULL };\n")
;
io__write_string(" = {\n"),
- output_addr_of_rtti_addrs(RttiTypeId, FunctorDescs),
+ output_addr_of_rtti_addrs(RttiTypeCtor, FunctorDescs),
io__write_string("};\n")
).
-output_rtti_data_defn(enum_functor_desc(RttiTypeId, FunctorName, Ordinal),
+output_rtti_data_defn(enum_functor_desc(RttiTypeCtor, FunctorName, Ordinal),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
enum_functor_desc(Ordinal), DeclSet0, DeclSet),
io__write_string(" = {\n\t"""),
c_util__output_quoted_string(FunctorName),
io__write_string(""",\n\t"),
io__write_int(Ordinal),
io__write_string("\n};\n").
-output_rtti_data_defn(notag_functor_desc(RttiTypeId, FunctorName, ArgType,
+output_rtti_data_defn(notag_functor_desc(RttiTypeCtor, FunctorName, ArgType,
MaybeArgName), DeclSet0, DeclSet) -->
output_rtti_data_decls(ArgType, "", "", 0, _, DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId, notag_functor_desc,
+ output_generic_rtti_data_defn_start(RttiTypeCtor, notag_functor_desc,
DeclSet1, DeclSet),
io__write_string(" = {\n\t"""),
c_util__output_quoted_string(FunctorName),
@@ -216,13 +216,13 @@
io__write_string("NULL")
),
io__write_string("\n};\n").
-output_rtti_data_defn(du_functor_desc(RttiTypeId, FunctorName, Ptag, Stag,
+output_rtti_data_defn(du_functor_desc(RttiTypeCtor, FunctorName, Ptag, Stag,
Locn, Ordinal, Arity, ContainsVarBitVector, MaybeArgTypes,
MaybeNames, MaybeExist),
DeclSet0, DeclSet) -->
(
{ MaybeArgTypes = yes(ArgTypes) },
- output_rtti_addr_decls(RttiTypeId, ArgTypes, "", "", 0, _,
+ output_rtti_addr_decls(RttiTypeCtor, ArgTypes, "", "", 0, _,
DeclSet0, DeclSet1)
;
{ MaybeArgTypes = no },
@@ -230,7 +230,7 @@
),
(
{ MaybeNames = yes(NamesInfo1) },
- output_rtti_addr_decls(RttiTypeId, NamesInfo1, "", "",
+ output_rtti_addr_decls(RttiTypeCtor, NamesInfo1, "", "",
0, _, DeclSet1, DeclSet2)
;
{ MaybeNames = no },
@@ -238,13 +238,13 @@
),
(
{ MaybeExist = yes(ExistInfo1) },
- output_rtti_addr_decls(RttiTypeId, ExistInfo1, "", "",
+ output_rtti_addr_decls(RttiTypeCtor, ExistInfo1, "", "",
0, _, DeclSet2, DeclSet3)
;
{ MaybeExist = no },
{ DeclSet3 = DeclSet2 }
),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
du_functor_desc(Ordinal), DeclSet3, DeclSet),
io__write_string(" = {\n\t"""),
c_util__output_quoted_string(FunctorName),
@@ -265,7 +265,7 @@
io__write_string("(MR_PseudoTypeInfo *) "), % cast away const
(
{ MaybeArgTypes = yes(ArgTypes2) },
- output_addr_of_rtti_addr(RttiTypeId, ArgTypes2)
+ output_addr_of_rtti_addr(RttiTypeCtor, ArgTypes2)
;
{ MaybeArgTypes = no },
io__write_string("NULL")
@@ -273,7 +273,7 @@
io__write_string(",\n\t"),
(
{ MaybeNames = yes(NamesInfo2) },
- output_rtti_addr(RttiTypeId, NamesInfo2)
+ output_rtti_addr(RttiTypeCtor, NamesInfo2)
;
{ MaybeNames = no },
io__write_string("NULL")
@@ -281,15 +281,15 @@
io__write_string(",\n\t"),
(
{ MaybeExist = yes(ExistInfo2) },
- output_addr_of_rtti_addr(RttiTypeId, ExistInfo2)
+ output_addr_of_rtti_addr(RttiTypeCtor, ExistInfo2)
;
{ MaybeExist = no },
io__write_string("NULL")
),
io__write_string("\n};\n").
-output_rtti_data_defn(reserved_addr_functor_desc(RttiTypeId, FunctorName, Ordinal,
- ReservedAddr), DeclSet0, DeclSet) -->
- output_generic_rtti_data_defn_start(RttiTypeId,
+output_rtti_data_defn(reserved_addr_functor_desc(RttiTypeCtor, FunctorName,
+ Ordinal, ReservedAddr), DeclSet0, DeclSet) -->
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
reserved_addr_functor_desc(Ordinal), DeclSet0, DeclSet),
io__write_string(" = {\n\t"""),
c_util__output_quoted_string(FunctorName),
@@ -298,46 +298,47 @@
io__write_string(",\n\t"),
output_reserved_address(ReservedAddr),
io__write_string("\n};\n").
-output_rtti_data_defn(enum_name_ordered_table(RttiTypeId, Functors),
+output_rtti_data_defn(enum_name_ordered_table(RttiTypeCtor, Functors),
DeclSet0, DeclSet) -->
- output_rtti_addrs_decls(RttiTypeId, Functors, "", "", 0, _,
+ output_rtti_addrs_decls(RttiTypeCtor, Functors, "", "", 0, _,
DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
enum_name_ordered_table, DeclSet1, DeclSet),
io__write_string(" = {\n"),
- output_addr_of_rtti_addrs(RttiTypeId, Functors),
+ output_addr_of_rtti_addrs(RttiTypeCtor, Functors),
io__write_string("};\n").
-output_rtti_data_defn(enum_value_ordered_table(RttiTypeId, Functors),
+output_rtti_data_defn(enum_value_ordered_table(RttiTypeCtor, Functors),
DeclSet0, DeclSet) -->
- output_rtti_addrs_decls(RttiTypeId, Functors, "", "", 0, _,
+ output_rtti_addrs_decls(RttiTypeCtor, Functors, "", "", 0, _,
DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
enum_value_ordered_table, DeclSet1, DeclSet),
io__write_string(" = {\n"),
- output_addr_of_rtti_addrs(RttiTypeId, Functors),
+ output_addr_of_rtti_addrs(RttiTypeCtor, Functors),
io__write_string("};\n").
-output_rtti_data_defn(du_name_ordered_table(RttiTypeId, Functors),
+output_rtti_data_defn(du_name_ordered_table(RttiTypeCtor, Functors),
DeclSet0, DeclSet) -->
- output_rtti_addrs_decls(RttiTypeId, Functors, "", "", 0, _,
+ output_rtti_addrs_decls(RttiTypeCtor, Functors, "", "", 0, _,
DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
du_name_ordered_table, DeclSet1, DeclSet),
io__write_string(" = {\n"),
- output_addr_of_rtti_addrs(RttiTypeId, Functors),
+ output_addr_of_rtti_addrs(RttiTypeCtor, Functors),
io__write_string("};\n").
-output_rtti_data_defn(du_stag_ordered_table(RttiTypeId, Ptag, Sharers),
+output_rtti_data_defn(du_stag_ordered_table(RttiTypeCtor, Ptag, Sharers),
DeclSet0, DeclSet) -->
- output_rtti_addrs_decls(RttiTypeId, Sharers, "", "", 0, _,
+ output_rtti_addrs_decls(RttiTypeCtor, Sharers, "", "", 0, _,
DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
du_stag_ordered_table(Ptag), DeclSet1, DeclSet),
io__write_string(" = {\n"),
- output_addr_of_rtti_addrs(RttiTypeId, Sharers),
+ output_addr_of_rtti_addrs(RttiTypeCtor, Sharers),
io__write_string("\n};\n").
-output_rtti_data_defn(du_ptag_ordered_table(RttiTypeId, PtagLayouts),
+output_rtti_data_defn(du_ptag_ordered_table(RttiTypeCtor, PtagLayouts),
DeclSet0, DeclSet) -->
- output_ptag_layout_decls(PtagLayouts, RttiTypeId, DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_ptag_layout_decls(PtagLayouts, RttiTypeCtor,
+ DeclSet0, DeclSet1),
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
du_ptag_ordered_table, DeclSet1, DeclSet),
io__write_string(" = {\n"),
globals__io_lookup_bool_option(reserve_tag, ReserveTag),
@@ -350,29 +351,29 @@
;
[]
),
- output_ptag_layout_defns(PtagLayouts, RttiTypeId),
+ output_ptag_layout_defns(PtagLayouts, RttiTypeCtor),
io__write_string("\n};\n").
-output_rtti_data_defn(reserved_addr_table(RttiTypeId, NumNumericReservedAddrs,
- NumSymbolicReservedAddrs, SymbolicReservedAddrs,
- ReservedAddrFunctorDescs, DuFunctorLayout),
- DeclSet0, DeclSet) -->
- output_rtti_addrs_decls(RttiTypeId, [SymbolicReservedAddrs,
+output_rtti_data_defn(reserved_addr_table(RttiTypeCtor,
+ NumNumericReservedAddrs, NumSymbolicReservedAddrs,
+ SymbolicReservedAddrs, ReservedAddrFunctorDescs,
+ DuFunctorLayout), DeclSet0, DeclSet) -->
+ output_rtti_addrs_decls(RttiTypeCtor, [SymbolicReservedAddrs,
DuFunctorLayout, ReservedAddrFunctorDescs],
"", "", 0, _, DeclSet0, DeclSet1),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
reserved_addr_table, DeclSet1, DeclSet),
io__write_string(" = {\n\t"),
io__write_int(NumNumericReservedAddrs),
io__write_string(",\n\t"),
io__write_int(NumSymbolicReservedAddrs),
io__write_string(",\n\t"),
- output_rtti_addr(RttiTypeId, SymbolicReservedAddrs),
+ output_rtti_addr(RttiTypeCtor, SymbolicReservedAddrs),
io__write_string(",\n\t"),
- output_rtti_addr(RttiTypeId, ReservedAddrFunctorDescs),
+ output_rtti_addr(RttiTypeCtor, ReservedAddrFunctorDescs),
io__write_string(",\n\t"),
- output_rtti_addr(RttiTypeId, DuFunctorLayout),
+ output_rtti_addr(RttiTypeCtor, DuFunctorLayout),
io__write_string("\n};\n").
-output_rtti_data_defn(type_ctor_info(RttiTypeId, Unify, Compare, CtorRep,
+output_rtti_data_defn(type_ctor_info(RttiTypeCtor, Unify, Compare, CtorRep,
Version, NumPtags, NumFunctors, FunctorsInfo, LayoutInfo),
DeclSet0, DeclSet) -->
{ UnifyCA = make_maybe_code_addr(Unify) },
@@ -381,13 +382,13 @@
{ CodeAddrs = list__filter_map(func(yes(CA)) = CA is semidet,
MaybeCodeAddrs) },
output_code_addrs_decls(CodeAddrs, "", "", 0, _, DeclSet0, DeclSet1),
- output_functors_info_decl(RttiTypeId, FunctorsInfo,
+ output_functors_info_decl(RttiTypeCtor, FunctorsInfo,
DeclSet1, DeclSet2),
- output_layout_info_decl(RttiTypeId, LayoutInfo, DeclSet2, DeclSet3),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_layout_info_decl(RttiTypeCtor, LayoutInfo, DeclSet2, DeclSet3),
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
type_ctor_info, DeclSet3, DeclSet),
io__write_string(" = {\n\t"),
- { RttiTypeId = rtti_type_id(Module, Type, TypeArity) },
+ { RttiTypeCtor = rtti_type_ctor(Module, Type, TypeArity) },
io__write_int(TypeArity),
io__write_string(",\n\t"),
io__write_int(Version),
@@ -409,17 +410,17 @@
(
{ FunctorsInfo = enum_functors(EnumFunctorsInfo) },
io__write_string("{ (void *) "),
- output_rtti_addr(RttiTypeId, EnumFunctorsInfo),
+ output_rtti_addr(RttiTypeCtor, EnumFunctorsInfo),
io__write_string(" }")
;
{ FunctorsInfo = notag_functors(NotagFunctorsInfo) },
io__write_string("{ (void *) &"),
- output_rtti_addr(RttiTypeId, NotagFunctorsInfo),
+ output_rtti_addr(RttiTypeCtor, NotagFunctorsInfo),
io__write_string(" }")
;
{ FunctorsInfo = du_functors(DuFunctorsInfo) },
io__write_string("{ (void *) "),
- output_rtti_addr(RttiTypeId, DuFunctorsInfo),
+ output_rtti_addr(RttiTypeCtor, DuFunctorsInfo),
io__write_string(" }")
;
{ FunctorsInfo = no_functors },
@@ -429,22 +430,22 @@
(
{ LayoutInfo = enum_layout(EnumLayoutInfo) },
io__write_string("{ (void *) "),
- output_rtti_addr(RttiTypeId, EnumLayoutInfo),
+ output_rtti_addr(RttiTypeCtor, EnumLayoutInfo),
io__write_string(" }")
;
{ LayoutInfo = notag_layout(NotagLayoutInfo) },
io__write_string("{ (void *) &"),
- output_rtti_addr(RttiTypeId, NotagLayoutInfo),
+ output_rtti_addr(RttiTypeCtor, NotagLayoutInfo),
io__write_string(" }")
;
{ LayoutInfo = du_layout(DuLayoutInfo) },
io__write_string("{ (void *) "),
- output_rtti_addr(RttiTypeId, DuLayoutInfo),
+ output_rtti_addr(RttiTypeCtor, DuLayoutInfo),
io__write_string(" }")
;
{ LayoutInfo = reserved_addr_layout(RaLayoutInfo) },
io__write_string("{ (void *) &"),
- output_rtti_addr(RttiTypeId, RaLayoutInfo),
+ output_rtti_addr(RttiTypeCtor, RaLayoutInfo),
io__write_string(" }")
;
{ LayoutInfo = equiv_layout(EquivTypeInfo) },
@@ -464,7 +465,7 @@
% (
% { MaybeHashCons = yes(HashConsDataAddr) },
% io__write_string("&"),
-% output_rtti_addr(RttiTypeId, HashConsDataAddr)
+% output_rtti_addr(RttiTypeCtor, HashConsDataAddr)
% ;
% { MaybeHashCons = no },
% io__write_string("NULL")
@@ -479,9 +480,9 @@
output_rtti_data_defn(pseudo_type_info(Pseudo), DeclSet0, DeclSet) -->
output_pseudo_type_info_defn(Pseudo, DeclSet0, DeclSet).
-:- pred output_base_typeclass_info_defn(module_name, class_id, string,
- base_typeclass_info, decl_set, decl_set, io__state, io__state).
-:- mode output_base_typeclass_info_defn(in, in, in, in, in, out, di, uo) is det.
+:- pred output_base_typeclass_info_defn(module_name::in, class_id::in,
+ string::in, base_typeclass_info::in, decl_set::in, decl_set::out,
+ io__state::di, io__state::uo) is det.
output_base_typeclass_info_defn(InstanceModuleName, ClassId, InstanceString,
base_typeclass_info(N1, N2, N3, N4, N5, Methods),
@@ -516,92 +517,95 @@
output_pseudo_type_info_defn(type_var(_), DeclSet, DeclSet) --> [].
output_pseudo_type_info_defn(type_ctor_info(_), DeclSet, DeclSet) --> [].
output_pseudo_type_info_defn(TypeInfo, DeclSet0, DeclSet) -->
- { TypeInfo = type_info(RttiTypeId, ArgTypes) },
- { TypeCtorRttiData = pseudo_type_info(type_ctor_info(RttiTypeId)) },
+ { TypeInfo = type_info(RttiTypeCtor, ArgTypes) },
+ { TypeCtorRttiData = pseudo_type_info(type_ctor_info(RttiTypeCtor)) },
{ ArgRttiDatas = list__map(func(P) = pseudo_type_info(P), ArgTypes) },
output_rtti_data_decls(TypeCtorRttiData, "", "", 0, _, DeclSet0, DeclSet1),
output_rtti_datas_decls(ArgRttiDatas, "", "", 0, _, DeclSet1, DeclSet2),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
pseudo_type_info(TypeInfo), DeclSet2, DeclSet),
io__write_string(" = {\n\t&"),
- output_rtti_addr(RttiTypeId, type_ctor_info),
+ output_rtti_addr(RttiTypeCtor, type_ctor_info),
io__write_string(",\n{"),
output_addr_of_rtti_datas(ArgRttiDatas),
io__write_string("}};\n").
output_pseudo_type_info_defn(HO_TypeInfo, DeclSet0, DeclSet) -->
- { HO_TypeInfo = higher_order_type_info(RttiTypeId, Arity, ArgTypes) },
- { TypeCtorRttiData = pseudo_type_info(type_ctor_info(RttiTypeId)) },
+ { HO_TypeInfo = higher_order_type_info(RttiTypeCtor, Arity,
+ ArgTypes) },
+ { TypeCtorRttiData = pseudo_type_info(type_ctor_info(RttiTypeCtor)) },
{ ArgRttiDatas = list__map(func(P) = pseudo_type_info(P), ArgTypes) },
- output_rtti_data_decls(TypeCtorRttiData, "", "", 0, _, DeclSet0, DeclSet1),
+ output_rtti_data_decls(TypeCtorRttiData, "", "", 0, _,
+ DeclSet0, DeclSet1),
output_rtti_datas_decls(ArgRttiDatas, "", "", 0, _, DeclSet1, DeclSet2),
- output_generic_rtti_data_defn_start(RttiTypeId,
+ output_generic_rtti_data_defn_start(RttiTypeCtor,
pseudo_type_info(HO_TypeInfo), DeclSet2, DeclSet),
io__write_string(" = {\n\t&"),
- output_rtti_addr(RttiTypeId, type_ctor_info),
+ output_rtti_addr(RttiTypeCtor, type_ctor_info),
io__write_string(",\n\t"),
io__write_int(Arity),
io__write_string(",\n{"),
output_addr_of_rtti_datas(ArgRttiDatas),
io__write_string("}};\n").
-:- pred output_functors_info_decl(rtti_type_id::in,
+:- pred output_functors_info_decl(rtti_type_ctor::in,
type_ctor_functors_info::in, decl_set::in, decl_set::out,
io__state::di, io__state::uo) is det.
-output_functors_info_decl(RttiTypeId, enum_functors(EnumFunctorsInfo),
+output_functors_info_decl(RttiTypeCtor, enum_functors(EnumFunctorsInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, EnumFunctorsInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, EnumFunctorsInfo,
DeclSet0, DeclSet).
-output_functors_info_decl(RttiTypeId, notag_functors(NotagFunctorsInfo),
+output_functors_info_decl(RttiTypeCtor, notag_functors(NotagFunctorsInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, NotagFunctorsInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, NotagFunctorsInfo,
DeclSet0, DeclSet).
-output_functors_info_decl(RttiTypeId, du_functors(DuFunctorsInfo),
+output_functors_info_decl(RttiTypeCtor, du_functors(DuFunctorsInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, DuFunctorsInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, DuFunctorsInfo,
DeclSet0, DeclSet).
-output_functors_info_decl(_RttiTypeId, no_functors, DeclSet, DeclSet) --> [].
+output_functors_info_decl(_RttiTypeCtor, no_functors, DeclSet, DeclSet) --> [].
-:- pred output_layout_info_decl(rtti_type_id::in, type_ctor_layout_info::in,
+:- pred output_layout_info_decl(rtti_type_ctor::in, type_ctor_layout_info::in,
decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
-output_layout_info_decl(RttiTypeId, enum_layout(EnumLayoutInfo),
+output_layout_info_decl(RttiTypeCtor, enum_layout(EnumLayoutInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, EnumLayoutInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, EnumLayoutInfo,
DeclSet0, DeclSet).
-output_layout_info_decl(RttiTypeId, notag_layout(NotagLayoutInfo),
+output_layout_info_decl(RttiTypeCtor, notag_layout(NotagLayoutInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, NotagLayoutInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, NotagLayoutInfo,
DeclSet0, DeclSet).
-output_layout_info_decl(RttiTypeId, du_layout(DuLayoutInfo),
+output_layout_info_decl(RttiTypeCtor, du_layout(DuLayoutInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, DuLayoutInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, DuLayoutInfo,
DeclSet0, DeclSet).
-output_layout_info_decl(RttiTypeId, reserved_addr_layout(RaLayoutInfo),
+output_layout_info_decl(RttiTypeCtor, reserved_addr_layout(RaLayoutInfo),
DeclSet0, DeclSet) -->
- output_generic_rtti_data_decl(RttiTypeId, RaLayoutInfo,
+ output_generic_rtti_data_decl(RttiTypeCtor, RaLayoutInfo,
DeclSet0, DeclSet).
-output_layout_info_decl(_RttiTypeId, equiv_layout(EquivRttiData),
+output_layout_info_decl(_RttiTypeCtor, equiv_layout(EquivRttiData),
DeclSet0, DeclSet) -->
output_rtti_data_decl(EquivRttiData, DeclSet0, DeclSet).
-output_layout_info_decl(_RttiTypeId, no_layout, DeclSet, DeclSet) --> [].
+output_layout_info_decl(_RttiTypeCtor, no_layout, DeclSet, DeclSet) --> [].
-:- pred output_ptag_layout_decls(list(du_ptag_layout)::in, rtti_type_id::in,
+:- pred output_ptag_layout_decls(list(du_ptag_layout)::in, rtti_type_ctor::in,
decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
output_ptag_layout_decls([], _, DeclSet, DeclSet) --> [].
-output_ptag_layout_decls([DuPtagLayout | DuPtagLayouts], RttiTypeId,
+output_ptag_layout_decls([DuPtagLayout | DuPtagLayouts], RttiTypeCtor,
DeclSet0, DeclSet) -->
{ DuPtagLayout = du_ptag_layout(_, _, Descriptors) },
- output_rtti_addr_decls(RttiTypeId, Descriptors, "", "", 0, _,
+ output_rtti_addr_decls(RttiTypeCtor, Descriptors, "", "", 0, _,
DeclSet0, DeclSet1),
- output_ptag_layout_decls(DuPtagLayouts, RttiTypeId, DeclSet1, DeclSet).
+ output_ptag_layout_decls(DuPtagLayouts, RttiTypeCtor,
+ DeclSet1, DeclSet).
-:- pred output_ptag_layout_defns(list(du_ptag_layout)::in, rtti_type_id::in,
+:- pred output_ptag_layout_defns(list(du_ptag_layout)::in, rtti_type_ctor::in,
io__state::di, io__state::uo) is det.
output_ptag_layout_defns([], _) --> [].
-output_ptag_layout_defns([DuPtagLayout | DuPtagLayouts], RttiTypeId) -->
+output_ptag_layout_defns([DuPtagLayout | DuPtagLayouts], RttiTypeCtor) -->
{ DuPtagLayout = du_ptag_layout(NumSharers, Locn, Descriptors) },
io__write_string("\t{ "),
io__write_int(NumSharers),
@@ -609,13 +613,13 @@
{ rtti__sectag_locn_to_string(Locn, LocnStr) },
io__write_string(LocnStr),
io__write_string(",\n\t"),
- output_rtti_addr(RttiTypeId, Descriptors),
+ output_rtti_addr(RttiTypeCtor, Descriptors),
( { DuPtagLayouts = [] } ->
io__write_string(" }\n")
;
io__write_string(" },\n")
),
- output_ptag_layout_defns(DuPtagLayouts, RttiTypeId).
+ output_ptag_layout_defns(DuPtagLayouts, RttiTypeCtor).
% Output a `dummy' ptag layout, for use by tags that aren't *real*
% tags, such as the tag reserved when --reserve-tag is on.
@@ -660,8 +664,8 @@
output_base_typeclass_info_decl(InstanceModuleName, ClassId,
InstanceStr, no, DeclSet0, DeclSet)
;
- { rtti_data_to_name(RttiData, RttiTypeId, RttiName) },
- output_generic_rtti_data_decl(RttiTypeId, RttiName,
+ { rtti_data_to_name(RttiData, RttiTypeCtor, RttiName) },
+ output_generic_rtti_data_decl(RttiTypeCtor, RttiName,
DeclSet0, DeclSet)
).
@@ -687,27 +691,28 @@
%-----------------------------------------------------------------------------%
-:- pred output_generic_rtti_data_decl(rtti_type_id::in, rtti_name::in,
+:- pred output_generic_rtti_data_decl(rtti_type_ctor::in, rtti_name::in,
decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
-output_generic_rtti_data_decl(RttiTypeId, RttiName, DeclSet0, DeclSet) -->
- output_rtti_addr_storage_type_name(RttiTypeId, RttiName, no),
+output_generic_rtti_data_decl(RttiTypeCtor, RttiName, DeclSet0, DeclSet) -->
+ output_rtti_addr_storage_type_name(RttiTypeCtor, RttiName, no),
io__write_string(";\n"),
- { DataAddr = rtti_addr(RttiTypeId, RttiName) },
+ { DataAddr = rtti_addr(RttiTypeCtor, RttiName) },
{ decl_set_insert(DeclSet0, data_addr(DataAddr), DeclSet) }.
-:- pred output_generic_rtti_data_defn_start(rtti_type_id::in, rtti_name::in,
+:- pred output_generic_rtti_data_defn_start(rtti_type_ctor::in, rtti_name::in,
decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
-output_generic_rtti_data_defn_start(RttiTypeId, RttiName, DeclSet0, DeclSet) -->
+output_generic_rtti_data_defn_start(RttiTypeCtor, RttiName, DeclSet0, DeclSet)
+ -->
io__write_string("\n"),
- output_rtti_addr_storage_type_name(RttiTypeId, RttiName, yes),
- { DataAddr = rtti_addr(RttiTypeId, RttiName) },
+ output_rtti_addr_storage_type_name(RttiTypeCtor, RttiName, yes),
+ { DataAddr = rtti_addr(RttiTypeCtor, RttiName) },
{ decl_set_insert(DeclSet0, data_addr(DataAddr), DeclSet) }.
-output_rtti_addr_storage_type_name(RttiTypeId, RttiName, BeingDefined) -->
+output_rtti_addr_storage_type_name(RttiTypeCtor, RttiName, BeingDefined) -->
output_rtti_name_storage_type_name(
- output_rtti_addr(RttiTypeId, RttiName),
+ output_rtti_addr(RttiTypeCtor, RttiName),
RttiName, BeingDefined).
:- pred output_rtti_name_storage_type_name(
@@ -773,12 +778,12 @@
rtti_out__init_rtti_data_if_nec(Data) -->
(
- { Data = type_ctor_info(RttiTypeId, _,_,_,_,_,_,_,_) }
+ { Data = type_ctor_info(RttiTypeCtor, _,_,_,_,_,_,_,_) }
->
io__write_string("\tMR_INIT_TYPE_CTOR_INFO(\n\t\t"),
- output_rtti_addr(RttiTypeId, type_ctor_info),
+ output_rtti_addr(RttiTypeCtor, type_ctor_info),
io__write_string(",\n\t\t"),
- { RttiTypeId = rtti_type_id(ModuleName, TypeName, Arity) },
+ { RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, Arity) },
{ llds_out__sym_name_mangle(ModuleName, ModuleNameString) },
{ string__append(ModuleNameString, "__", UnderscoresModule) },
(
@@ -813,22 +818,22 @@
rtti_out__register_rtti_data_if_nec(Data, SplitFiles) -->
(
- { Data = type_ctor_info(RttiTypeId, _,_,_,_,_,_,_,_) }
+ { Data = type_ctor_info(RttiTypeCtor, _,_,_,_,_,_,_,_) }
->
(
{ SplitFiles = yes },
io__write_string("\t{\n\t"),
- output_rtti_addr_storage_type_name(RttiTypeId,
+ output_rtti_addr_storage_type_name(RttiTypeCtor,
type_ctor_info, no),
io__write_string(
";\n\tMR_register_type_ctor_info(\n\t\t&"),
- output_rtti_addr(RttiTypeId, type_ctor_info),
+ output_rtti_addr(RttiTypeCtor, type_ctor_info),
io__write_string(");\n\t}\n")
;
{ SplitFiles = no },
io__write_string(
"\tMR_register_type_ctor_info(\n\t\t&"),
- output_rtti_addr(RttiTypeId, type_ctor_info),
+ output_rtti_addr(RttiTypeCtor, type_ctor_info),
io__write_string(");\n")
)
;
@@ -866,23 +871,23 @@
%-----------------------------------------------------------------------------%
-:- pred output_maybe_rtti_addrs_decls(rtti_type_id::in,
+:- pred output_maybe_rtti_addrs_decls(rtti_type_ctor::in,
list(maybe(rtti_name))::in, string::in, string::in, int::in, int::out,
decl_set::in, decl_set::out, io__state::di, io__state::uo) is det.
output_maybe_rtti_addrs_decls(_, [], _, _, N, N, DeclSet, DeclSet) --> [].
-output_maybe_rtti_addrs_decls(RttiTypeId, [MaybeRttiName | RttiNames],
+output_maybe_rtti_addrs_decls(RttiTypeCtor, [MaybeRttiName | RttiNames],
FirstIndent, LaterIndent, N0, N, DeclSet0, DeclSet) -->
(
{ MaybeRttiName = yes(RttiName) },
- output_data_addr_decls(rtti_addr(RttiTypeId, RttiName),
+ output_data_addr_decls(rtti_addr(RttiTypeCtor, RttiName),
FirstIndent, LaterIndent, N0, N1, DeclSet0, DeclSet1)
;
{ MaybeRttiName = no },
{ N1 = N0 },
{ DeclSet1 = DeclSet0 }
),
- output_maybe_rtti_addrs_decls(RttiTypeId, RttiNames,
+ output_maybe_rtti_addrs_decls(RttiTypeCtor, RttiNames,
FirstIndent, LaterIndent, N1, N, DeclSet1, DeclSet).
:- pred output_rtti_datas_decls(list(rtti_data)::in,
@@ -897,16 +902,16 @@
output_rtti_datas_decls(RttiDatas,
FirstIndent, LaterIndent, N1, N, DeclSet1, DeclSet).
-:- pred output_rtti_addrs_decls(rtti_type_id::in, list(rtti_name)::in,
+:- pred output_rtti_addrs_decls(rtti_type_ctor::in, list(rtti_name)::in,
string::in, string::in, int::in, int::out, decl_set::in, decl_set::out,
io__state::di, io__state::uo) is det.
output_rtti_addrs_decls(_, [], _, _, N, N, DeclSet, DeclSet) --> [].
-output_rtti_addrs_decls(RttiTypeId, [RttiName | RttiNames],
+output_rtti_addrs_decls(RttiTypeCtor, [RttiName | RttiNames],
FirstIndent, LaterIndent, N0, N, DeclSet0, DeclSet) -->
- output_data_addr_decls(rtti_addr(RttiTypeId, RttiName),
+ output_data_addr_decls(rtti_addr(RttiTypeCtor, RttiName),
FirstIndent, LaterIndent, N0, N1, DeclSet0, DeclSet1),
- output_rtti_addrs_decls(RttiTypeId, RttiNames,
+ output_rtti_addrs_decls(RttiTypeCtor, RttiNames,
FirstIndent, LaterIndent, N1, N, DeclSet1, DeclSet).
:- pred output_rtti_data_decls(rtti_data::in,
@@ -931,51 +936,51 @@
InstanceStr, no, DeclSet0, DeclSet),
{ N = N0 }
;
- { rtti_data_to_name(RttiData, RttiTypeId, RttiName) },
- output_rtti_addr_decls(RttiTypeId, RttiName,
+ { rtti_data_to_name(RttiData, RttiTypeCtor, RttiName) },
+ output_rtti_addr_decls(RttiTypeCtor, RttiName,
FirstIndent, LaterIndent, N0, N, DeclSet0, DeclSet)
).
-:- pred output_rtti_addr_decls(rtti_type_id::in, rtti_name::in,
+:- pred output_rtti_addr_decls(rtti_type_ctor::in, rtti_name::in,
string::in, string::in, int::in, int::out, decl_set::in, decl_set::out,
io__state::di, io__state::uo) is det.
-output_rtti_addr_decls(RttiTypeId, RttiName, FirstIndent, LaterIndent,
+output_rtti_addr_decls(RttiTypeCtor, RttiName, FirstIndent, LaterIndent,
N0, N1, DeclSet0, DeclSet1) -->
- output_data_addr_decls(rtti_addr(RttiTypeId, RttiName),
+ output_data_addr_decls(rtti_addr(RttiTypeCtor, RttiName),
FirstIndent, LaterIndent, N0, N1, DeclSet0, DeclSet1).
-:- pred output_addr_of_maybe_rtti_addr(rtti_type_id::in, maybe(rtti_name)::in,
- io__state::di, io__state::uo) is det.
+:- pred output_addr_of_maybe_rtti_addr(rtti_type_ctor::in,
+ maybe(rtti_name)::in, io__state::di, io__state::uo) is det.
-output_addr_of_maybe_rtti_addr(RttiTypeId, MaybeRttiName) -->
+output_addr_of_maybe_rtti_addr(RttiTypeCtor, MaybeRttiName) -->
(
{ MaybeRttiName = yes(RttiName) },
- output_addr_of_rtti_addr(RttiTypeId, RttiName)
+ output_addr_of_rtti_addr(RttiTypeCtor, RttiName)
;
{ MaybeRttiName = no },
io__write_string("NULL")
).
-:- pred output_addr_of_maybe_rtti_addrs(rtti_type_id::in,
+:- pred output_addr_of_maybe_rtti_addrs(rtti_type_ctor::in,
list(maybe(rtti_name))::in, io__state::di, io__state::uo) is det.
output_addr_of_maybe_rtti_addrs(_, []) --> [].
-output_addr_of_maybe_rtti_addrs(RttiTypeId,
+output_addr_of_maybe_rtti_addrs(RttiTypeCtor,
[MaybeRttiName | MaybeRttiNames]) -->
io__write_string("\t"),
io__write_list([MaybeRttiName | MaybeRttiNames], ",\n\t",
- output_addr_of_maybe_rtti_addr(RttiTypeId)),
+ output_addr_of_maybe_rtti_addr(RttiTypeCtor)),
io__write_string("\n").
-:- pred output_addr_of_rtti_addrs(rtti_type_id::in, list(rtti_name)::in,
+:- pred output_addr_of_rtti_addrs(rtti_type_ctor::in, list(rtti_name)::in,
io__state::di, io__state::uo) is det.
output_addr_of_rtti_addrs(_, []) --> [].
-output_addr_of_rtti_addrs(RttiTypeId, [RttiName | RttiNames]) -->
+output_addr_of_rtti_addrs(RttiTypeCtor, [RttiName | RttiNames]) -->
io__write_string("\t"),
io__write_list([RttiName | RttiNames], ",\n\t",
- output_addr_of_rtti_addr(RttiTypeId)),
+ output_addr_of_rtti_addr(RttiTypeCtor)),
io__write_string("\n").
:- pred output_addr_of_rtti_datas(list(rtti_data)::in,
@@ -1001,14 +1006,14 @@
output_base_typeclass_info_name(ClassId,
InstanceStr)
;
- { rtti_data_to_name(RttiData, RttiTypeId, RttiName) },
- output_addr_of_rtti_addr(RttiTypeId, RttiName)
+ { rtti_data_to_name(RttiData, RttiTypeCtor, RttiName) },
+ output_addr_of_rtti_addr(RttiTypeCtor, RttiName)
).
-:- pred output_addr_of_rtti_addr(rtti_type_id::in, rtti_name::in,
+:- pred output_addr_of_rtti_addr(rtti_type_ctor::in, rtti_name::in,
io__state::di, io__state::uo) is det.
-output_addr_of_rtti_addr(RttiTypeId, RttiName) -->
+output_addr_of_rtti_addr(RttiTypeCtor, RttiName) -->
%
% The various different kinds of pseudotypeinfos
% each have different types, but really we treat
@@ -1034,11 +1039,11 @@
;
io__write_string("&")
),
- output_rtti_addr(RttiTypeId, RttiName).
+ output_rtti_addr(RttiTypeCtor, RttiName).
-output_rtti_addr(RttiTypeId, RttiName) -->
+output_rtti_addr(RttiTypeCtor, RttiName) -->
io__write_string(mercury_data_prefix),
- { rtti__addr_to_string(RttiTypeId, RttiName, Str) },
+ { rtti__addr_to_string(RttiTypeCtor, RttiName, Str) },
io__write_string(Str).
%-----------------------------------------------------------------------------%
@@ -1160,11 +1165,13 @@
rtti_name_c_type(field_names(_), "MR_ConstString", "[]").
rtti_name_c_type(field_types(_), "MR_PseudoTypeInfo", "[]").
rtti_name_c_type(reserved_addrs, "/* const */ void *", "[]").
-rtti_name_c_type(reserved_addr_functors, "MR_ReservedAddrFunctorDesc *", "[]").
+rtti_name_c_type(reserved_addr_functors, "MR_ReservedAddrFunctorDesc *",
+ "[]").
rtti_name_c_type(enum_functor_desc(_), "MR_EnumFunctorDesc", "").
rtti_name_c_type(notag_functor_desc, "MR_NotagFunctorDesc", "").
rtti_name_c_type(du_functor_desc(_), "MR_DuFunctorDesc", "").
-rtti_name_c_type(reserved_addr_functor_desc(_), "MR_ReservedAddrFunctorDesc", "").
+rtti_name_c_type(reserved_addr_functor_desc(_), "MR_ReservedAddrFunctorDesc",
+ "").
rtti_name_c_type(enum_name_ordered_table, "MR_EnumFunctorDesc *", "[]").
rtti_name_c_type(enum_value_ordered_table, "MR_EnumFunctorDesc *", "[]").
rtti_name_c_type(du_name_ordered_table, "MR_DuFunctorDesc *", "[]").
@@ -1187,12 +1194,12 @@
error("rtti_name_c_type: type_var").
pseudo_type_info_name_c_type(type_ctor_info(_),
"struct MR_TypeCtorInfo_Struct", "").
-pseudo_type_info_name_c_type(type_info(_TypeId, ArgTypes),
+pseudo_type_info_name_c_type(type_info(_TypeCtor, ArgTypes),
TypeInfoStruct, "") :-
TypeInfoStruct = string__format("struct MR_FO_PseudoTypeInfo_Struct%d",
[i(list__length(ArgTypes))]).
-pseudo_type_info_name_c_type(higher_order_type_info(_TypeId, _Arity, ArgTypes),
- TypeInfoStruct, "") :-
+pseudo_type_info_name_c_type(higher_order_type_info(_TypeCtor, _Arity,
+ ArgTypes), TypeInfoStruct, "") :-
TypeInfoStruct = string__format("struct MR_HO_PseudoTypeInfo_Struct%d",
[i(list__length(ArgTypes))]).
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.24
diff -u -b -r1.24 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m 2002/01/25 08:22:53 1.24
+++ compiler/rtti_to_mlds.m 2002/02/25 16:03:48
@@ -58,8 +58,8 @@
ClassId, InstanceStr),
Name = data(base_typeclass_info(ClassId, InstanceStr))
;
- rtti_data_to_name(RttiData, RttiTypeId, RttiName),
- Name = data(rtti(RttiTypeId, RttiName))
+ rtti_data_to_name(RttiData, RttiTypeCtor, RttiName),
+ Name = data(rtti(RttiTypeCtor, RttiName))
),
%
@@ -125,18 +125,18 @@
mlds__initializer, list(mlds__defn)).
:- mode gen_init_rtti_data_defn(in, in, in, out, out) is det.
-gen_init_rtti_data_defn(exist_locns(_RttiTypeId, _Ordinal, Locns), _, _,
+gen_init_rtti_data_defn(exist_locns(_RttiTypeCtor, _Ordinal, Locns), _, _,
Init, []) :-
Init = gen_init_array(gen_init_exist_locn, Locns).
-gen_init_rtti_data_defn(exist_info(RttiTypeId, _Ordinal, Plain, InTci, Tci,
+gen_init_rtti_data_defn(exist_info(RttiTypeCtor, _Ordinal, Plain, InTci, Tci,
Locns), ModuleName, _, Init, []) :-
Init = init_struct([
gen_init_int(Plain),
gen_init_int(InTci),
gen_init_int(Tci),
- gen_init_rtti_name(ModuleName, RttiTypeId, Locns)
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, Locns)
]).
-gen_init_rtti_data_defn(field_names(_RttiTypeId, _Ordinal, MaybeNames), _, _,
+gen_init_rtti_data_defn(field_names(_RttiTypeCtor, _Ordinal, MaybeNames), _, _,
Init, []) :-
StrType = term__functor(term__atom("string"), [], context("", 0)),
Init = gen_init_array(gen_init_maybe(
@@ -144,28 +144,28 @@
non_foreign_type(StrType)),
gen_init_string), MaybeNames).
-gen_init_rtti_data_defn(field_types(_RttiTypeId, _Ordinal, Types),
+gen_init_rtti_data_defn(field_types(_RttiTypeCtor, _Ordinal, Types),
ModuleName, _, Init, []) :-
Init = gen_init_array(
gen_init_cast_rtti_data(mlds__pseudo_type_info_type,
ModuleName), Types).
-gen_init_rtti_data_defn(reserved_addrs(_RttiTypeId, ReservedAddrs),
+gen_init_rtti_data_defn(reserved_addrs(_RttiTypeCtor, ReservedAddrs),
_ModuleName, ModuleInfo, Init, []) :-
Init = gen_init_array(gen_init_reserved_address(ModuleInfo),
ReservedAddrs).
-gen_init_rtti_data_defn(reserved_addr_functors(RttiTypeId,
+gen_init_rtti_data_defn(reserved_addr_functors(RttiTypeCtor,
ReservedAddrFunctorDescs),
ModuleName, _, Init, []) :-
Init = gen_init_array(
- gen_init_rtti_name(ModuleName, RttiTypeId),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor),
ReservedAddrFunctorDescs).
-gen_init_rtti_data_defn(enum_functor_desc(_RttiTypeId, FunctorName, Ordinal),
+gen_init_rtti_data_defn(enum_functor_desc(_RttiTypeCtor, FunctorName, Ordinal),
_, _, Init, []) :-
Init = init_struct([
gen_init_string(FunctorName),
gen_init_int(Ordinal)
]).
-gen_init_rtti_data_defn(notag_functor_desc(_RttiTypeId, FunctorName, ArgType,
+gen_init_rtti_data_defn(notag_functor_desc(_RttiTypeCtor, FunctorName, ArgType,
MaybeArgName), ModuleName, _, Init, []) :-
Init = init_struct([
gen_init_string(FunctorName),
@@ -173,7 +173,7 @@
ModuleName, ArgType),
gen_init_maybe(ml_string_type, gen_init_string, MaybeArgName)
]).
-gen_init_rtti_data_defn(du_functor_desc(RttiTypeId, FunctorName, Ptag, Stag,
+gen_init_rtti_data_defn(du_functor_desc(RttiTypeCtor, FunctorName, Ptag, Stag,
Locn, Ordinal, Arity, ContainsVarBitVector, MaybeArgTypes,
MaybeNames, MaybeExist), ModuleName, _, Init, []) :-
Init = init_struct([
@@ -185,52 +185,52 @@
gen_init_int(Stag),
gen_init_int(Ordinal),
gen_init_maybe(mlds__rtti_type(field_types(0)),
- gen_init_rtti_name(ModuleName, RttiTypeId),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor),
MaybeArgTypes),
gen_init_maybe(mlds__rtti_type(field_names(0)),
- gen_init_rtti_name(ModuleName, RttiTypeId),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor),
MaybeNames),
gen_init_maybe(mlds__rtti_type(exist_info(0)),
- gen_init_rtti_name(ModuleName, RttiTypeId),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor),
MaybeExist)
]).
-gen_init_rtti_data_defn(reserved_addr_functor_desc(_RttiTypeId, FunctorName, Ordinal,
- ReservedAddress), _, ModuleInfo, Init, []) :-
+gen_init_rtti_data_defn(reserved_addr_functor_desc(_RttiTypeCtor, FunctorName,
+ Ordinal, ReservedAddress), _, ModuleInfo, Init, []) :-
Init = init_struct([
gen_init_string(FunctorName),
gen_init_int(Ordinal),
gen_init_reserved_address(ModuleInfo, ReservedAddress)
]).
-gen_init_rtti_data_defn(enum_name_ordered_table(RttiTypeId, Functors),
+gen_init_rtti_data_defn(enum_name_ordered_table(RttiTypeCtor, Functors),
ModuleName, _, Init, []) :-
- Init = gen_init_rtti_names_array(ModuleName, RttiTypeId, Functors).
-gen_init_rtti_data_defn(enum_value_ordered_table(RttiTypeId, Functors),
+ Init = gen_init_rtti_names_array(ModuleName, RttiTypeCtor, Functors).
+gen_init_rtti_data_defn(enum_value_ordered_table(RttiTypeCtor, Functors),
ModuleName, _, Init, []) :-
- Init = gen_init_rtti_names_array(ModuleName, RttiTypeId, Functors).
-gen_init_rtti_data_defn(du_name_ordered_table(RttiTypeId, Functors),
+ Init = gen_init_rtti_names_array(ModuleName, RttiTypeCtor, Functors).
+gen_init_rtti_data_defn(du_name_ordered_table(RttiTypeCtor, Functors),
ModuleName, _, Init, []) :-
- Init = gen_init_rtti_names_array(ModuleName, RttiTypeId, Functors).
-gen_init_rtti_data_defn(du_stag_ordered_table(RttiTypeId, _Ptag, Sharers),
+ Init = gen_init_rtti_names_array(ModuleName, RttiTypeCtor, Functors).
+gen_init_rtti_data_defn(du_stag_ordered_table(RttiTypeCtor, _Ptag, Sharers),
ModuleName, _, Init, []) :-
- Init = gen_init_rtti_names_array(ModuleName, RttiTypeId, Sharers).
-gen_init_rtti_data_defn(du_ptag_ordered_table(RttiTypeId, PtagLayouts),
+ Init = gen_init_rtti_names_array(ModuleName, RttiTypeCtor, Sharers).
+gen_init_rtti_data_defn(du_ptag_ordered_table(RttiTypeCtor, PtagLayouts),
ModuleName, _, Init, []) :-
- Init = gen_init_array(gen_init_ptag_layout_defn(ModuleName, RttiTypeId),
- PtagLayouts).
-gen_init_rtti_data_defn(reserved_addr_table(RttiTypeId,
+ Init = gen_init_array(gen_init_ptag_layout_defn(ModuleName,
+ RttiTypeCtor), PtagLayouts).
+gen_init_rtti_data_defn(reserved_addr_table(RttiTypeCtor,
NumNumeric, NumSymbolic, ReservedAddrs, FunctorDescs, DuLayout),
ModuleName, _, Init, []) :-
Init = init_struct([
gen_init_int(NumNumeric),
gen_init_int(NumSymbolic),
- gen_init_rtti_name(ModuleName, RttiTypeId, ReservedAddrs),
- gen_init_rtti_name(ModuleName, RttiTypeId, FunctorDescs),
- gen_init_rtti_name(ModuleName, RttiTypeId, DuLayout)
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, ReservedAddrs),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, FunctorDescs),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, DuLayout)
]).
-gen_init_rtti_data_defn(type_ctor_info(RttiTypeId, UnifyProc, CompareProc,
+gen_init_rtti_data_defn(type_ctor_info(RttiTypeCtor, UnifyProc, CompareProc,
CtorRep, Version, NumPtags, NumFunctors, FunctorsInfo,
LayoutInfo), ModuleName, ModuleInfo, Init, []) :-
- RttiTypeId = rtti_type_id(TypeModule, Type, TypeArity),
+ RttiTypeCtor = rtti_type_ctor(TypeModule, Type, TypeArity),
prog_out__sym_name_to_string(TypeModule, TypeModuleName),
Init = init_struct([
gen_init_int(TypeArity),
@@ -246,16 +246,17 @@
% get enclosed in curly braces.
init_struct([
gen_init_functors_info(FunctorsInfo, ModuleName,
- RttiTypeId)
+ RttiTypeCtor)
]),
init_struct([
- gen_init_layout_info(LayoutInfo, ModuleName, RttiTypeId)
+ gen_init_layout_info(LayoutInfo, ModuleName,
+ RttiTypeCtor)
]),
gen_init_int(NumFunctors)
% These two are commented out while the corresponding
% fields of the MR_TypeCtorInfo_Struct type are
% commented out.
- % gen_init_maybe(gen_init_rtti_name(RttiTypeId),
+ % gen_init_maybe(gen_init_rtti_name(RttiTypeCtor),
% MaybeHashCons),
% gen_init_maybe_proc_id(ModuleInfo, PrettyprinterProc)
]).
@@ -279,38 +280,39 @@
Init = gen_init_pseudo_type_info_defn(Pseudo, ModuleName).
:- func gen_init_functors_info(type_ctor_functors_info, module_name,
- rtti_type_id) = mlds__initializer.
+ rtti_type_ctor) = mlds__initializer.
gen_init_functors_info(enum_functors(EnumFunctorsInfo), ModuleName,
- RttiTypeId) =
+ RttiTypeCtor) =
gen_init_cast_rtti_name(mlds__generic_type,
- ModuleName, RttiTypeId, EnumFunctorsInfo).
+ ModuleName, RttiTypeCtor, EnumFunctorsInfo).
gen_init_functors_info(notag_functors(NotagFunctorsInfo), ModuleName,
- RttiTypeId) =
+ RttiTypeCtor) =
gen_init_cast_rtti_name(mlds__generic_type,
- ModuleName, RttiTypeId, NotagFunctorsInfo).
+ ModuleName, RttiTypeCtor, NotagFunctorsInfo).
gen_init_functors_info(du_functors(DuFunctorsInfo), ModuleName,
- RttiTypeId) =
+ RttiTypeCtor) =
gen_init_cast_rtti_name(mlds__generic_type,
- ModuleName, RttiTypeId, DuFunctorsInfo).
+ ModuleName, RttiTypeCtor, DuFunctorsInfo).
gen_init_functors_info(no_functors, _, _) =
gen_init_null_pointer(mlds__rtti_type(du_name_ordered_table)).
:- func gen_init_layout_info(type_ctor_layout_info, module_name,
- rtti_type_id) = mlds__initializer.
+ rtti_type_ctor) = mlds__initializer.
-gen_init_layout_info(enum_layout(EnumLayoutInfo), ModuleName, RttiTypeId) =
- gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeId,
+gen_init_layout_info(enum_layout(EnumLayoutInfo), ModuleName, RttiTypeCtor) =
+ gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeCtor,
EnumLayoutInfo).
-gen_init_layout_info(notag_layout(NotagLayoutInfo), ModuleName, RttiTypeId) =
- gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeId,
+gen_init_layout_info(notag_layout(NotagLayoutInfo), ModuleName, RttiTypeCtor) =
+ gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeCtor,
NotagLayoutInfo).
-gen_init_layout_info(du_layout(DuLayoutInfo), ModuleName, RttiTypeId) =
- gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeId,
+gen_init_layout_info(du_layout(DuLayoutInfo), ModuleName, RttiTypeCtor) =
+ gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeCtor,
DuLayoutInfo).
-gen_init_layout_info(reserved_addr_layout(RaLayoutInfo), ModuleName, RttiTypeId) =
- gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeId,
+gen_init_layout_info(reserved_addr_layout(RaLayoutInfo), ModuleName,
+ RttiTypeCtor) =
+ gen_init_cast_rtti_name(mlds__generic_type, ModuleName, RttiTypeCtor,
RaLayoutInfo).
-gen_init_layout_info(equiv_layout(EquivTypeInfo), ModuleName, _RttiTypeId) =
+gen_init_layout_info(equiv_layout(EquivTypeInfo), ModuleName, _RttiTypeCtor) =
gen_init_cast_rtti_data(mlds__generic_type, ModuleName,
EquivTypeInfo).
gen_init_layout_info(no_layout, _, _) =
@@ -332,41 +334,41 @@
error("gen_init_pseudo_type_info_defn: type_var").
gen_init_pseudo_type_info_defn(type_ctor_info(_), _) = _ :-
error("gen_init_pseudo_type_info_defn: type_ctor_info").
-gen_init_pseudo_type_info_defn(type_info(RttiTypeId, ArgTypes), ModuleName) =
+gen_init_pseudo_type_info_defn(type_info(RttiTypeCtor, ArgTypes), ModuleName) =
Init :-
ArgRttiDatas = list__map(func(P) = pseudo_type_info(P), ArgTypes),
Init = init_struct([
- gen_init_rtti_name(ModuleName, RttiTypeId, type_ctor_info),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, type_ctor_info),
gen_init_cast_rtti_datas_array(mlds__pseudo_type_info_type,
ModuleName, ArgRttiDatas)
]).
-gen_init_pseudo_type_info_defn(higher_order_type_info(RttiTypeId,
+gen_init_pseudo_type_info_defn(higher_order_type_info(RttiTypeCtor,
Arity, ArgTypes), ModuleName) = Init :-
ArgRttiDatas = list__map(func(P) = pseudo_type_info(P), ArgTypes),
Init = init_struct([
- gen_init_rtti_name(ModuleName, RttiTypeId, type_ctor_info),
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, type_ctor_info),
gen_init_int(Arity),
gen_init_cast_rtti_datas_array(mlds__pseudo_type_info_type,
ModuleName, ArgRttiDatas)
]).
-:- func gen_init_ptag_layout_defn(module_name, rtti_type_id, du_ptag_layout) =
- mlds__initializer.
+:- func gen_init_ptag_layout_defn(module_name, rtti_type_ctor, du_ptag_layout)
+ = mlds__initializer.
-gen_init_ptag_layout_defn(ModuleName, RttiTypeId, DuPtagLayout) = Init :-
+gen_init_ptag_layout_defn(ModuleName, RttiTypeCtor, DuPtagLayout) = Init :-
DuPtagLayout = du_ptag_layout(NumSharers, Locn, Descriptors) ,
Init = init_struct([
gen_init_int(NumSharers),
gen_init_sectag_locn(Locn),
- gen_init_rtti_name(ModuleName, RttiTypeId, Descriptors)
+ gen_init_rtti_name(ModuleName, RttiTypeCtor, Descriptors)
]).
%-----------------------------------------------------------------------------%
-:- func gen_init_rtti_names_array(module_name, rtti_type_id,
+:- func gen_init_rtti_names_array(module_name, rtti_type_ctor,
list(rtti_name)) = mlds__initializer.
-gen_init_rtti_names_array(ModuleName, RttiTypeId, RttiNames) =
- gen_init_array(gen_init_rtti_name(ModuleName, RttiTypeId), RttiNames).
+gen_init_rtti_names_array(ModuleName, RttiTypeCtor, RttiNames) =
+ gen_init_array(gen_init_rtti_name(ModuleName, RttiTypeCtor), RttiNames).
:- func gen_init_rtti_datas_array(module_name, list(rtti_data)) =
mlds__initializer.
@@ -407,9 +409,9 @@
Initializer = init_obj(unop(gen_cast(SrcType, DestType),
Rval))
;
- rtti_data_to_name(RttiData, RttiTypeId, RttiName),
+ rtti_data_to_name(RttiData, RttiTypeCtor, RttiName),
Initializer = gen_init_cast_rtti_name(DestType,
- ModuleName, RttiTypeId, RttiName)
+ ModuleName, RttiTypeCtor, RttiName)
).
% currently casts only store the destination type
@@ -421,32 +423,32 @@
:- func gen_init_rtti_data(module_name, rtti_data) = mlds__initializer.
gen_init_rtti_data(ModuleName, RttiData) = Initializer :-
- rtti_data_to_name(RttiData, RttiTypeId, RttiName),
- Initializer = gen_init_rtti_name(ModuleName, RttiTypeId, RttiName).
+ rtti_data_to_name(RttiData, RttiTypeCtor, RttiName),
+ Initializer = gen_init_rtti_name(ModuleName, RttiTypeCtor, RttiName).
% Generate an MLDS initializer comprising just the
% the rval for a given rtti_name
-:- func gen_init_rtti_name(module_name, rtti_type_id, rtti_name) =
+:- func gen_init_rtti_name(module_name, rtti_type_ctor, rtti_name) =
mlds__initializer.
-gen_init_rtti_name(ModuleName, RttiTypeId, RttiName) =
- init_obj(gen_rtti_name(ModuleName, RttiTypeId, RttiName)).
+gen_init_rtti_name(ModuleName, RttiTypeCtor, RttiName) =
+ init_obj(gen_rtti_name(ModuleName, RttiTypeCtor, RttiName)).
% Generate the MLDS initializer comprising the rtti_name
% for a given rtti_name, converted to the given type.
-:- func gen_init_cast_rtti_name(mlds__type, module_name, rtti_type_id,
+:- func gen_init_cast_rtti_name(mlds__type, module_name, rtti_type_ctor,
rtti_name) = mlds__initializer.
-gen_init_cast_rtti_name(DestType, ModuleName, RttiTypeId, RttiName) =
+gen_init_cast_rtti_name(DestType, ModuleName, RttiTypeCtor, RttiName) =
Initializer :-
SrcType = rtti_type(RttiName),
Initializer = init_obj(unop(gen_cast(SrcType, DestType),
- gen_rtti_name(ModuleName, RttiTypeId, RttiName))).
+ gen_rtti_name(ModuleName, RttiTypeCtor, RttiName))).
% Generate the MLDS rval for an rtti_name.
-:- func gen_rtti_name(module_name, rtti_type_id, rtti_name) = mlds__rval.
+:- func gen_rtti_name(module_name, rtti_type_ctor, rtti_name) = mlds__rval.
-gen_rtti_name(ThisModuleName, RttiTypeId0, RttiName) = Rval :-
+gen_rtti_name(ThisModuleName, RttiTypeCtor0, RttiName) = Rval :-
%
% Typeinfos are defined locally to each module.
% Other kinds of RTTI data are defining in the module
@@ -459,9 +461,9 @@
)
->
ModuleName = ThisModuleName,
- RttiTypeId = RttiTypeId0
+ RttiTypeCtor = RttiTypeCtor0
;
- RttiTypeId0 = rtti_type_id(RttiModuleName,
+ RttiTypeCtor0 = rtti_type_ctor(RttiModuleName,
RttiTypeName, RttiTypeArity),
%
% Although the builtin types `int', `float', etc. are treated
@@ -471,15 +473,15 @@
%
( RttiModuleName = unqualified("") ->
mercury_public_builtin_module(ModuleName),
- RttiTypeId = rtti_type_id(RttiModuleName,
+ RttiTypeCtor = rtti_type_ctor(RttiModuleName,
RttiTypeName, RttiTypeArity)
;
ModuleName = RttiModuleName,
- RttiTypeId = RttiTypeId0
+ RttiTypeCtor = RttiTypeCtor0
)
),
MLDS_ModuleName = mercury_module_name_to_mlds(ModuleName),
- MLDS_DataName = rtti(RttiTypeId, RttiName),
+ MLDS_DataName = rtti(RttiTypeCtor, RttiName),
DataAddr = data_addr(MLDS_ModuleName, MLDS_DataName),
Rval = const(data_addr_const(DataAddr)).
@@ -679,10 +681,10 @@
error("mlds_rtti_type_name: type_var").
mlds_pseudo_type_info_type_name(type_ctor_info(_)) =
"TypeCtorInfo_Struct".
-mlds_pseudo_type_info_type_name(type_info(_TypeId, ArgTypes)) =
+mlds_pseudo_type_info_type_name(type_info(_TypeCtor, ArgTypes)) =
string__format("FO_PseudoTypeInfo_Struct%d",
[i(list__length(ArgTypes))]).
-mlds_pseudo_type_info_type_name(higher_order_type_info(_TypeId, _Arity,
+mlds_pseudo_type_info_type_name(higher_order_type_info(_TypeCtor, _Arity,
ArgTypes)) =
string__format("HO_PseudoTypeInfo_Struct%d",
[i(list__length(ArgTypes))]).
Index: compiler/simplify.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/simplify.m,v
retrieving revision 1.98
diff -u -b -r1.98 simplify.m
--- compiler/simplify.m 2001/09/13 23:18:14 1.98
+++ compiler/simplify.m 2002/02/25 16:03:48
@@ -1258,15 +1258,15 @@
{ Call = Call1 - GoalInfo },
{ ExtraGoals = [] }
;
- { type_to_type_id(Type, TypeIdPrime, TypeArgsPrime) ->
- TypeId = TypeIdPrime,
+ { type_to_ctor_and_args(Type, TypeCtorPrime, TypeArgsPrime) ->
+ TypeCtor = TypeCtorPrime,
TypeArgs = TypeArgsPrime
;
- error("simplify: type_to_type_id failed")
+ error("simplify: type_to_ctor_and_args failed")
},
{ determinism_components(Det, CanFail, at_most_one) },
- { unify_proc__lookup_mode_num(ModuleInfo, TypeId, UniMode, Det,
- ProcId) },
+ { unify_proc__lookup_mode_num(ModuleInfo, TypeCtor, UniMode,
+ Det, ProcId) },
{ module_info_globals(ModuleInfo, Globals) },
{ globals__lookup_bool_option(Globals, special_preds,
SpecialPreds) },
@@ -1286,7 +1286,7 @@
% if possible.
%
special_pred_is_generated_lazily(ModuleInfo,
- TypeId)
+ TypeCtor)
}
->
simplify__make_type_info_vars([Type], TypeInfoVars,
@@ -1307,7 +1307,7 @@
simplify__make_type_info_vars(TypeArgs,
TypeInfoVars, ExtraGoals),
- { simplify__call_specific_unify(TypeId, TypeInfoVars,
+ { simplify__call_specific_unify(TypeCtor, TypeInfoVars,
XVar, YVar, ProcId, ModuleInfo, Context,
GoalInfo0, Call0, CallGoalInfo0) },
simplify__goal_2(Call0, CallGoalInfo0,
@@ -1348,17 +1348,17 @@
Call = call(PredId, ProcId, ArgVars, BuiltinState, yes(CallContext),
SymName) - GoalInfo.
-:- pred simplify__call_specific_unify(type_id::in, list(prog_var)::in,
+:- pred simplify__call_specific_unify(type_ctor::in, list(prog_var)::in,
prog_var::in, prog_var::in, proc_id::in,
module_info::in, unify_context::in, hlds_goal_info::in,
hlds_goal_expr::out, hlds_goal_info::out) is det.
-simplify__call_specific_unify(TypeId, TypeInfoVars, XVar, YVar, ProcId,
+simplify__call_specific_unify(TypeCtor, TypeInfoVars, XVar, YVar, ProcId,
ModuleInfo, Context, GoalInfo0, CallExpr, CallGoalInfo) :-
% create the new call goal
list__append(TypeInfoVars, [XVar, YVar], ArgVars),
module_info_get_special_pred_map(ModuleInfo, SpecialPredMap),
- map__lookup(SpecialPredMap, unify - TypeId, PredId),
+ map__lookup(SpecialPredMap, unify - TypeCtor, PredId),
SymName = unqualified("__Unify__"),
CallContext = call_unify_context(XVar, var(YVar), Context),
CallExpr = call(PredId, ProcId, ArgVars, not_builtin,
Index: compiler/special_pred.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/special_pred.m,v
retrieving revision 1.27
diff -u -b -r1.27 special_pred.m
--- compiler/special_pred.m 2002/02/26 02:45:53 1.27
+++ compiler/special_pred.m 2002/02/26 02:49:08
@@ -20,7 +20,7 @@
:- type special_pred_map == map(special_pred, pred_id).
-:- type special_pred == pair(special_pred_id, type_id).
+:- type special_pred == pair(special_pred_id, type_ctor).
:- type special_pred_id
---> unify
@@ -65,10 +65,10 @@
% This will succeed for imported types for which the special
% predicates do not need typechecking.
%
-:- pred special_pred_is_generated_lazily(module_info, type_id).
+:- pred special_pred_is_generated_lazily(module_info, type_ctor).
:- mode special_pred_is_generated_lazily(in, in) is semidet.
-:- pred special_pred_is_generated_lazily(module_info, type_id,
+:- pred special_pred_is_generated_lazily(module_info, type_ctor,
hlds_type_body, import_status).
:- mode special_pred_is_generated_lazily(in, in, in, in) is semidet.
@@ -85,7 +85,7 @@
% its special predicates. This will fail for abstract
% types and types for which the RTTI information is
% defined by hand.
-:- pred can_generate_special_pred_clauses_for_type(type_id, hlds_type_body).
+:- pred can_generate_special_pred_clauses_for_type(type_ctor, hlds_type_body).
:- mode can_generate_special_pred_clauses_for_type(in, in) is semidet.
:- implementation.
@@ -146,35 +146,35 @@
special_pred_description(compare, "comparison predicate").
special_pred_description(index, "indexing predicate").
-special_pred_is_generated_lazily(ModuleInfo, TypeId) :-
- classify_type_id(ModuleInfo, TypeId, Class),
+special_pred_is_generated_lazily(ModuleInfo, TypeCtor) :-
+ classify_type_ctor(ModuleInfo, TypeCtor, Class),
(
Class = tuple_type
;
( Class = user_type ; Class = enum_type ),
module_info_types(ModuleInfo, Types),
- map__search(Types, TypeId, TypeDefn),
+ map__search(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, Body),
hlds_data__get_type_defn_status(TypeDefn, Status),
special_pred_is_generated_lazily_2(ModuleInfo,
- TypeId, Body, Status)
+ TypeCtor, Body, Status)
).
-special_pred_is_generated_lazily(ModuleInfo, TypeId, Body, Status) :-
- classify_type_id(ModuleInfo, TypeId, Class),
+special_pred_is_generated_lazily(ModuleInfo, TypeCtor, Body, Status) :-
+ classify_type_ctor(ModuleInfo, TypeCtor, Class),
(
Class = tuple_type
;
( Class = user_type ; Class = enum_type ),
special_pred_is_generated_lazily_2(ModuleInfo,
- TypeId, Body, Status)
+ TypeCtor, Body, Status)
).
:- pred special_pred_is_generated_lazily_2(module_info,
- type_id, hlds_type_body, import_status).
+ type_ctor, hlds_type_body, import_status).
:- mode special_pred_is_generated_lazily_2(in, in, in, in) is semidet.
-special_pred_is_generated_lazily_2(ModuleInfo, _TypeId, Body, Status) :-
+special_pred_is_generated_lazily_2(ModuleInfo, _TypeCtor, Body, Status) :-
(
status_defined_in_this_module(Status, no)
;
@@ -197,8 +197,13 @@
ExistQTVars \= []
).
-can_generate_special_pred_clauses_for_type(TypeId, Body) :-
+can_generate_special_pred_clauses_for_type(TypeCtor, Body) :-
Body \= abstract_type,
+<<<<<<< special_pred.m
+ Body \= uu_type(_),
+ \+ type_ctor_has_hand_defined_rtti(TypeCtor).
+=======
\+ type_id_has_hand_defined_rtti(TypeId).
+>>>>>>> 1.27
%-----------------------------------------------------------------------------%
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/stack_layout.m,v
retrieving revision 1.61
diff -u -b -r1.61 stack_layout.m
--- compiler/stack_layout.m 2002/02/20 03:14:19 1.61
+++ compiler/stack_layout.m 2002/02/25 16:03:48
@@ -1140,40 +1140,40 @@
:- mode stack_layout__represent_live_value_type(in, out, out, in, out) is det.
stack_layout__represent_live_value_type(succip, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "succip", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "succip", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(hp, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "hp", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "hp", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(curfr, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "curfr", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "curfr", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(maxfr, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "maxfr", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "maxfr", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(redofr, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "redofr", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "redofr", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(redoip, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "redoip", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "redoip", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(trail_ptr, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "trail_ptr", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "trail_ptr", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(ticket, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "ticket", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "ticket", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(unwanted, Rval, data_ptr) -->
- { RttiTypeId = rtti_type_id(unqualified(""), "unwanted", 0) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(unqualified(""), "unwanted", 0) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
{ Rval = const(data_addr_const(DataAddr)) }.
stack_layout__represent_live_value_type(var(_, _, Type, _), Rval, LldsType)
-->
Index: compiler/switch_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/switch_util.m,v
retrieving revision 1.6
diff -u -b -r1.6 switch_util.m
--- compiler/switch_util.m 2002/02/20 03:14:21 1.6
+++ compiler/switch_util.m 2002/02/25 16:03:50
@@ -308,13 +308,13 @@
char__min_char_value(MinChar),
char__max_char_value(MaxChar).
switch_util__type_range(enum_type, Type, ModuleInfo, 0, MaxEnum) :-
- ( type_to_type_id(Type, TypeId0, _) ->
- TypeId = TypeId0
+ ( type_to_ctor_and_args(Type, TypeCtorPrime, _) ->
+ TypeCtor = TypeCtorPrime
;
error("dense_switch__type_range: invalid enum type?")
),
module_info_types(ModuleInfo, TypeTable),
- map__lookup(TypeTable, TypeId, TypeDefn),
+ map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
( TypeBody = du_type(_, ConsTable, _, _) ->
map__count(ConsTable, TypeRange),
@@ -329,13 +329,13 @@
% of the given variable.
switch_util__get_ptag_counts(Type, ModuleInfo, MaxPrimary, PtagCountMap) :-
- ( type_to_type_id(Type, TypeIdPrime, _) ->
- TypeId = TypeIdPrime
+ ( type_to_ctor_and_args(Type, TypeCtorPrime, _) ->
+ TypeCtor = TypeCtorPrime
;
error("unknown type in switch_util__get_ptag_counts")
),
module_info_types(ModuleInfo, TypeTable),
- map__lookup(TypeTable, TypeId, TypeDefn),
+ map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, Body),
( Body = du_type(_, ConsTable, _, _) ->
map__to_assoc_list(ConsTable, ConsList),
Index: compiler/table_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/table_gen.m,v
retrieving revision 1.31
diff -u -b -r1.31 table_gen.m
--- compiler/table_gen.m 2002/02/20 03:14:21 1.31
+++ compiler/table_gen.m 2002/02/25 16:03:50
@@ -1124,11 +1124,9 @@
ModuleInfo = TableInfo0 ^ table_module_info,
( TypeCat = enum_type ->
- (
- type_to_type_id(Type, TypeId, _)
- ->
+ ( type_to_ctor_and_args(Type, TypeCtor, _) ->
module_info_types(ModuleInfo, TypeDefnTable),
- map__lookup(TypeDefnTable, TypeId, TypeDefn),
+ map__lookup(TypeDefnTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
(
TypeBody = du_type(Ctors, _, yes, no)
Index: compiler/term_traversal.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_traversal.m,v
retrieving revision 1.17
diff -u -b -r1.17 term_traversal.m
--- compiler/term_traversal.m 2001/04/07 14:04:59 1.17
+++ compiler/term_traversal.m 2002/02/25 16:03:51
@@ -443,9 +443,9 @@
params_get_var_types(Params, VarTypes),
map__lookup(VarTypes, OutVar, Type),
\+ type_is_higher_order(Type, _, _, _),
- ( type_to_type_id(Type, TypeId, _) ->
+ ( type_to_ctor_and_args(Type, TypeCtor, _) ->
params_get_module_info(Params, Module),
- functor_norm(FunctorInfo, TypeId, ConsId, Module,
+ functor_norm(FunctorInfo, TypeCtor, ConsId, Module,
Gamma, Args0, Args, Modes0, Modes),
split_unification_vars(Args, Modes, Module, InVars, OutVars)
;
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.17
diff -u -b -r1.17 term_util.m
--- compiler/term_util.m 2002/02/26 02:45:53 1.17
+++ compiler/term_util.m 2002/02/26 02:49:08
@@ -102,7 +102,7 @@
:- type unify_info == pair(map(prog_var, type), functor_info).
:- type weight_info ---> weight(int, list(bool)).
-:- type weight_table == map(pair(type_id, cons_id), weight_info).
+:- type weight_table == map(pair(type_ctor, cons_id), weight_info).
:- pred find_weights(module_info::in, weight_table::out) is det.
@@ -110,7 +110,7 @@
% of that functor whose sizes should be counted towards the size of the whole
% term.
-:- pred functor_norm(functor_info::in, type_id::in, cons_id::in,
+:- pred functor_norm(functor_info::in, type_ctor::in, cons_id::in,
module_info::in, int::out, list(prog_var)::in, list(prog_var)::out,
list(uni_mode)::in, list(uni_mode)::out) is det.
@@ -238,23 +238,24 @@
map__init(Weights0),
find_weights_for_type_list(TypeList, Weights0, Weights).
-:- pred find_weights_for_type_list(assoc_list(type_id, hlds_type_defn)::in,
+:- pred find_weights_for_type_list(assoc_list(type_ctor, hlds_type_defn)::in,
weight_table::in, weight_table::out) is det.
find_weights_for_type_list([], Weights, Weights).
-find_weights_for_type_list([TypeId - TypeDefn | TypeList], Weights0, Weights) :-
- find_weights_for_type(TypeId, TypeDefn, Weights0, Weights1),
+find_weights_for_type_list([TypeCtor - TypeDefn | TypeList],
+ Weights0, Weights) :-
+ find_weights_for_type(TypeCtor, TypeDefn, Weights0, Weights1),
find_weights_for_type_list(TypeList, Weights1, Weights).
-:- pred find_weights_for_type(type_id::in, hlds_type_defn::in,
+:- pred find_weights_for_type(type_ctor::in, hlds_type_defn::in,
weight_table::in, weight_table::out) is det.
-find_weights_for_type(TypeId, TypeDefn, Weights0, Weights) :-
+find_weights_for_type(TypeCtor, TypeDefn, Weights0, Weights) :-
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
(
TypeBody = du_type(Constructors, _, _, _),
hlds_data__get_type_defn_tparams(TypeDefn, TypeParams),
- find_weights_for_cons_list(Constructors, TypeId, TypeParams,
+ find_weights_for_cons_list(Constructors, TypeCtor, TypeParams,
Weights0, Weights)
;
% This type does not introduce any functors
@@ -272,26 +273,27 @@
).
:- pred find_weights_for_cons_list(list(constructor)::in,
- type_id::in, list(type_param)::in,
+ type_ctor::in, list(type_param)::in,
weight_table::in, weight_table::out) is det.
find_weights_for_cons_list([], _, _, Weights, Weights).
-find_weights_for_cons_list([Constructor | Constructors], TypeId, Params,
+find_weights_for_cons_list([Constructor | Constructors], TypeCtor, Params,
Weights0, Weights) :-
- find_weights_for_cons(Constructor, TypeId, Params, Weights0, Weights1),
- find_weights_for_cons_list(Constructors, TypeId, Params,
+ find_weights_for_cons(Constructor, TypeCtor, Params,
+ Weights0, Weights1),
+ find_weights_for_cons_list(Constructors, TypeCtor, Params,
Weights1, Weights).
:- pred find_weights_for_cons(constructor::in,
- type_id::in, list(type_param)::in,
+ type_ctor::in, list(type_param)::in,
weight_table::in, weight_table::out) is det.
-find_weights_for_cons(Ctor, TypeId, Params, Weights0, Weights) :-
+find_weights_for_cons(Ctor, TypeCtor, Params, Weights0, Weights) :-
% XXX should we do something about ExistQVars here?
Ctor = ctor(_ExistQVars, _Constraints, SymName, Args),
list__length(Args, Arity),
( Arity > 0 ->
- find_and_count_nonrec_args(Args, TypeId, Params,
+ find_and_count_nonrec_args(Args, TypeCtor, Params,
NumNonRec, ArgInfos0),
( NumNonRec = 0 ->
Weight = 1,
@@ -305,7 +307,7 @@
WeightInfo = weight(0, [])
),
ConsId = cons(SymName, Arity),
- map__det_insert(Weights0, TypeId - ConsId, WeightInfo, Weights).
+ map__det_insert(Weights0, TypeCtor - ConsId, WeightInfo, Weights).
:- pred find_weights_for_tuple(arity::in, weight_info::out) is det.
@@ -315,7 +317,7 @@
list__duplicate(Arity, yes, ArgInfos).
:- pred find_and_count_nonrec_args(list(constructor_arg)::in,
- type_id::in, list(type_param)::in,
+ type_ctor::in, list(type_param)::in,
int::out, list(bool)::out) is det.
find_and_count_nonrec_args([], _, _, 0, []).
@@ -330,22 +332,22 @@
).
:- pred is_arg_recursive(constructor_arg::in,
- type_id::in, list(type_param)::in) is semidet.
+ type_ctor::in, list(type_param)::in) is semidet.
-is_arg_recursive(Arg, Id, Params) :-
+is_arg_recursive(Arg, TypeCtor, Params) :-
Arg = _Name - ArgType,
- type_to_type_id(ArgType, ArgTypeId, ArgTypeParams),
- Id = ArgTypeId,
+ type_to_ctor_and_args(ArgType, ArgTypeCtor, ArgTypeParams),
+ TypeCtor = ArgTypeCtor,
list__perm(Params, ArgTypeParams).
-:- pred search_weight_table(weight_table::in, type_id::in, cons_id::in,
+:- pred search_weight_table(weight_table::in, type_ctor::in, cons_id::in,
weight_info::out) is semidet.
-search_weight_table(WeightMap, TypeId, ConsId, WeightInfo) :-
- ( map__search(WeightMap, TypeId - ConsId, WeightInfo0) ->
+search_weight_table(WeightMap, TypeCtor, ConsId, WeightInfo) :-
+ ( map__search(WeightMap, TypeCtor - ConsId, WeightInfo0) ->
WeightInfo = WeightInfo0
- ; type_id_is_tuple(TypeId) ->
- TypeId = _ - Arity,
+ ; type_ctor_is_tuple(TypeCtor) ->
+ TypeCtor = _ - Arity,
find_weights_for_tuple(Arity, WeightInfo)
;
fail
@@ -371,16 +373,16 @@
;
Int = 0
).
-functor_norm(use_map(WeightMap), TypeId, ConsId, _Module, Int,
+functor_norm(use_map(WeightMap), TypeCtor, ConsId, _Module, Int,
Args, Args, Modes, Modes) :-
- ( search_weight_table(WeightMap, TypeId, ConsId, WeightInfo) ->
+ ( search_weight_table(WeightMap, TypeCtor, ConsId, WeightInfo) ->
WeightInfo = weight(Int, _)
;
Int = 0
).
-functor_norm(use_map_and_args(WeightMap), TypeId, ConsId, _Module, Int,
+functor_norm(use_map_and_args(WeightMap), TypeCtor, ConsId, _Module, Int,
Args0, Args, Modes0, Modes) :-
- ( search_weight_table(WeightMap, TypeId, ConsId, WeightInfo) ->
+ ( search_weight_table(WeightMap, TypeCtor, ConsId, WeightInfo) ->
WeightInfo = weight(Int, UseArgList),
(
functor_norm_filter_args(UseArgList, Args0, Args1,
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.21
diff -u -b -r1.21 type_ctor_info.m
--- compiler/type_ctor_info.m 2002/02/26 02:45:54 1.21
+++ compiler/type_ctor_info.m 2002/02/26 02:49:08
@@ -60,9 +60,9 @@
type_ctor_info__generate_hlds(ModuleInfo0, ModuleInfo) :-
module_info_name(ModuleInfo0, ModuleName),
module_info_types(ModuleInfo0, TypeTable),
- map__keys(TypeTable, TypeIds),
- type_ctor_info__gen_type_ctor_gen_infos(TypeIds, TypeTable, ModuleName,
- ModuleInfo0, TypeCtorGenInfos),
+ map__keys(TypeTable, TypeCtors),
+ type_ctor_info__gen_type_ctor_gen_infos(TypeCtors, TypeTable,
+ ModuleName, ModuleInfo0, TypeCtorGenInfos),
module_info_set_type_ctor_gen_infos(ModuleInfo0, TypeCtorGenInfos,
ModuleInfo).
@@ -70,26 +70,26 @@
% find the types defined in this module, and return a type_ctor_gen_info
% for each.
-:- pred type_ctor_info__gen_type_ctor_gen_infos(list(type_id)::in,
+:- pred type_ctor_info__gen_type_ctor_gen_infos(list(type_ctor)::in,
type_table::in, module_name::in, module_info::in,
list(type_ctor_gen_info)::out) is det.
type_ctor_info__gen_type_ctor_gen_infos([], _, _, _, []).
-type_ctor_info__gen_type_ctor_gen_infos([TypeId | TypeIds], TypeTable,
+type_ctor_info__gen_type_ctor_gen_infos([TypeCtor | TypeCtors], TypeTable,
ModuleName, ModuleInfo, TypeCtorGenInfos) :-
- type_ctor_info__gen_type_ctor_gen_infos(TypeIds, TypeTable, ModuleName,
- ModuleInfo, TypeCtorGenInfos1),
- TypeId = SymName - TypeArity,
+ type_ctor_info__gen_type_ctor_gen_infos(TypeCtors, TypeTable,
+ ModuleName, ModuleInfo, TypeCtorGenInfos1),
+ TypeCtor = SymName - TypeArity,
(
SymName = qualified(TypeModuleName, TypeName),
(
TypeModuleName = ModuleName,
- map__lookup(TypeTable, TypeId, TypeDefn),
+ map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody \= abstract_type,
- \+ type_id_has_hand_defined_rtti(TypeId)
+ \+ type_ctor_has_hand_defined_rtti(TypeCtor)
->
- type_ctor_info__gen_type_ctor_gen_info(TypeId,
+ type_ctor_info__gen_type_ctor_gen_info(TypeCtor,
TypeName, TypeArity, TypeDefn,
ModuleName, ModuleInfo, TypeCtorGenInfo),
TypeCtorGenInfos = [TypeCtorGenInfo | TypeCtorGenInfos1]
@@ -103,11 +103,11 @@
error(Msg)
).
-:- pred type_ctor_info__gen_type_ctor_gen_info(type_id::in, string::in,
+:- pred type_ctor_info__gen_type_ctor_gen_info(type_ctor::in, string::in,
int::in, hlds_type_defn::in, module_name::in, module_info::in,
type_ctor_gen_info::out) is det.
-type_ctor_info__gen_type_ctor_gen_info(TypeId, TypeName, TypeArity, TypeDefn,
+type_ctor_info__gen_type_ctor_gen_info(TypeCtor, TypeName, TypeArity, TypeDefn,
ModuleName, ModuleInfo, TypeCtorGenInfo) :-
hlds_data__get_type_defn_status(TypeDefn, Status),
module_info_globals(ModuleInfo, Globals),
@@ -122,12 +122,12 @@
Body = du_type(_, _, _, yes(_UserDefinedEquality))
)
->
- map__lookup(SpecMap, unify - TypeId, UnifyPredId),
+ map__lookup(SpecMap, unify - TypeCtor, UnifyPredId),
special_pred_mode_num(unify, UnifyProcInt),
proc_id_to_int(UnifyProcId, UnifyProcInt),
MaybeUnify = yes(proc(UnifyPredId, UnifyProcId)),
- map__lookup(SpecMap, compare - TypeId, ComparePredId),
+ map__lookup(SpecMap, compare - TypeCtor, ComparePredId),
special_pred_mode_num(compare, CompareProcInt),
proc_id_to_int(CompareProcId, CompareProcInt),
MaybeCompare = yes(proc(ComparePredId, CompareProcId))
@@ -135,7 +135,7 @@
MaybeUnify = no,
MaybeCompare = no
),
- TypeCtorGenInfo = type_ctor_gen_info(TypeId, ModuleName, TypeName,
+ TypeCtorGenInfo = type_ctor_gen_info(TypeCtor, ModuleName, TypeName,
TypeArity, Status, TypeDefn, MaybeUnify, MaybeCompare).
%---------------------------------------------------------------------------%
@@ -172,7 +172,7 @@
type_ctor_info__construct_type_ctor_info(TypeCtorGenInfo,
ModuleInfo, TypeCtorData, TypeCtorTables) :-
- TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName, TypeName,
+ TypeCtorGenInfo = type_ctor_gen_info(_TypeCtor, ModuleName, TypeName,
TypeArity, _Status, HldsDefn, MaybeUnify, MaybeCompare),
type_ctor_info__make_proc_label(MaybeUnify, ModuleInfo, Unify),
type_ctor_info__make_proc_label(MaybeCompare, ModuleInfo, Compare),
@@ -196,8 +196,8 @@
TypeCtorTables = []
),
Version = type_ctor_info_rtti_version,
- RttiTypeId = rtti_type_id(ModuleName, TypeName, TypeArity),
- TypeCtorData = type_ctor_info(RttiTypeId, Unify, Compare,
+ RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, TypeArity),
+ TypeCtorData = type_ctor_info(RttiTypeCtor, Unify, Compare,
TypeCtorRep, Version, NumPtags, NumFunctors,
MaybeFunctors, MaybeLayout).
@@ -288,12 +288,12 @@
),
list__length(Ctors, NumFunctors),
globals__lookup_bool_option(Globals, reserve_tag, ReserveTag),
- RttiTypeId = rtti_type_id(ModuleName, TypeName, TypeArity),
+ RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, TypeArity),
(
Enum = yes,
TypeCtorRep = enum(EqualityAxioms),
type_ctor_info__make_enum_tables(Ctors, ConsTagMap,
- RttiTypeId, ReserveTag, TypeTables,
+ RttiTypeCtor, ReserveTag, TypeTables,
FunctorsInfo, LayoutInfo),
NumPtags = -1
;
@@ -309,7 +309,7 @@
),
TypeCtorRep = notag(EqualityAxioms, Inst),
type_ctor_info__make_notag_tables(Name,
- ArgType, MaybeArgName, RttiTypeId,
+ ArgType, MaybeArgName, RttiTypeCtor,
TypeTables, FunctorsInfo, LayoutInfo),
NumPtags = -1
;
@@ -318,7 +318,7 @@
int__pow(2, NumTagBits, NumTags),
MaxPtag = NumTags - 1,
type_ctor_info__make_du_tables(Ctors,
- ConsTagMap, MaxPtag, RttiTypeId,
+ ConsTagMap, MaxPtag, RttiTypeCtor,
EqualityAxioms, ModuleInfo,
TypeTables, NumPtags,
FunctorsInfo, LayoutInfo, TypeCtorRep)
@@ -367,19 +367,19 @@
% Make the functor and layout tables for a notag type.
:- pred type_ctor_info__make_notag_tables(sym_name::in, (type)::in,
- maybe(string)::in, rtti_type_id::in, list(rtti_data)::out,
+ maybe(string)::in, rtti_type_ctor::in, list(rtti_data)::out,
type_ctor_functors_info::out, type_ctor_layout_info::out) is det.
-type_ctor_info__make_notag_tables(SymName, ArgType, MaybeArgName, RttiTypeId,
+type_ctor_info__make_notag_tables(SymName, ArgType, MaybeArgName, RttiTypeCtor,
TypeTables, FunctorsInfo, LayoutInfo) :-
unqualify_name(SymName, FunctorName),
- RttiTypeId = rtti_type_id(_, _, UnivTvars),
+ RttiTypeCtor = rtti_type_ctor(_, _, UnivTvars),
% There can be no existentially typed args to the functor
% in a notag type.
ExistTvars = [],
make_pseudo_type_info_and_tables(ArgType, UnivTvars, ExistTvars,
RttiData, [], Tables0),
- FunctorDesc = notag_functor_desc(RttiTypeId, FunctorName, RttiData,
+ FunctorDesc = notag_functor_desc(RttiTypeCtor, FunctorName, RttiData,
MaybeArgName),
FunctorRttiName = notag_functor_desc,
@@ -395,10 +395,10 @@
% Make the functor and layout tables for an enum type.
:- pred type_ctor_info__make_enum_tables(list(constructor)::in,
- cons_tag_values::in, rtti_type_id::in, bool::in, list(rtti_data)::out,
+ cons_tag_values::in, rtti_type_ctor::in, bool::in, list(rtti_data)::out,
type_ctor_functors_info::out, type_ctor_layout_info::out) is det.
-type_ctor_info__make_enum_tables(Ctors, ConsTagMap, RttiTypeId, ReserveTag,
+type_ctor_info__make_enum_tables(Ctors, ConsTagMap, RttiTypeCtor, ReserveTag,
TypeTables, FunctorInfo, LayoutInfo) :-
(
% If there are any existentially quantified type variables,
@@ -413,16 +413,16 @@
InitTag = 0
),
type_ctor_info__make_enum_functor_tables(Ctors, InitTag, ConsTagMap,
- RttiTypeId, FunctorDescs, OrdinalOrderRttiNames, SortInfo0),
+ RttiTypeCtor, FunctorDescs, OrdinalOrderRttiNames, SortInfo0),
list__sort(SortInfo0, SortInfo),
assoc_list__values(SortInfo, NameOrderedRttiNames),
- NameOrderedTable = enum_name_ordered_table(RttiTypeId,
+ NameOrderedTable = enum_name_ordered_table(RttiTypeCtor,
NameOrderedRttiNames),
NameOrderedTableRttiName = enum_name_ordered_table,
FunctorInfo = enum_functors(NameOrderedTableRttiName),
- ValueOrderedTable = enum_value_ordered_table(RttiTypeId,
+ ValueOrderedTable = enum_value_ordered_table(RttiTypeCtor,
OrdinalOrderRttiNames),
ValueOrderedTableRttiName = enum_value_ordered_table,
LayoutInfo = enum_layout(ValueOrderedTableRttiName),
@@ -438,13 +438,13 @@
% is constructed.
:- pred type_ctor_info__make_enum_functor_tables(list(constructor)::in,
- int::in, cons_tag_values::in, rtti_type_id::in,
+ int::in, cons_tag_values::in, rtti_type_ctor::in,
list(rtti_data)::out, list(rtti_name)::out,
name_sort_info::out) is det.
type_ctor_info__make_enum_functor_tables([], _, _, _, [], [], []).
type_ctor_info__make_enum_functor_tables([Functor | Functors], NextOrdinal0,
- ConsTagMap, RttiTypeId,
+ ConsTagMap, RttiTypeCtor,
FunctorDescs, RttiNames, SortInfo) :-
Functor = ctor(ExistTvars, Constraints, SymName, FunctorArgs),
require(unify(ExistTvars, []),
@@ -459,11 +459,13 @@
require(unify(ConsTag, int_constant(NextOrdinal0)),
"mismatch on constant assigned to functor in enum"),
unqualify_name(SymName, FunctorName),
- FunctorDesc = enum_functor_desc(RttiTypeId, FunctorName, NextOrdinal0),
+ FunctorDesc =
+ enum_functor_desc(RttiTypeCtor, FunctorName, NextOrdinal0),
RttiName = enum_functor_desc(NextOrdinal0),
FunctorSortInfo = (FunctorName - 0) - RttiName,
type_ctor_info__make_enum_functor_tables(Functors, NextOrdinal0 + 1,
- ConsTagMap, RttiTypeId, FunctorDescs1, RttiNames1, SortInfo1),
+ ConsTagMap, RttiTypeCtor, FunctorDescs1, RttiNames1,
+ SortInfo1),
FunctorDescs = [FunctorDesc | FunctorDescs1],
RttiNames = [RttiName | RttiNames1],
SortInfo = [FunctorSortInfo | SortInfo1].
@@ -480,12 +482,12 @@
% (including reserved_addr types).
:- pred type_ctor_info__make_du_tables(list(constructor)::in,
- cons_tag_values::in, int::in, rtti_type_id::in, equality_axioms::in,
+ cons_tag_values::in, int::in, rtti_type_ctor::in, equality_axioms::in,
module_info::in, list(rtti_data)::out, int::out,
type_ctor_functors_info::out, type_ctor_layout_info::out,
type_ctor_rep::out) is det.
-type_ctor_info__make_du_tables(Ctors, ConsTagMap, MaxPtag, RttiTypeId,
+type_ctor_info__make_du_tables(Ctors, ConsTagMap, MaxPtag, RttiTypeCtor,
EqualityAxioms, ModuleInfo, TypeTables, NumPtags,
FunctorInfo, LayoutInfo, TypeCtorRep) :-
module_info_globals(ModuleInfo, Globals),
@@ -499,19 +501,19 @@
map__init(TagMap0),
map__init(ReservedAddrMap0),
type_ctor_info__make_du_functor_tables(Ctors, InitTag, ConsTagMap,
- RttiTypeId, ModuleInfo,
+ RttiTypeCtor, ModuleInfo,
FunctorDescs, SortInfo0, TagMap0, TagMap,
ReservedAddrMap0, ReservedAddrMap),
list__sort(SortInfo0, SortInfo),
assoc_list__values(SortInfo, NameOrderedRttiNames),
- NameOrderedTable = du_name_ordered_table(RttiTypeId,
+ NameOrderedTable = du_name_ordered_table(RttiTypeCtor,
NameOrderedRttiNames),
NameOrderedTableRttiName = du_name_ordered_table,
FunctorInfo = du_functors(NameOrderedTableRttiName),
type_ctor_info__make_du_ptag_ordered_table(TagMap, InitTag, MaxPtag,
- RttiTypeId, ValueOrderedTableRttiName, ValueOrderedTables,
+ RttiTypeCtor, ValueOrderedTableRttiName, ValueOrderedTables,
NumPtags),
DuLayoutInfo = du_layout(ValueOrderedTableRttiName),
list__append([NameOrderedTable | FunctorDescs], ValueOrderedTables,
@@ -521,7 +523,7 @@
LayoutInfo = DuLayoutInfo,
TypeCtorRep = du(EqualityAxioms)
;
- type_ctor_info__make_reserved_addr_layout(RttiTypeId,
+ type_ctor_info__make_reserved_addr_layout(RttiTypeCtor,
ReservedAddrMap, ValueOrderedTableRttiName,
RALayoutRttiName, RALayoutTables),
% XXX does it matter what order they go in?
@@ -530,11 +532,11 @@
TypeCtorRep = reserved_addr(EqualityAxioms)
).
-:- pred type_ctor_info__make_reserved_addr_layout(rtti_type_id::in,
+:- pred type_ctor_info__make_reserved_addr_layout(rtti_type_ctor::in,
reserved_addr_map::in, rtti_name::in,
rtti_name::out, list(rtti_data)::out) is det.
-type_ctor_info__make_reserved_addr_layout(RttiTypeId, ReservedAddrMap,
+type_ctor_info__make_reserved_addr_layout(RttiTypeCtor, ReservedAddrMap,
DuTableRttiName, RALayoutRttiName, RALayoutTables) :-
%
% split the reserved addresses into numeric addresses (including null)
@@ -550,22 +552,22 @@
% fill in the tables pointed to by the reserved_addr_table
%
SymbolicAddrList = assoc_list__keys(SymbolicAddrAssocList),
- SymbolicAddrTable = reserved_addrs(RttiTypeId, SymbolicAddrList),
+ SymbolicAddrTable = reserved_addrs(RttiTypeCtor, SymbolicAddrList),
ReservedAddrFunctorDescTables =
assoc_list__values(ReservedAddrAssocList),
ReservedAddrFunctorDescs = list__map(
(func(RAFD) = Name :-
- rtti_data_to_name(RAFD, _RttiTypeId, Name)),
+ rtti_data_to_name(RAFD, _RttiTypeCtor, Name)),
ReservedAddrFunctorDescTables),
ReservedAddrFunctorTable = reserved_addr_functors(
- RttiTypeId, ReservedAddrFunctorDescs),
+ RttiTypeCtor, ReservedAddrFunctorDescs),
%
% fill in the reserved_addr_table,
% which describes the representation of this type
%
NumNumericReservedAddrs = list__length(NumericAddrAssocList),
NumSymbolicReservedAddrs = list__length(SymbolicAddrAssocList),
- RALayoutTable = reserved_addr_table(RttiTypeId,
+ RALayoutTable = reserved_addr_table(RttiTypeCtor,
NumNumericReservedAddrs,
NumSymbolicReservedAddrs,
reserved_addrs,
@@ -594,7 +596,7 @@
).
:- pred type_ctor_info__make_du_functor_tables(list(constructor)::in,
- int::in, cons_tag_values::in, rtti_type_id::in, module_info::in,
+ int::in, cons_tag_values::in, rtti_type_ctor::in, module_info::in,
list(rtti_data)::out, name_sort_info::out,
tag_map::in, tag_map::out,
reserved_addr_map::in, reserved_addr_map::out) is det.
@@ -602,7 +604,7 @@
type_ctor_info__make_du_functor_tables([], _, _, _, _,
[], [], TagMap, TagMap, RAMap, RAMap).
type_ctor_info__make_du_functor_tables([Functor | Functors], Ordinal,
- ConsTagMap, RttiTypeId, ModuleInfo,
+ ConsTagMap, RttiTypeCtor, ModuleInfo,
Tables, SortInfo, TagMap0, TagMap, RAMap0, RAMap) :-
Functor = ctor(ExistTvars, Constraints, SymName, FunctorArgs),
list__length(FunctorArgs, Arity),
@@ -617,7 +619,7 @@
RAMap1 = RAMap0
;
ConsRep = reserved_address(RA),
- RAFunctorDesc = reserved_addr_functor_desc(RttiTypeId,
+ RAFunctorDesc = reserved_addr_functor_desc(RttiTypeCtor,
FunctorName, Ordinal, RA),
RAMap1 = map__det_insert(RAMap0, RA, RAFunctorDesc),
% These three fields are not really used for
@@ -628,7 +630,7 @@
Locn = sectag_none
),
type_ctor_info__generate_arg_info_tables(ModuleInfo,
- RttiTypeId, Ordinal, FunctorArgs, ExistTvars,
+ RttiTypeCtor, Ordinal, FunctorArgs, ExistTvars,
MaybeArgNames,
ArgPseudoTypeInfoVector, FieldTables, ContainsVarBitVector),
( ExistTvars = [] ->
@@ -637,17 +639,17 @@
;
module_info_classes(ModuleInfo, ClassTable),
type_ctor_info__generate_type_info_locns(ExistTvars,
- Constraints, ClassTable, RttiTypeId, Ordinal,
+ Constraints, ClassTable, RttiTypeCtor, Ordinal,
ExistInfo, ExistTables),
MaybeExistInfo = yes(ExistInfo)
),
list__append(FieldTables, ExistTables, SubTables),
- FunctorDesc = du_functor_desc(RttiTypeId, FunctorName, Ptag, Stag,
+ FunctorDesc = du_functor_desc(RttiTypeCtor, FunctorName, Ptag, Stag,
Locn, Ordinal, Arity, ContainsVarBitVector,
ArgPseudoTypeInfoVector, MaybeArgNames, MaybeExistInfo),
FunctorSortInfo = (FunctorName - Arity) - RttiName,
type_ctor_info__make_du_functor_tables(Functors, Ordinal + 1,
- ConsTagMap, RttiTypeId, ModuleInfo,
+ ConsTagMap, RttiTypeCtor, ModuleInfo,
Tables1, SortInfo1, TagMap1, TagMap, RAMap1, RAMap),
list__append([FunctorDesc | SubTables], Tables1, Tables),
SortInfo = [FunctorSortInfo | SortInfo1].
@@ -697,15 +699,15 @@
% Generate the tables that describe the arguments of a functor.
:- pred type_ctor_info__generate_arg_info_tables(module_info::in,
- rtti_type_id::in, int::in, list(constructor_arg)::in, existq_tvars::in,
- maybe(rtti_name)::out, maybe(rtti_name)::out, list(rtti_data)::out,
- int::out) is det.
+ rtti_type_ctor::in, int::in, list(constructor_arg)::in,
+ existq_tvars::in, maybe(rtti_name)::out, maybe(rtti_name)::out,
+ list(rtti_data)::out, int::out) is det.
type_ctor_info__generate_arg_info_tables(
- ModuleInfo, RttiTypeId, Ordinal, Args, ExistTvars,
+ ModuleInfo, RttiTypeCtor, Ordinal, Args, ExistTvars,
MaybeFieldNamesRttiName, MaybeFieldTypesRttiName, Tables,
ContainsVarBitVector) :-
- RttiTypeId = rtti_type_id(_TypeModule, _TypeName, TypeArity),
+ RttiTypeCtor = rtti_type_ctor(_TypeModule, _TypeName, TypeArity),
type_ctor_info__generate_arg_infos(Args, TypeArity, ExistTvars,
ModuleInfo, MaybeArgNames, PseudoTypeInfos,
0, 0, ContainsVarBitVector, [], Tables0),
@@ -715,7 +717,7 @@
Tables1 = Tables0
;
PseudoTypeInfos = [_|_],
- FieldTypesTable = field_types(RttiTypeId, Ordinal,
+ FieldTypesTable = field_types(RttiTypeCtor, Ordinal,
PseudoTypeInfos),
FieldTypesRttiName = field_types(Ordinal),
MaybeFieldTypesRttiName = yes(FieldTypesRttiName),
@@ -729,7 +731,7 @@
Tables = Tables1
;
FieldNames = [_|_],
- FieldNameTable = field_names(RttiTypeId, Ordinal,
+ FieldNameTable = field_names(RttiTypeCtor, Ordinal,
MaybeArgNames),
FieldNamesRttiName = field_names(Ordinal),
MaybeFieldNamesRttiName = yes(FieldNamesRttiName),
@@ -794,11 +796,11 @@
% of a functor.
:- pred type_ctor_info__generate_type_info_locns(list(tvar)::in,
- list(class_constraint)::in, class_table::in, rtti_type_id::in, int::in,
- rtti_name::out, list(rtti_data)::out) is det.
+ list(class_constraint)::in, class_table::in, rtti_type_ctor::in,
+ int::in, rtti_name::out, list(rtti_data)::out) is det.
type_ctor_info__generate_type_info_locns(ExistTvars, Constraints, ClassTable,
- RttiTypeId, Ordinal, exist_info(Ordinal),
+ RttiTypeCtor, Ordinal, exist_info(Ordinal),
[ExistInfo, ExistLocns]) :-
list__map((pred(C::in, Ts::out) is det :- C = constraint(_, Ts)),
Constraints, ConstrainedTvars0),
@@ -819,12 +821,12 @@
find_type_info_index(Constraints, ClassTable, TIsPlain),
ConstrainedTvars, LocnMap1, LocnMap),
list__length(Constraints, TCIs),
- ExistInfo = exist_info(RttiTypeId, Ordinal,
+ ExistInfo = exist_info(RttiTypeCtor, Ordinal,
TIsPlain, TIsInTCIs, TCIs, exist_locns(Ordinal)),
list__map((pred(Tvar::in, Locn::out) is det :-
map__lookup(LocnMap, Tvar, Locn)),
ExistTvars, Locns),
- ExistLocns = exist_locns(RttiTypeId, Ordinal, Locns).
+ ExistLocns = exist_locns(RttiTypeCtor, Ordinal, Locns).
:- pred find_type_info_index(list(class_constraint)::in, class_table::in,
int::in, tvar::in, map(tvar, exist_typeinfo_locn)::in,
@@ -885,25 +887,25 @@
).
:- pred type_ctor_info__make_du_ptag_ordered_table(tag_map::in,
- int::in, int::in, rtti_type_id::in,
+ int::in, int::in, rtti_type_ctor::in,
rtti_name::out, list(rtti_data)::out, int::out) is det.
type_ctor_info__make_du_ptag_ordered_table(TagMap, MinPtagValue, MaxPtagValue,
- RttiTypeId, PtagOrderedRttiName, Tables, NumPtags) :-
+ RttiTypeCtor, PtagOrderedRttiName, Tables, NumPtags) :-
map__to_assoc_list(TagMap, TagList),
type_ctor_info__make_du_ptag_layouts(TagList,
- MinPtagValue, MaxPtagValue, RttiTypeId,
+ MinPtagValue, MaxPtagValue, RttiTypeCtor,
PtagLayouts, SubTables, NumPtags),
- PtagOrderedTable = du_ptag_ordered_table(RttiTypeId, PtagLayouts),
+ PtagOrderedTable = du_ptag_ordered_table(RttiTypeCtor, PtagLayouts),
PtagOrderedRttiName = du_ptag_ordered_table,
Tables = [PtagOrderedTable | SubTables].
:- pred type_ctor_info__make_du_ptag_layouts(tag_list::in, int::in, int::in,
- rtti_type_id::in, list(du_ptag_layout)::out, list(rtti_data)::out,
+ rtti_type_ctor::in, list(du_ptag_layout)::out, list(rtti_data)::out,
int::out) is det.
type_ctor_info__make_du_ptag_layouts(TagList0, CurPtag, MaxPtag,
- RttiTypeId, PtagLayouts, Tables, NumPtags) :-
+ RttiTypeCtor, PtagLayouts, Tables, NumPtags) :-
(
TagList0 = [],
PtagLayouts = [],
@@ -919,13 +921,13 @@
list__length(StagList, StagListLength),
type_ctor_info__make_du_stag_table(0, StagListLength - 1,
StagList, StagRttiNames),
- StagOrderedTable = du_stag_ordered_table(RttiTypeId,
+ StagOrderedTable = du_stag_ordered_table(RttiTypeCtor,
Ptag, StagRttiNames),
StagOrderedAddr = du_stag_ordered_table(Ptag),
PtagLayout = du_ptag_layout(StagListLength, Locn,
StagOrderedAddr),
type_ctor_info__make_du_ptag_layouts(TagList,
- CurPtag + 1, MaxPtag, RttiTypeId,
+ CurPtag + 1, MaxPtag, RttiTypeCtor,
PtagLayouts1, Tables1, NumPtags),
PtagLayouts = [PtagLayout | PtagLayouts1],
Tables = [StagOrderedTable | Tables1]
Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.104
diff -u -b -r1.104 type_util.m
--- compiler/type_util.m 2002/02/05 09:14:45 1.104
+++ compiler/type_util.m 2002/02/25 16:03:53
@@ -30,8 +30,8 @@
:- pred type_is_atomic(type, module_info).
:- mode type_is_atomic(in, in) is semidet.
-:- pred type_id_is_atomic(type_id, module_info).
-:- mode type_id_is_atomic(in, in) is semidet.
+:- pred type_ctor_is_atomic(type_ctor, module_info).
+:- mode type_ctor_is_atomic(in, in) is semidet.
% type_is_higher_order(Type, PredOrFunc, ArgTypes) succeeds iff
% Type is a higher-order predicate or function type with the specified
@@ -47,14 +47,14 @@
:- pred type_is_tuple(type, list(type)).
:- mode type_is_tuple(in, out) is semidet.
- % type_id_is_higher_order(TypeId, PredOrFunc) succeeds iff
- % TypeId is a higher-order predicate or function type.
-:- pred type_id_is_higher_order(type_id, pred_or_func, lambda_eval_method).
-:- mode type_id_is_higher_order(in, out, out) is semidet.
-
- % type_id_is_tuple(TypeId) succeeds iff TypeId is a tuple type.
-:- pred type_id_is_tuple(type_id).
-:- mode type_id_is_tuple(in) is semidet.
+ % type_ctor_is_higher_order(TypeCtor, PredOrFunc) succeeds iff
+ % TypeCtor is a higher-order predicate or function type.
+:- pred type_ctor_is_higher_order(type_ctor, pred_or_func, lambda_eval_method).
+:- mode type_ctor_is_higher_order(in, out, out) is semidet.
+
+ % type_ctor_is_tuple(TypeCtor) succeeds iff TypeCtor is a tuple type.
+:- pred type_ctor_is_tuple(type_ctor).
+:- mode type_ctor_is_tuple(in) is semidet.
% return true iff there was a `where equality is <predname>'
% declaration for the specified type, and return the name of
@@ -79,8 +79,8 @@
:- pred type_is_aditi_state(type).
:- mode type_is_aditi_state(in) is semidet.
-:- pred type_id_is_array(type_id).
-:- mode type_id_is_array(in) is semidet.
+:- pred type_ctor_is_array(type_ctor).
+:- mode type_ctor_is_array(in) is semidet.
% Remove an `aditi:state' from the given list if one is present.
:- pred type_util__remove_aditi_state(list(type), list(T), list(T)).
@@ -91,8 +91,8 @@
% structures describing the types. Since the RTTI will be hand defined,
% the compiler shouldn't generate RTTI for these types.
-:- pred type_id_has_hand_defined_rtti(type_id).
-:- mode type_id_has_hand_defined_rtti(in) is semidet.
+:- pred type_ctor_has_hand_defined_rtti(type_ctor).
+:- mode type_ctor_has_hand_defined_rtti(in) is semidet.
% A test for type_info-related types that are introduced by
% polymorphism.m. Mode inference never infers unique modes
@@ -116,9 +116,9 @@
:- pred classify_type(type, module_info, builtin_type).
:- mode classify_type(in, in, out) is det.
- % Given a type_id, determine what sort of type it is.
-:- pred classify_type_id(module_info, type_id, builtin_type).
-:- mode classify_type_id(in, in, out) is det.
+ % Given a type_ctor, determine what sort of type it is.
+:- pred classify_type_ctor(module_info, type_ctor, builtin_type).
+:- mode classify_type_ctor(in, in, out) is det.
:- type builtin_type ---> int_type
; char_type
@@ -132,8 +132,8 @@
% Given a non-variable type, return its type-id and argument types.
-:- pred type_to_type_id(type, type_id, list(type)).
-:- mode type_to_type_id(in, out, out) is semidet.
+:- pred type_to_ctor_and_args(type, type_ctor, list(type)).
+:- mode type_to_ctor_and_args(in, out, out) is semidet.
% Given a variable type, return its type variable.
@@ -141,10 +141,10 @@
:- mode type_util__var(in, out) is semidet.
:- mode type_util__var(out, in) is det.
- % Given a type_id and a list of argument types,
+ % Given a type_ctor and a list of argument types,
% construct a type.
-:- pred construct_type(type_id, list(type), (type)).
+:- pred construct_type(type_ctor, list(type), (type)).
:- mode construct_type(in, in, out) is det.
:- pred construct_higher_order_type(pred_or_func, lambda_eval_method,
@@ -169,22 +169,22 @@
:- func sample_type_info_type = (type).
:- func sample_typeclass_info_type = (type).
- % Given a constant and an arity, return a type_id.
+ % Given a constant and an arity, return a type_ctor.
% Fails if the constant is not an atom.
-:- pred make_type_id(const, int, type_id).
-:- mode make_type_id(in, in, out) is semidet.
+:- pred make_type_ctor(const, int, type_ctor).
+:- mode make_type_ctor(in, in, out) is semidet.
- % Given a type_id, look up its module/name/arity
+ % Given a type_ctor, look up its module/name/arity
-:- pred type_util__type_id_module(module_info, type_id, module_name).
-:- mode type_util__type_id_module(in, in, out) is det.
+:- pred type_util__type_ctor_module(module_info, type_ctor, module_name).
+:- mode type_util__type_ctor_module(in, in, out) is det.
-:- pred type_util__type_id_name(module_info, type_id, string).
-:- mode type_util__type_id_name(in, in, out) is det.
+:- pred type_util__type_ctor_name(module_info, type_ctor, string).
+:- mode type_util__type_ctor_name(in, in, out) is det.
-:- pred type_util__type_id_arity(module_info, type_id, arity).
-:- mode type_util__type_id_arity(in, in, out) is det.
+:- pred type_util__type_ctor_arity(module_info, type_ctor, arity).
+:- mode type_util__type_ctor_arity(in, in, out) is det.
% If the type is a du type or a tuple type,
% return the list of its constructors.
@@ -236,7 +236,7 @@
% Like type_util__get_type_and_cons_defn (above), except that it
% only returns the definition of the constructor, not the type.
-:- pred type_util__get_cons_defn(module_info::in, type_id::in, cons_id::in,
+:- pred type_util__get_cons_defn(module_info::in, type_ctor::in, cons_id::in,
hlds_cons_defn::out) is semidet.
@@ -481,36 +481,36 @@
:- import_module bool, char, int, string.
:- import_module assoc_list, require, varset.
-type_util__type_id_module(_ModuleInfo, TypeName - _Arity, ModuleName) :-
+type_util__type_ctor_module(_ModuleInfo, TypeName - _Arity, ModuleName) :-
sym_name_get_module_name(TypeName, unqualified(""), ModuleName).
-type_util__type_id_name(_ModuleInfo, Name0 - _Arity, Name) :-
+type_util__type_ctor_name(_ModuleInfo, Name0 - _Arity, Name) :-
unqualify_name(Name0, Name).
-type_util__type_id_arity(_ModuleInfo, _Name - Arity, Arity).
+type_util__type_ctor_arity(_ModuleInfo, _Name - Arity, Arity).
type_is_atomic(Type, ModuleInfo) :-
- type_to_type_id(Type, TypeId, _),
- type_id_is_atomic(TypeId, ModuleInfo).
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ type_ctor_is_atomic(TypeCtor, ModuleInfo).
-type_id_is_atomic(TypeId, ModuleInfo) :-
- classify_type_id(ModuleInfo, TypeId, BuiltinType),
+type_ctor_is_atomic(TypeCtor, ModuleInfo) :-
+ classify_type_ctor(ModuleInfo, TypeCtor, BuiltinType),
BuiltinType \= polymorphic_type,
BuiltinType \= tuple_type,
BuiltinType \= pred_type,
BuiltinType \= user_type.
-type_id_is_array(qualified(unqualified("array"), "array") - 1).
+type_ctor_is_array(qualified(unqualified("array"), "array") - 1).
type_util__var(term__variable(Var), Var).
-type_id_has_hand_defined_rtti(qualified(PB, "type_info") - 1) :-
+type_ctor_has_hand_defined_rtti(qualified(PB, "type_info") - 1) :-
mercury_private_builtin_module(PB).
-type_id_has_hand_defined_rtti(qualified(PB, "type_ctor_info") - 1) :-
+type_ctor_has_hand_defined_rtti(qualified(PB, "type_ctor_info") - 1) :-
mercury_private_builtin_module(PB).
-type_id_has_hand_defined_rtti(qualified(PB, "typeclass_info") - 1) :-
+type_ctor_has_hand_defined_rtti(qualified(PB, "typeclass_info") - 1) :-
mercury_private_builtin_module(PB).
-type_id_has_hand_defined_rtti(qualified(PB, "base_typeclass_info") - 1) :-
+type_ctor_has_hand_defined_rtti(qualified(PB, "base_typeclass_info") - 1) :-
mercury_private_builtin_module(PB).
is_introduced_type_info_type(Type) :-
@@ -533,26 +533,26 @@
% Given a type, determine what sort of type it is.
classify_type(VarType, ModuleInfo, Type) :-
- ( type_to_type_id(VarType, TypeId, _) ->
- classify_type_id(ModuleInfo, TypeId, Type)
+ ( type_to_ctor_and_args(VarType, TypeCtor, _) ->
+ classify_type_ctor(ModuleInfo, TypeCtor, Type)
;
Type = polymorphic_type
).
-classify_type_id(ModuleInfo, TypeId, Type) :-
- ( TypeId = unqualified("character") - 0 ->
+classify_type_ctor(ModuleInfo, TypeCtor, Type) :-
+ ( TypeCtor = unqualified("character") - 0 ->
Type = char_type
- ; TypeId = unqualified("int") - 0 ->
+ ; TypeCtor = unqualified("int") - 0 ->
Type = int_type
- ; TypeId = unqualified("float") - 0 ->
+ ; TypeCtor = unqualified("float") - 0 ->
Type = float_type
- ; TypeId = unqualified("string") - 0 ->
+ ; TypeCtor = unqualified("string") - 0 ->
Type = str_type
- ; type_id_is_higher_order(TypeId, _, _) ->
+ ; type_ctor_is_higher_order(TypeCtor, _, _) ->
Type = pred_type
- ; type_id_is_tuple(TypeId) ->
+ ; type_ctor_is_tuple(TypeCtor) ->
Type = tuple_type
- ; type_id_is_enumeration(TypeId, ModuleInfo) ->
+ ; type_ctor_is_enumeration(TypeCtor, ModuleInfo) ->
Type = enum_type
;
Type = user_type
@@ -574,8 +574,8 @@
).
type_is_tuple(Type, ArgTypes) :-
- type_to_type_id(Type, TypeId, ArgTypes),
- type_id_is_tuple(TypeId).
+ type_to_ctor_and_args(Type, TypeCtor, ArgTypes),
+ type_ctor_is_tuple(TypeCtor).
% From the type of a lambda expression, work out how it should
% be evaluated and extract the argument types.
@@ -599,7 +599,7 @@
)
).
-type_id_is_higher_order(SymName - _Arity, PredOrFunc, EvalMethod) :-
+type_ctor_is_higher_order(SymName - _Arity, PredOrFunc, EvalMethod) :-
(
SymName = qualified(unqualified(EvalMethodStr), PorFStr),
(
@@ -621,12 +621,12 @@
PredOrFunc = function
).
-type_id_is_tuple(unqualified("{}") - _).
+type_ctor_is_tuple(unqualified("{}") - _).
type_has_user_defined_equality_pred(ModuleInfo, Type, SymName) :-
module_info_types(ModuleInfo, TypeTable),
- type_to_type_id(Type, TypeId, _TypeArgs),
- map__search(TypeTable, TypeId, TypeDefn),
+ type_to_ctor_and_args(Type, TypeCtor, _TypeArgs),
+ map__search(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody = du_type(_, _, _, yes(SymName)).
@@ -656,12 +656,12 @@
Ctor = ctor([], [], qualified(unqualified("store"), "store"), [_]).
type_is_io_state(Type) :-
- type_to_type_id(Type,
- qualified(unqualified("io"), "state") - 0, []).
+ type_to_ctor_and_args(Type, TypeCtor, []),
+ TypeCtor = qualified(unqualified("io"), "state") - 0.
type_is_aditi_state(Type) :-
- type_to_type_id(Type,
- qualified(unqualified("aditi"), "state") - 0, []).
+ type_to_ctor_and_args(Type, TypeCtor, []),
+ TypeCtor = qualified(unqualified("aditi"), "state") - 0.
type_util__remove_aditi_state([], [], []).
type_util__remove_aditi_state([], [_|_], _) :-
@@ -676,17 +676,17 @@
Args = [Arg | Args1]
).
-:- pred type_id_is_enumeration(type_id, module_info).
-:- mode type_id_is_enumeration(in, in) is semidet.
+:- pred type_ctor_is_enumeration(type_ctor, module_info).
+:- mode type_ctor_is_enumeration(in, in) is semidet.
-type_id_is_enumeration(TypeId, ModuleInfo) :-
+type_ctor_is_enumeration(TypeCtor, ModuleInfo) :-
module_info_types(ModuleInfo, TypeDefnTable),
- map__search(TypeDefnTable, TypeId, TypeDefn),
+ map__search(TypeDefnTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody = du_type(_, _, IsEnum, _),
IsEnum = yes.
-type_to_type_id(Type, SymName - Arity, Args) :-
+type_to_ctor_and_args(Type, SymName - Arity, Args) :-
Type \= term__variable(_),
% higher order types may have representations where
@@ -725,8 +725,8 @@
% and should only appear as the argument of a
% `typeclass:info/1' type.
% It behaves sort of like a type variable, so according to the
- % specification of `type_to_type_id', it should cause failure.
- % There isn't a definition in the type table.
+ % specification of `type_to_ctor_and_args', it should
+ % cause failure. There isn't a definition in the type table.
\+ (
SymName = qualified(ModuleName, UnqualName),
UnqualName = "constraint",
@@ -736,11 +736,11 @@
list__length(Args, Arity)
).
-construct_type(TypeId, Args, Type) :-
- ( type_id_is_higher_order(TypeId, PredOrFunc, EvalMethod) ->
+construct_type(TypeCtor, Args, Type) :-
+ ( type_ctor_is_higher_order(TypeCtor, PredOrFunc, EvalMethod) ->
construct_higher_order_type(PredOrFunc, EvalMethod, Args, Type)
;
- TypeId = SymName - _,
+ TypeCtor = SymName - _,
construct_qualified_term(SymName, Args, Type)
).
@@ -809,20 +809,20 @@
%-----------------------------------------------------------------------------%
- % Given a constant and an arity, return a type_id.
+ % Given a constant and an arity, return a type_ctor.
% This really ought to take a name and an arity -
% use of integers/floats/strings as type names should
% be rejected by the parser in prog_io.m, not in module_qual.m.
-make_type_id(term__atom(Name), Arity, unqualified(Name) - Arity).
+make_type_ctor(term__atom(Name), Arity, unqualified(Name) - Arity).
%-----------------------------------------------------------------------------%
% If the type is a du type, return the list of its constructors.
type_constructors(Type, ModuleInfo, Constructors) :-
- type_to_type_id(Type, TypeId, TypeArgs),
- ( type_id_is_tuple(TypeId) ->
+ type_to_ctor_and_args(Type, TypeCtor, TypeArgs),
+ ( type_ctor_is_tuple(TypeCtor) ->
% Tuples are never existentially typed.
ExistQVars = [],
ClassConstraints = [],
@@ -831,7 +831,7 @@
unqualified("{}"), CtorArgs)]
;
module_info_types(ModuleInfo, TypeTable),
- map__search(TypeTable, TypeId, TypeDefn),
+ map__search(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_tparams(TypeDefn, TypeParams),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody = du_type(Constructors0, _, _, _),
@@ -842,19 +842,19 @@
%-----------------------------------------------------------------------------%
type_util__switch_type_num_functors(ModuleInfo, Type, NumFunctors) :-
- type_to_type_id(Type, TypeId, _),
- ( TypeId = unqualified("character") - 0 ->
+ type_to_ctor_and_args(Type, TypeCtor, _),
+ ( TypeCtor = unqualified("character") - 0 ->
% XXX the following code uses the source machine's character
% size, not the target's, so it won't work if cross-compiling
% to a machine with a different size character.
char__max_char_value(MaxChar),
char__min_char_value(MinChar),
NumFunctors is MaxChar - MinChar + 1
- ; type_id_is_tuple(TypeId) ->
+ ; type_ctor_is_tuple(TypeCtor) ->
NumFunctors = 1
;
module_info_types(ModuleInfo, TypeTable),
- map__search(TypeTable, TypeId, TypeDefn),
+ map__search(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody = du_type(_, ConsTable, _, _),
map__count(ConsTable, NumFunctors)
@@ -885,16 +885,16 @@
type_util__get_cons_id_arg_types_2(EQVarAction, ModuleInfo, VarType, ConsId,
ArgTypes) :-
(
- type_to_type_id(VarType, TypeId, TypeArgs)
+ type_to_ctor_and_args(VarType, TypeCtor, TypeArgs)
->
(
% The argument types of a tuple cons_id are the
% arguments of the tuple type.
- type_id_is_tuple(TypeId)
+ type_ctor_is_tuple(TypeCtor)
->
ArgTypes = TypeArgs
;
- type_util__do_get_type_and_cons_defn(ModuleInfo, TypeId,
+ type_util__do_get_type_and_cons_defn(ModuleInfo, TypeCtor,
ConsId, TypeDefn, ConsDefn),
ConsDefn = hlds_cons_defn(ExistQVars0, _Constraints0,
Args, _, _),
@@ -927,9 +927,9 @@
).
type_util__cons_id_arg_types(ModuleInfo, VarType, ConsId, ArgTypes) :-
- type_to_type_id(VarType, TypeId, TypeArgs),
+ type_to_ctor_and_args(VarType, TypeCtor, TypeArgs),
module_info_types(ModuleInfo, Types),
- map__search(Types, TypeId, TypeDefn),
+ map__search(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeDefnBody),
TypeDefnBody = du_type(_, ConsTags, _, _),
map__member(ConsTags, ConsId, _),
@@ -938,7 +938,7 @@
map__lookup(Ctors, ConsId, ConsDefns),
list__member(ConsDefn, ConsDefns),
- ConsDefn = hlds_cons_defn(ExistQVars0, _, Args, TypeId, _),
+ ConsDefn = hlds_cons_defn(ExistQVars0, _, Args, TypeCtor, _),
% XXX handle ExistQVars
ExistQVars0 = [],
@@ -958,8 +958,8 @@
(type)::in, cons_id::in, hlds_cons_defn::out) is semidet.
type_util__is_existq_cons(ModuleInfo, VarType, ConsId, ConsDefn) :-
- type_to_type_id(VarType, TypeId, _),
- type_util__get_cons_defn(ModuleInfo, TypeId, ConsId, ConsDefn),
+ type_to_ctor_and_args(VarType, TypeCtor, _),
+ type_util__get_cons_defn(ModuleInfo, TypeCtor, ConsId, ConsDefn),
ConsDefn = hlds_cons_defn(ExistQVars, _, _, _, _),
ExistQVars \= [].
@@ -971,21 +971,21 @@
ConsDefn = hlds_cons_defn(ExistQVars, Constraints, Args, _, _),
assoc_list__values(Args, ArgTypes),
module_info_types(ModuleInfo, Types),
- type_to_type_id(VarType, TypeId, _),
- map__lookup(Types, TypeId, TypeDefn),
+ type_to_ctor_and_args(VarType, TypeCtor, _),
+ map__lookup(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_tvarset(TypeDefn, TypeVarSet),
hlds_data__get_type_defn_tparams(TypeDefn, TypeDefnParams),
- type_to_type_id(VarType, TypeId, _),
- construct_type(TypeId, TypeDefnParams, RetType),
+ type_to_ctor_and_args(VarType, TypeCtor, _),
+ construct_type(TypeCtor, TypeDefnParams, RetType),
CtorDefn = ctor_defn(TypeVarSet, ExistQVars, Constraints,
ArgTypes, RetType).
type_util__get_type_and_cons_defn(ModuleInfo, Type, ConsId,
TypeDefn, ConsDefn) :-
(
- type_to_type_id(Type, TypeId, _),
+ type_to_ctor_and_args(Type, TypeCtor, _),
type_util__do_get_type_and_cons_defn(ModuleInfo,
- TypeId, ConsId, TypeDefn0, ConsDefn0)
+ TypeCtor, ConsId, TypeDefn0, ConsDefn0)
->
TypeDefn = TypeDefn0,
ConsDefn = ConsDefn0
@@ -994,30 +994,30 @@
).
:- pred type_util__do_get_type_and_cons_defn(module_info::in,
- type_id::in, cons_id::in, hlds_type_defn::out,
+ type_ctor::in, cons_id::in, hlds_type_defn::out,
hlds_cons_defn::out) is semidet.
-type_util__do_get_type_and_cons_defn(ModuleInfo, TypeId, ConsId,
+type_util__do_get_type_and_cons_defn(ModuleInfo, TypeCtor, ConsId,
TypeDefn, ConsDefn) :-
- type_util__get_cons_defn(ModuleInfo, TypeId, ConsId, ConsDefn),
+ type_util__get_cons_defn(ModuleInfo, TypeCtor, ConsId, ConsDefn),
module_info_types(ModuleInfo, Types),
- map__lookup(Types, TypeId, TypeDefn).
+ map__lookup(Types, TypeCtor, TypeDefn).
-type_util__get_cons_defn(ModuleInfo, TypeId, ConsId, ConsDefn) :-
+type_util__get_cons_defn(ModuleInfo, TypeCtor, ConsId, ConsDefn) :-
module_info_ctors(ModuleInfo, Ctors),
% will fail for builtin cons_ids.
map__search(Ctors, ConsId, ConsDefns),
MatchingCons = lambda([ThisConsDefn::in] is semidet, (
- ThisConsDefn = hlds_cons_defn(_, _, _, TypeId, _)
+ ThisConsDefn = hlds_cons_defn(_, _, _, TypeCtor, _)
)),
list__filter(MatchingCons, ConsDefns, [ConsDefn]).
%-----------------------------------------------------------------------------%
type_is_no_tag_type(ModuleInfo, Type, Ctor, ArgType) :-
- type_to_type_id(Type, TypeId, TypeArgs),
+ type_to_ctor_and_args(Type, TypeCtor, TypeArgs),
module_info_no_tag_types(ModuleInfo, NoTagTypes),
- map__search(NoTagTypes, TypeId, NoTagType),
+ map__search(NoTagTypes, TypeCtor, NoTagType),
NoTagType = no_tag_type(TypeParams0, Ctor, ArgType0),
( TypeParams0 = [] ->
ArgType = ArgType0
@@ -1347,8 +1347,8 @@
% XXX magically_obtain(TypeTable)
- make_type_id(Functor, Arity, TypeId),
- map__search(TypeTable, TypeId, TypeDefn),
+ make_type_ctor(Functor, Arity, TypeCtor),
+ map__search(TypeTable, TypeCtor, TypeDefn),
get_type_defn_body(TypeDefn, TypeBody),
TypeBody = eqv_type(EqvType0),
get_type_defn_tparams(TypeDefn, TypeParams0),
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.311
diff -u -b -r1.311 typecheck.m
--- compiler/typecheck.m 2002/02/22 01:20:55 1.311
+++ compiler/typecheck.m 2002/02/25 16:03:53
@@ -775,9 +775,9 @@
%
pred_info_arg_types(PredInfo, ArgTypes),
special_pred_get_type(PredName, ArgTypes, Type),
- type_to_type_id(Type, TypeId, _TypeArgs),
+ type_to_ctor_and_args(Type, TypeCtor, _TypeArgs),
module_info_types(ModuleInfo, TypeTable),
- map__lookup(TypeTable, TypeId, TypeDefn),
+ map__lookup(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, Body),
special_pred_for_type_needs_typecheck(Body).
@@ -2900,8 +2900,8 @@
get_field_access_constructor(TypeCheckInfo, FuncName, Arity, _AccessType,
FieldDefn, FunctorConsTypeInfo) :-
- FieldDefn = hlds_ctor_field_defn(_, _, TypeId, ConsId, _),
- TypeId = qualified(TypeModule, _) - _,
+ FieldDefn = hlds_ctor_field_defn(_, _, TypeCtor, ConsId, _),
+ TypeCtor = qualified(TypeModule, _) - _,
%
% If the user has supplied a declaration, we use that instead
@@ -2924,7 +2924,7 @@
map__lookup(Ctors, ConsId, ConsDefns0),
list__filter(
(pred(CtorDefn::in) is semidet :-
- CtorDefn = hlds_cons_defn(_, _, _, TypeId, _)
+ CtorDefn = hlds_cons_defn(_, _, _, TypeCtor, _)
), ConsDefns0, ConsDefns),
ConsDefns = [ConsDefn],
convert_cons_defn(TypeCheckInfo, ConsDefn, FunctorConsTypeInfo).
@@ -4397,13 +4397,13 @@
convert_cons_defn(TypeCheckInfo, HLDS_ConsDefn, ConsTypeInfo) :-
HLDS_ConsDefn = hlds_cons_defn(ExistQVars, ExistConstraints, Args,
- TypeId, _),
+ TypeCtor, _),
assoc_list__values(Args, ArgTypes),
typecheck_info_get_types(TypeCheckInfo, Types),
- map__lookup(Types, TypeId, TypeDefn),
+ map__lookup(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_tvarset(TypeDefn, ConsTypeVarSet),
hlds_data__get_type_defn_tparams(TypeDefn, ConsTypeParams),
- construct_type(TypeId, ConsTypeParams, ConsType),
+ construct_type(TypeCtor, ConsTypeParams, ConsType),
UnivConstraints = [],
Constraints = constraints(UnivConstraints, ExistConstraints),
ConsTypeInfo = cons_type_info(ConsTypeVarSet, ExistQVars,
@@ -6103,10 +6103,10 @@
strip_builtin_qualifiers_from_type(Type0, Type) :-
(
- type_to_type_id(Type0, TypeId0, Args0)
+ type_to_ctor_and_args(Type0, TypeCtor0, Args0)
->
strip_builtin_qualifiers_from_type_list(Args0, Args),
- TypeId0 = SymName0 - Arity,
+ TypeCtor0 = SymName0 - Arity,
(
SymName0 = qualified(Module, Name),
mercury_public_builtin_module(Module)
Index: compiler/unify_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.118
diff -u -b -r1.118 unify_gen.m
--- compiler/unify_gen.m 2002/02/20 03:14:22 1.118
+++ compiler/unify_gen.m 2002/02/25 16:03:54
@@ -387,8 +387,8 @@
;
{ error("unify_gen: type-info constant has args") }
),
- { RttiTypeId = rtti_type_id(ModuleName, TypeName, TypeArity) },
- { DataAddr = rtti_addr(RttiTypeId, type_ctor_info) },
+ { RttiTypeCtor = rtti_type_ctor(ModuleName, TypeName, TypeArity) },
+ { DataAddr = rtti_addr(RttiTypeCtor, type_ctor_info) },
code_info__assign_const_to_var(Var, const(data_addr_const(DataAddr))).
unify_gen__generate_construction_2(base_typeclass_info_constant(ModuleName,
ClassId, Instance), Var, Args, _Modes, _, _, empty) -->
@@ -1006,8 +1006,8 @@
:- pred unify_gen__var_type_msg((type)::in, string::out) is det.
unify_gen__var_type_msg(Type, Msg) :-
- ( type_to_type_id(Type, TypeId, _) ->
- TypeId = TypeSym - TypeArity,
+ ( type_to_ctor_and_args(Type, TypeCtor, _) ->
+ TypeCtor = TypeSym - TypeArity,
prog_out__sym_name_to_string(TypeSym, TypeSymStr),
string__int_to_string(TypeArity, TypeArityStr),
string__append_list([TypeSymStr, "/", TypeArityStr], Msg)
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.104
diff -u -b -r1.104 unify_proc.m
--- compiler/unify_proc.m 2002/02/26 02:45:54 1.104
+++ compiler/unify_proc.m 2002/02/26 02:49:09
@@ -52,7 +52,7 @@
:- type proc_requests.
-:- type unify_proc_id == pair(type_id, uni_mode).
+:- type unify_proc_id == pair(type_ctor, uni_mode).
% Initialize the proc_requests table.
@@ -73,7 +73,7 @@
maybe(list(is_live))::in, maybe(determinism)::in, prog_context::in,
module_info::in, proc_id::out, module_info::out) is det.
-% unify_proc__add_lazily_generated_unify_pred(TypeId,
+% unify_proc__add_lazily_generated_unify_pred(TypeCtor,
% UnifyPredId_for_Type, ModuleInfo0, ModuleInfo).
%
% For most imported unification procedures, we delay
@@ -82,14 +82,14 @@
% is a complicated unification involving the type.
% This predicate is exported for use by higher_order.m
% when it is specializing calls to unify/2.
-:- pred unify_proc__add_lazily_generated_unify_pred(type_id::in,
+:- pred unify_proc__add_lazily_generated_unify_pred(type_ctor::in,
pred_id::out, module_info::in, module_info::out) is det.
- % unify_proc__add_lazily_generated_compare_pred_decl(TypeId,
+ % unify_proc__add_lazily_generated_compare_pred_decl(TypeCtor,
% ComparePredId_for_Type, ModuleInfo0, ModuleInfo).
%
% Add declarations, but not clauses, for a compare or index predicate.
-:- pred unify_proc__add_lazily_generated_compare_pred_decl(type_id::in,
+:- pred unify_proc__add_lazily_generated_compare_pred_decl(type_ctor::in,
pred_id::out, module_info::in, module_info::out) is det.
% Do mode analysis of the queued procedures.
@@ -107,8 +107,8 @@
% Given the type and mode of a unification, look up the
% mode number for the unification proc.
-:- pred unify_proc__lookup_mode_num(module_info::in, type_id::in, uni_mode::in,
- determinism::in, proc_id::out) is det.
+:- pred unify_proc__lookup_mode_num(module_info::in, type_ctor::in,
+ uni_mode::in, determinism::in, proc_id::out) is det.
% Generate the clauses for one of the compiler-generated
% special predicates (compare/3, index/3, unify, etc.)
@@ -188,16 +188,15 @@
%-----------------------------------------------------------------------------%
-unify_proc__lookup_mode_num(ModuleInfo, TypeId, UniMode, Det, Num) :-
- ( unify_proc__search_mode_num(ModuleInfo, TypeId, UniMode, Det, Num1) ->
+unify_proc__lookup_mode_num(ModuleInfo, TypeCtor, UniMode, Det, Num) :-
+ ( unify_proc__search_mode_num(ModuleInfo, TypeCtor, UniMode, Det, Num1) ->
Num = Num1
;
error("unify_proc.m: unify_proc__search_num failed")
).
-:- pred unify_proc__search_mode_num(module_info, type_id, uni_mode, determinism,
- proc_id).
-:- mode unify_proc__search_mode_num(in, in, in, in, out) is semidet.
+:- pred unify_proc__search_mode_num(module_info::in, type_ctor::in,
+ uni_mode::in, determinism::in, proc_id::out) is semidet.
% Given the type, mode, and determinism of a unification, look up the
% mode number for the unification proc.
@@ -207,7 +206,8 @@
% we assume that `ground' and `any' have the same representation.)
% For unreachable unifications, we also use mode zero.
-unify_proc__search_mode_num(ModuleInfo, TypeId, UniMode, Determinism, ProcId) :-
+unify_proc__search_mode_num(ModuleInfo, TypeCtor, UniMode, Determinism,
+ ProcId) :-
UniMode = (XInitial - YInitial -> _Final),
(
Determinism = semidet,
@@ -226,14 +226,14 @@
;
module_info_get_proc_requests(ModuleInfo, Requests),
unify_proc__get_unify_req_map(Requests, UnifyReqMap),
- map__search(UnifyReqMap, TypeId - UniMode, ProcId)
+ map__search(UnifyReqMap, TypeCtor - UniMode, ProcId)
).
%-----------------------------------------------------------------------------%
unify_proc__request_unify(UnifyId, InstVarSet, Determinism, Context,
ModuleInfo0, ModuleInfo) :-
- UnifyId = TypeId - UnifyMode,
+ UnifyId = TypeCtor - UnifyMode,
%
% Generating a unification procedure for a type uses its body.
@@ -241,7 +241,7 @@
module_info_get_maybe_recompilation_info(ModuleInfo0, MaybeRecompInfo0),
( MaybeRecompInfo0 = yes(RecompInfo0) ->
recompilation__record_used_item(type_body,
- TypeId, TypeId, RecompInfo0, RecompInfo),
+ TypeCtor, TypeCtor, RecompInfo0, RecompInfo),
module_info_set_maybe_recompilation_info(ModuleInfo0,
yes(RecompInfo), ModuleInfo1)
;
@@ -254,19 +254,19 @@
%
(
(
- unify_proc__search_mode_num(ModuleInfo1, TypeId,
+ unify_proc__search_mode_num(ModuleInfo1, TypeCtor,
UnifyMode, Determinism, _)
;
- TypeId = TypeName - _TypeArity,
+ TypeCtor = TypeName - _TypeArity,
TypeName = qualified(TypeModuleName, _),
module_info_name(ModuleInfo1, ModuleName),
ModuleName = TypeModuleName,
module_info_types(ModuleInfo1, TypeTable),
- map__search(TypeTable, TypeId, TypeDefn),
+ map__search(TypeTable, TypeCtor, TypeDefn),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
TypeBody = abstract_type
;
- type_id_has_hand_defined_rtti(TypeId)
+ type_ctor_has_hand_defined_rtti(TypeCtor)
)
->
ModuleInfo = ModuleInfo1
@@ -276,14 +276,14 @@
% that we are going to generate
%
module_info_get_special_pred_map(ModuleInfo1, SpecialPredMap),
- ( map__search(SpecialPredMap, unify - TypeId, PredId0) ->
+ ( map__search(SpecialPredMap, unify - TypeCtor, PredId0) ->
PredId = PredId0,
ModuleInfo2 = ModuleInfo1
;
% We generate unification predicates for most
% imported types lazily, so add the declarations
% and clauses now.
- unify_proc__add_lazily_generated_unify_pred(TypeId,
+ unify_proc__add_lazily_generated_unify_pred(TypeCtor,
PredId, ModuleInfo1, ModuleInfo2)
),
@@ -293,7 +293,7 @@
% for polymorphic types, add extra modes for the type_infos
in_mode(InMode),
- TypeId = _ - TypeArity,
+ TypeCtor = _ - TypeArity,
list__duplicate(TypeArity, InMode, TypeInfoModes),
list__append(TypeInfoModes, ArgModes0, ArgModes),
@@ -506,12 +506,12 @@
%-----------------------------------------------------------------------------%
%-----------------------------------------------------------------------------%
-unify_proc__add_lazily_generated_unify_pred(TypeId,
+unify_proc__add_lazily_generated_unify_pred(TypeCtor,
PredId, ModuleInfo0, ModuleInfo) :-
(
- type_id_is_tuple(TypeId)
+ type_ctor_is_tuple(TypeCtor)
->
- TypeId = _ - TupleArity,
+ TypeCtor = _ - TupleArity,
%
% Build a hlds_type_body for the tuple constructor, which will
@@ -539,16 +539,16 @@
UnifyPred = no,
IsEnum = no,
TypeBody = du_type([Ctor], ConsTagValues, IsEnum, UnifyPred),
- construct_type(TypeId, TupleArgTypes, Type),
+ construct_type(TypeCtor, TupleArgTypes, Type),
term__context_init(Context)
;
- unify_proc__collect_type_defn(ModuleInfo0, TypeId,
+ unify_proc__collect_type_defn(ModuleInfo0, TypeCtor,
Type, TVarSet, TypeBody, Context)
),
% Call make_hlds.m to construct the unification predicate.
- ( can_generate_special_pred_clauses_for_type(TypeId, TypeBody) ->
+ ( can_generate_special_pred_clauses_for_type(TypeCtor, TypeBody) ->
% If the unification predicate has another status it should
% already have been generated.
UnifyPredStatus = pseudo_imported,
@@ -559,12 +559,12 @@
),
unify_proc__add_lazily_generated_special_pred(unify, Item,
- TVarSet, Type, TypeId, TypeBody, Context, UnifyPredStatus,
+ TVarSet, Type, TypeCtor, TypeBody, Context, UnifyPredStatus,
PredId, ModuleInfo0, ModuleInfo).
-unify_proc__add_lazily_generated_compare_pred_decl(TypeId,
+unify_proc__add_lazily_generated_compare_pred_decl(TypeCtor,
PredId, ModuleInfo0, ModuleInfo) :-
- unify_proc__collect_type_defn(ModuleInfo0, TypeId, Type,
+ unify_proc__collect_type_defn(ModuleInfo0, TypeCtor, Type,
TVarSet, TypeBody, Context),
% If the compare predicate has another status it should
@@ -572,17 +572,17 @@
ImportStatus = imported(implementation),
unify_proc__add_lazily_generated_special_pred(compare, declaration,
- TVarSet, Type, TypeId, TypeBody, Context, ImportStatus,
+ TVarSet, Type, TypeCtor, TypeBody, Context, ImportStatus,
PredId, ModuleInfo0, ModuleInfo).
:- pred unify_proc__add_lazily_generated_special_pred(special_pred_id,
- unify_pred_item, tvarset, type, type_id, hlds_type_body,
+ unify_pred_item, tvarset, type, type_ctor, hlds_type_body,
context, import_status, pred_id, module_info, module_info).
:- mode unify_proc__add_lazily_generated_special_pred(in, in, in, in, in, in,
in, in, out, in, out) is det.
unify_proc__add_lazily_generated_special_pred(SpecialId, Item,
- TVarSet, Type, TypeId, TypeBody, Context, PredStatus,
+ TVarSet, Type, TypeCtor, TypeBody, Context, PredStatus,
PredId, ModuleInfo0, ModuleInfo) :-
%
% Add the declaration and maybe clauses.
@@ -590,17 +590,17 @@
(
Item = clauses,
make_hlds__add_special_pred_for_real(SpecialId, ModuleInfo0,
- TVarSet, Type, TypeId, TypeBody, Context,
+ TVarSet, Type, TypeCtor, TypeBody, Context,
PredStatus, ModuleInfo1)
;
Item = declaration,
make_hlds__add_special_pred_decl_for_real(SpecialId,
- ModuleInfo0, TVarSet, Type, TypeId,
+ ModuleInfo0, TVarSet, Type, TypeCtor,
Context, PredStatus, ModuleInfo1)
),
module_info_get_special_pred_map(ModuleInfo1, SpecialPredMap),
- map__lookup(SpecialPredMap, SpecialId - TypeId, PredId),
+ map__lookup(SpecialPredMap, SpecialId - TypeCtor, PredId),
module_info_pred_info(ModuleInfo1, PredId, PredInfo0),
%
@@ -640,13 +640,13 @@
.
:- pred unify_proc__collect_type_defn(module_info,
- type_id, type, tvarset, hlds_type_body, prog_context).
+ type_ctor, type, tvarset, hlds_type_body, prog_context).
:- mode unify_proc__collect_type_defn(in, in, out, out, out, out) is det.
-unify_proc__collect_type_defn(ModuleInfo0, TypeId, Type,
+unify_proc__collect_type_defn(ModuleInfo0, TypeCtor, Type,
TVarSet, TypeBody, Context) :-
module_info_types(ModuleInfo0, Types),
- map__lookup(Types, TypeId, TypeDefn),
+ map__lookup(Types, TypeCtor, TypeDefn),
hlds_data__get_type_defn_tvarset(TypeDefn, TVarSet),
hlds_data__get_type_defn_tparams(TypeDefn, TypeParams),
hlds_data__get_type_defn_body(TypeDefn, TypeBody),
@@ -654,10 +654,10 @@
hlds_data__get_type_defn_context(TypeDefn, Context),
require(special_pred_is_generated_lazily(ModuleInfo0,
- TypeId, TypeBody, TypeStatus),
+ TypeCtor, TypeBody, TypeStatus),
"unify_proc__add_lazily_generated_unify_pred"),
- construct_type(TypeId, TypeParams, Type).
+ construct_type(TypeCtor, TypeParams, Type).
%-----------------------------------------------------------------------------%
Index: compiler/unused_args.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unused_args.m,v
retrieving revision 1.74
diff -u -b -r1.74 unused_args.m
--- compiler/unused_args.m 2002/02/12 15:47:56 1.74
+++ compiler/unused_args.m 2002/02/25 16:03:54
@@ -932,13 +932,14 @@
(
% fix up special pred names
special_pred_get_type(Name0, ArgTypes0, Type),
- type_to_type_id(Type, TypeId, _)
+ type_to_ctor_and_args(Type, TypeCtor, _)
->
- type_util__type_id_module(ModuleInfo,
- TypeId, TypeModule),
- type_util__type_id_name(ModuleInfo, TypeId, TypeName),
- type_util__type_id_arity(ModuleInfo,
- TypeId, TypeArity),
+ type_util__type_ctor_module(ModuleInfo,
+ TypeCtor, TypeModule),
+ type_util__type_ctor_name(ModuleInfo,
+ TypeCtor, TypeName),
+ type_util__type_ctor_arity(ModuleInfo,
+ TypeCtor, TypeArity),
string__int_to_string(TypeArity, TypeAr),
prog_out__sym_name_to_string(TypeModule,
TypeModuleString0),
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
--------------------------------------------------------------------------
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