[m-rev.] for review: remove redundant fields from type_ctor_infos, part 1

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Jan 18 19:21:32 AEDT 2002


For anyone to review.

This is the first half of a change that removes redundant fields from
type_ctor_info structures.

runtime/mercury_type_info.h:
	Update the RTTI version number.

	Add the new definition of type_ctor_infos.

	Add prefixes to the fields in type_ctor_infos that did not already have
	them.

	Provide macros to access the fields in the changed part of
	type_ctor_infos in a way that works with both the old and new
	type_ctor_info structures.

	Move some stuff so that macros that logically belong together are next
	to each other.

runtime/mercury_mcpp.h:
	Update the RTTI version number and the macros for defining
	type_ctor_infos.

library/rtti_implementation.m:
	Update the mechanism for access to type_ctor_info fields.

	Add prefixes to field names and use RTTI-version-independent macros
	as necessary.

compiler/hlds_module.m:
compiler/rtti.m:
	Delete obsolete fields from the terms from which type_ctor_info
	structures are derived.

compiler/dead_proc_elim.m:
	Minor changes to conform to this change in data structure.

compiler/type_ctor_info.m:
	Minor changes to conform to this change in data structure.
	Update the RTTI version number.

compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
	Output the new type_ctor_info structure.

compiler/llds_out.m:
compiler/mlds_to_c.m:
	Emit a #define to select the new type_ctor_info structure.

library/std_util.m:
runtime/mercury.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.c:
runtime/mercury_type_tables.c:
runtime/mercury_unify_compare_body.h:
tests/hard_coded/type_tables.m:
trace/mercury_trace.c:
	Add prefixes to field names and use RTTI-version-independent macros
	as necessary.

Zoltan.

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/dead_proc_elim.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.66
diff -u -b -r1.66 dead_proc_elim.m
--- compiler/dead_proc_elim.m	2001/07/20 14:13:21	1.66
+++ compiler/dead_proc_elim.m	2002/01/08 07:38:50
@@ -177,8 +177,7 @@
 dead_proc_elim__initialize_base_gen_infos([TypeCtorGenInfo | TypeCtorGenInfos],
 		Queue0, Queue, Needed0, Needed) :-
 	TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName, TypeName,
-		Arity, _Status, _HldsDefn, _Unify, _Compare,
-		_Solver, _Init, _Pretty),
+		Arity, _Status, _HldsDefn, _Unify, _Compare),
 	(
 		% XXX: We'd like to do this, but there are problems.
 		% status_is_exported(Status, yes)
@@ -333,16 +332,13 @@
 	(
 		TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName,
 			TypeName, TypeArity, _Status, _HldsDefn,
-			MaybeUnify, MaybeCompare,
-			MaybeSolver, MaybeInit, MaybePretty)
+			MaybeUnify, MaybeCompare)
 	->
 		Refs0 = [],
 		dead_proc_elim__maybe_add_ref(MaybeUnify,   Refs0, Refs1),
 		dead_proc_elim__maybe_add_ref(MaybeCompare, Refs1, Refs2),
-		dead_proc_elim__maybe_add_ref(MaybeSolver,  Refs2, Refs3),
-		dead_proc_elim__maybe_add_ref(MaybeInit,    Refs3, Refs4),
-		dead_proc_elim__maybe_add_ref(MaybePretty,  Refs4, Refs5),
-		Refs = Refs5
+		% dead_proc_elim__maybe_add_ref(MaybePretty,  Refs2, Refs3),
+		Refs = Refs2
 	;
 		dead_proc_elim__find_base_gen_info(ModuleName, TypeName,
 			TypeArity, TypeCtorGenInfos, Refs)
@@ -673,8 +669,7 @@
 		TypeCtorGenInfos1),
 	TypeCtorGenInfo0 = type_ctor_gen_info(TypeId, ModuleName,
 		TypeName, Arity, Status, HldsDefn,
-		_MaybeUnify, _MaybeCompare,
-		_MaybeSolver, _MaybeInit, _MaybePretty),
+		_MaybeUnify, _MaybeCompare),
 	(
 		Entity = base_gen_info(ModuleName, TypeName, Arity),
 		map__search(Needed, Entity, _)
@@ -683,7 +678,7 @@
 	;
 		NeuteredTypeCtorGenInfo = type_ctor_gen_info(TypeId,
 			ModuleName, TypeName, Arity, Status, HldsDefn,
-			no, no, no, no, no),
+			no, no),
 		TypeCtorGenInfos = [NeuteredTypeCtorGenInfo |
 			TypeCtorGenInfos1]
 	).
Index: compiler/hlds_module.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_module.m,v
retrieving revision 1.69
diff -u -b -r1.69 hlds_module.m
--- compiler/hlds_module.m	2001/11/06 15:20:41	1.69
+++ compiler/hlds_module.m	2002/01/08 07:36:38
@@ -64,10 +64,8 @@
 			import_status,	% of the type
 			hlds_type_defn,	% defn of type
 			maybe(pred_proc_id),	% unify, if not eliminated
-			maybe(pred_proc_id),	% compare, if not eliminated
-			maybe(pred_proc_id),	% solver, if relevant
-			maybe(pred_proc_id),	% init, if relevant
-			maybe(pred_proc_id)	% prettyprinter, if relevant
+			maybe(pred_proc_id)	% compare, if not eliminated
+			% maybe(pred_proc_id)	% prettyprinter, if relevant
 		).
 
 	% map from proc to a list of unused argument numbers.
Index: compiler/llds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/llds_out.m,v
retrieving revision 1.183
diff -u -b -r1.183 llds_out.m
--- compiler/llds_out.m	2001/12/31 04:26:36	1.183
+++ compiler/llds_out.m	2002/01/08 07:16:11
@@ -454,7 +454,7 @@
 		"** END_OF_C_GRADE_INFO\n",
 		"*/\n",
 		"\n",
-		"\n#define MR_BOOTSTRAP_TYPE_CTOR_VERSION_NO\n"
+		"#define MR_BOOTSTRAP_TYPE_CTOR_COMPACT\n"
 	]).
 
 :- pred convert_bool_to_string(bool, string).
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.114
diff -u -b -r1.114 mlds_to_c.m
--- compiler/mlds_to_c.m	2002/01/16 01:13:34	1.114
+++ compiler/mlds_to_c.m	2002/01/17 11:54:32
@@ -123,9 +123,8 @@
 :- mode mlds_output_hdr_file(in, in, di, uo) is det.
 
 mlds_output_hdr_file(Indent, MLDS) -->
-	% XXX for bootstrapping the new type_ctor_info structure.
-	io__write_string("#define MR_BOOTSTRAP_TYPE_CTOR_VERSION_NO\n"),
-
+	% XXX for bootstrapping
+	io__write_string("#define MR_BOOTSTRAP_TYPE_CTOR_COMPACT\n"),
 	{ MLDS = mlds(ModuleName, AllForeignCode, Imports, Defns) },
 	mlds_output_hdr_start(Indent, ModuleName), io__nl,
 	mlds_output_hdr_imports(Indent, Imports), io__nl,
Index: compiler/rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.14
diff -u -b -r1.14 rtti.m
--- compiler/rtti.m	2001/10/24 07:43:12	1.14
+++ compiler/rtti.m	2002/01/08 07:35:03
@@ -339,16 +339,14 @@
 			maybe(rtti_proc_label),	% unify
 			maybe(rtti_proc_label),	% compare
 			type_ctor_rep,
-			maybe(rtti_proc_label),	% solver
-			maybe(rtti_proc_label),	% init
 			int,			% RTTI version number
 			int,			% num of ptags used if ctor_rep
 						% is DU or DUUSEREQ
 			int,			% number of functors in type
 			type_ctor_functors_info,% the functor layout
-			type_ctor_layout_info,	% the layout table
-			maybe(rtti_name),	% the type's hash cons table
-			maybe(rtti_proc_label)	% prettyprinter
+			type_ctor_layout_info	% the layout table
+			% maybe(rtti_name),	% the type's hash cons table
+			% maybe(rtti_proc_label)% prettyprinter
 		)
 	;	pseudo_type_info(pseudo_type_info)
 	;	base_typeclass_info(
@@ -529,7 +527,7 @@
 	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, _,_,_,_,_,_,_,_,_,_,_,_),
+rtti_data_to_name(type_ctor_info(RttiTypeId, _,_,_,_,_,_,_,_),
 	RttiTypeId, type_ctor_info).
 rtti_data_to_name(base_typeclass_info(_, _, _, _), _, _) :-
 	% there's no rtti_type_id associated with a base_typeclass_info
Index: compiler/rtti_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.23
diff -u -b -r1.23 rtti_out.m
--- compiler/rtti_out.m	2001/12/31 04:26:40	1.23
+++ compiler/rtti_out.m	2002/01/08 08:47:25
@@ -372,15 +372,12 @@
 	io__write_string(",\n\t"),
 	output_rtti_addr(RttiTypeId, DuFunctorLayout),
 	io__write_string("\n};\n").
-output_rtti_data_defn(type_ctor_info(RttiTypeId, Unify, Compare,
-		CtorRep, Solver, Init, Version, NumPtags, NumFunctors,
-		FunctorsInfo, LayoutInfo, _MaybeHashCons, _Prettyprinter),
+output_rtti_data_defn(type_ctor_info(RttiTypeId, Unify, Compare, CtorRep,
+		Version, NumPtags, NumFunctors, FunctorsInfo, LayoutInfo),
 		DeclSet0, DeclSet) -->
 	{ UnifyCA   = make_maybe_code_addr(Unify) },
 	{ CompareCA = make_maybe_code_addr(Compare) },
-	{ SolverCA  = make_maybe_code_addr(Solver) },
-	{ InitCA    = make_maybe_code_addr(Init) },
-	{ MaybeCodeAddrs = [UnifyCA, CompareCA, SolverCA, InitCA] },
+	{ MaybeCodeAddrs = [UnifyCA, CompareCA] },
 	{ CodeAddrs = list__filter_map(func(yes(CA)) = CA is semidet,
 		MaybeCodeAddrs) },
 	output_code_addrs_decls(CodeAddrs, "", "", 0, _, DeclSet0, DeclSet1),
@@ -403,20 +400,12 @@
 	output_maybe_static_code_addr(UnifyCA),
 	io__write_string(",\n\t"),
 	output_maybe_static_code_addr(CompareCA),
-	io__write_string(",\n\t"),
-	io__write_string(CtorRepStr),
-	io__write_string(",\n\t"),
-	output_maybe_static_code_addr(SolverCA),
-	io__write_string(",\n\t"),
-	output_maybe_static_code_addr(InitCA),
 	io__write_string(",\n\t"""),
 	{ prog_out__sym_name_to_string(Module, ModuleName) },
 	c_util__output_quoted_string(ModuleName),
 	io__write_string(""",\n\t"""),
 	c_util__output_quoted_string(Type),
 	io__write_string(""",\n\t"),
-	io__write_int(Version),
-	io__write_string(",\n\t"),
 	(
 		{ FunctorsInfo = enum_functors(EnumFunctorsInfo) },
 		io__write_string("{ (void *) "),
@@ -784,8 +773,7 @@
 
 rtti_out__init_rtti_data_if_nec(Data) -->
 	(
-		{ Data = type_ctor_info(RttiTypeId,
-			_,_,_,_,_,_,_,_,_,_,_,_) }
+		{ Data = type_ctor_info(RttiTypeId, _,_,_,_,_,_,_,_) }
 	->
 		io__write_string("\tMR_INIT_TYPE_CTOR_INFO(\n\t\t"),
 		output_rtti_addr(RttiTypeId, type_ctor_info),
@@ -825,8 +813,7 @@
 
 rtti_out__register_rtti_data_if_nec(Data, SplitFiles) -->
 	(
-		{ Data = type_ctor_info(RttiTypeId,
-			_,_,_,_,_,_,_,_,_,_,_,_) }
+		{ Data = type_ctor_info(RttiTypeId, _,_,_,_,_,_,_,_) }
 	->
 		(
 			{ SplitFiles = yes },
Index: compiler/rtti_to_mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti_to_mlds.m,v
retrieving revision 1.23
diff -u -b -r1.23 rtti_to_mlds.m
--- compiler/rtti_to_mlds.m	2002/01/11 07:41:33	1.23
+++ compiler/rtti_to_mlds.m	2002/01/11 09:20:22
@@ -228,9 +228,8 @@
 		gen_init_rtti_name(ModuleName, RttiTypeId, DuLayout)
 	]).
 gen_init_rtti_data_defn(type_ctor_info(RttiTypeId, UnifyProc, CompareProc,
-		CtorRep, SolverProc, InitProc, Version, NumPtags, NumFunctors,
-		FunctorsInfo, LayoutInfo, _MaybeHashCons,
-		_PrettyprinterProc), ModuleName, ModuleInfo, Init, []) :-
+		CtorRep, Version, NumPtags, NumFunctors, FunctorsInfo,
+		LayoutInfo), ModuleName, ModuleInfo, Init, []) :-
 	RttiTypeId = rtti_type_id(TypeModule, Type, TypeArity),
 	prog_out__sym_name_to_string(TypeModule, TypeModuleName),
 	Init = init_struct([
@@ -240,12 +239,8 @@
 		gen_init_int(NumPtags),
 		gen_init_maybe_proc_id(ModuleInfo, UnifyProc),
 		gen_init_maybe_proc_id(ModuleInfo, CompareProc),
-		gen_init_type_ctor_rep(CtorRep),
-		gen_init_maybe_proc_id(ModuleInfo, SolverProc),
-		gen_init_maybe_proc_id(ModuleInfo, InitProc),
 		gen_init_string(TypeModuleName),
 		gen_init_string(Type),
-		gen_init_int(Version),
 		% In the C back-end, these two "structs" are actually unions.
 		% We need to use `init_struct' here so that the initializers
 		% get enclosed in curly braces.
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.19
diff -u -b -r1.19 type_ctor_info.m
--- compiler/type_ctor_info.m	2002/01/16 01:13:42	1.19
+++ compiler/type_ctor_info.m	2002/01/17 11:54:32
@@ -135,9 +135,8 @@
 		MaybeUnify = no,
 		MaybeCompare = no
 	),
-	TypeCtorGenInfo = type_ctor_gen_info(TypeId, ModuleName,
-		TypeName, TypeArity, Status, TypeDefn,
-		MaybeUnify, MaybeCompare, no, no, no).
+	TypeCtorGenInfo = type_ctor_gen_info(TypeId, ModuleName, TypeName,
+		TypeArity, Status, TypeDefn, MaybeUnify, MaybeCompare).
 
 %---------------------------------------------------------------------------%
 
@@ -174,14 +173,9 @@
 type_ctor_info__construct_type_ctor_info(TypeCtorGenInfo,
 		ModuleInfo, TypeCtorData, TypeCtorTables) :-
 	TypeCtorGenInfo = type_ctor_gen_info(_TypeId, ModuleName, TypeName,
-		TypeArity, _Status, HldsDefn,
-		MaybeUnify, MaybeCompare,
-		MaybeSolver, MaybeInit, MaybePretty),
+		TypeArity, _Status, HldsDefn, MaybeUnify, MaybeCompare),
 	type_ctor_info__make_proc_label(MaybeUnify,   ModuleInfo, Unify),
 	type_ctor_info__make_proc_label(MaybeCompare, ModuleInfo, Compare),
-	type_ctor_info__make_proc_label(MaybeSolver,  ModuleInfo, Solver),
-	type_ctor_info__make_proc_label(MaybeInit,    ModuleInfo, Init),
-	type_ctor_info__make_proc_label(MaybePretty,  ModuleInfo, Pretty),
 
 	module_info_globals(ModuleInfo, Globals),
 	globals__lookup_bool_option(Globals, type_layout, TypeLayoutOption),
@@ -204,8 +198,8 @@
 	Version = type_ctor_info_rtti_version,
 	RttiTypeId = rtti_type_id(ModuleName, TypeName, TypeArity),
 	TypeCtorData = type_ctor_info(RttiTypeId, Unify, Compare,
-		TypeCtorRep, Solver, Init, Version, NumPtags, NumFunctors,
-		MaybeFunctors, MaybeLayout, no, Pretty).
+		TypeCtorRep, Version, NumPtags, NumFunctors,
+		MaybeFunctors, MaybeLayout).
 
 :- pred type_ctor_info__make_proc_label(maybe(pred_proc_id)::in,
 	module_info::in, maybe(rtti_proc_label)::out) is det.
@@ -231,7 +225,7 @@
 
 :- func type_ctor_info_rtti_version = int.
 
-type_ctor_info_rtti_version = 5.
+type_ctor_info_rtti_version = 6.
 
 %---------------------------------------------------------------------------%
 %---------------------------------------------------------------------------%
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 library
Index: library/rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.9
diff -u -b -r1.9 rtti_implementation.m
--- library/rtti_implementation.m	2002/01/16 00:04:33	1.9
+++ library/rtti_implementation.m	2002/01/18 08:03:11
@@ -999,15 +999,11 @@
 		type_ctor_num_ptags	= 3,
 		type_ctor_unify_pred 	= 4,
 		type_ctor_compare_pred	= 5,
-		// 6
-		// 7
-		// 8
-		type_ctor_module_name	= 9,
-		type_ctor_name		= 10,
-		// 11
-		type_functors		= 12,
-		type_layout		= 13,
-		type_ctor_num_functors	= 14
+		type_ctor_module_name	= 6,
+		type_ctor_name		= 7,
+		type_functors		= 8,
+		type_layout		= 9,
+		type_ctor_num_functors	= 10
 	}
 
 	enum ptag_layout_field_nums {
@@ -1350,7 +1346,7 @@
 :- pragma foreign_proc("C",
 	type_ctor_arity(TypeCtorInfo::in) = (Arity::out), [], "
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
-	Arity = tci->arity;
+	Arity = tci->MR_type_ctor_arity;
 ").
 
 :- some [P] func type_ctor_unify_pred(type_ctor_info) = P.
@@ -1362,7 +1358,7 @@
 :- pragma foreign_proc("C",
 	type_ctor_unify_pred(TypeCtorInfo::in) = (UnifyPred::out), [], "
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
-	UnifyPred = (MR_Integer) tci->unify_pred;
+	UnifyPred = (MR_Integer) tci->MR_type_ctor_unify_pred;
 ").
 
 :- some [P] func type_ctor_compare_pred(type_ctor_info) = P.
@@ -1374,7 +1370,7 @@
 :- pragma foreign_proc("C",
 	type_ctor_compare_pred(TypeCtorInfo::in) = (UnifyPred::out), [], "
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
-	UnifyPred = (MR_Integer) tci->compare_pred;
+	UnifyPred = (MR_Integer) tci->MR_type_ctor_compare_pred;
 ").
 
 
@@ -1406,7 +1402,7 @@
 :- pragma foreign_proc("C",
 	type_ctor_module_name(TypeCtorInfo::in) = (Name::out), [], "
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
-	Name = (MR_String) tci->type_ctor_module_name;
+	Name = (MR_String) MR_type_ctor_module_name(tci);
 ").
 
 
@@ -1421,7 +1417,7 @@
 :- pragma foreign_proc("C",
 	type_ctor_name(TypeCtorInfo::in) = (Name::out), [], "
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
-	Name = (MR_String) tci->type_ctor_name;
+	Name = (MR_String) MR_type_ctor_name(tci);
 ").
 
 
@@ -1435,7 +1431,7 @@
 :- pragma foreign_proc("C",
 	type_layout(TypeCtorInfo::in) = (TypeLayout::out), [], "
 	MR_TypeCtorInfo tci = (MR_TypeCtorInfo) TypeCtorInfo;
-	TypeLayout = (MR_Word) &(tci->type_layout); 
+	TypeLayout = (MR_Word) &(MR_type_ctor_layout(tci));
 ").
 
 :- pragma foreign_proc("C",
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.254
diff -u -b -r1.254 std_util.m
--- library/std_util.m	2002/01/14 05:06:47	1.254
+++ library/std_util.m	2002/01/17 11:54:36
@@ -1933,7 +1933,7 @@
 		*arg_type_info_list_ptr = ML_type_params_vector_to_list(arity,
 			MR_TYPEINFO_GET_HIGHER_ORDER_ARG_VECTOR(type_info));
 	} else {
-		arity = type_ctor_info->arity;
+		arity = type_ctor_info->MR_type_ctor_arity;
 		*arg_type_info_list_ptr = ML_type_params_vector_to_list(arity,
 			MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info));
 	}
@@ -1990,7 +1990,7 @@
 	} else {
         type_ctor_info = MR_TYPECTOR_DESC_GET_FIXED_ARITY_TYPE_CTOR_INFO(
             type_ctor_desc);
-		arity = type_ctor_info->arity;
+		arity = type_ctor_info->MR_type_ctor_arity;
 	}
 
 	arg_type = ArgTypes;
@@ -2070,10 +2070,10 @@
             */
 
             TypeCtorModuleName = (MR_String) (MR_Integer)
-                type_ctor_info->type_ctor_module_name;
+                MR_type_ctor_module_name(type_ctor_info);
             TypeCtorName = (MR_String) (MR_Integer)
-                type_ctor_info->type_ctor_name;
-            TypeCtorArity = type_ctor_info->arity;
+                MR_type_ctor_name(type_ctor_info);
+            TypeCtorArity = type_ctor_info->MR_type_ctor_arity;
         }
 }
 ").
@@ -2349,7 +2349,7 @@
 		int total_reserved_addrs;
 		const MR_ReservedAddrFunctorDesc *functor_desc;
 
-		ra_layout = type_ctor_info->type_layout.layout_reserved_addr;
+		ra_layout = MR_type_ctor_layout(type_ctor_info).layout_reserved_addr;
 		total_reserved_addrs = ra_layout->MR_ra_num_res_numeric_addrs
 			+ ra_layout->MR_ra_num_res_symbolic_addrs;
 
@@ -2634,13 +2634,13 @@
             MR_DuFunctorDesc    *functor_desc;
 
             if (functor_number < 0 ||
-                functor_number >= type_ctor_info->type_ctor_num_functors)
+                functor_number >= MR_type_ctor_num_functors(type_ctor_info))
             {
                 MR_fatal_error(""ML_get_functor_info: ""
                     ""du functor_number out of range"");
             }
 
-            functor_desc = type_ctor_info->type_functors.
+            functor_desc = MR_type_ctor_functors(type_ctor_info).
                 functors_du[functor_number];
             construct_info->functor_info.du_functor_desc = functor_desc;
             construct_info->functor_name = functor_desc->MR_du_functor_name;
@@ -2658,13 +2658,13 @@
             MR_EnumFunctorDesc  *functor_desc;
 
             if (functor_number < 0 ||
-                functor_number >= type_ctor_info->type_ctor_num_functors)
+                functor_number >= MR_type_ctor_num_functors(type_ctor_info))
             {
                 MR_fatal_error(""ML_get_functor_info: ""
                     ""enum functor_number out of range"");
             }
 
-            functor_desc = type_ctor_info->type_functors.
+            functor_desc = MR_type_ctor_functors(type_ctor_info).
                 functors_enum[functor_number];
             construct_info->functor_info.enum_functor_desc = functor_desc;
             construct_info->functor_name = functor_desc->MR_enum_functor_name;
@@ -2686,7 +2686,7 @@
                     ""notag functor_number out of range"");
             }
 
-            functor_desc = type_ctor_info->type_functors.functors_notag;
+            functor_desc = MR_type_ctor_functors(type_ctor_info).functors_notag;
             construct_info->functor_info.notag_functor_desc = functor_desc;
             construct_info->functor_name = functor_desc->MR_notag_functor_name;
             construct_info->arity = 1;
@@ -2702,7 +2702,7 @@
         return ML_get_functor_info(
             MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                type_ctor_info->type_layout.layout_equiv),
+                MR_type_ctor_layout(type_ctor_info).layout_equiv),
             functor_number, construct_info);
 
     case MR_TYPECTOR_REP_EQUIV_VAR:
@@ -3042,7 +3042,7 @@
         case MR_TYPECTOR_REP_RESERVED_ADDR_USEREQ:
         case MR_TYPECTOR_REP_ENUM:
         case MR_TYPECTOR_REP_ENUM_USEREQ:
-            functors = type_ctor_info->type_ctor_num_functors;
+            functors = MR_type_ctor_num_functors(type_ctor_info);
             break;
 
         case MR_TYPECTOR_REP_NOTAG:
@@ -3065,7 +3065,7 @@
         case MR_TYPECTOR_REP_EQUIV:
             functors = ML_get_num_functors(
                 MR_create_type_info((MR_TypeInfo *) type_info,
-                    type_ctor_info->type_layout.layout_equiv));
+                    MR_type_ctor_layout(type_ctor_info).layout_equiv));
             break;
 
         case MR_TYPECTOR_REP_INT:
@@ -3565,7 +3565,7 @@
     switch (MR_type_ctor_rep(type_ctor_info)) {
         case MR_TYPECTOR_REP_NOTAG:
         case MR_TYPECTOR_REP_NOTAG_USEREQ:
-            functor_desc = type_ctor_info->type_functors.functors_notag;
+            functor_desc = MR_type_ctor_functors(type_ctor_info).functors_notag;
             exp_type_info = MR_pseudo_type_info_is_ground(
                 functor_desc->MR_notag_functor_arg_type);
             MR_new_univ_on_hp(ExpUniv, exp_type_info, value);
@@ -3574,7 +3574,7 @@
 
         case MR_TYPECTOR_REP_NOTAG_GROUND:
         case MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ:
-            functor_desc = type_ctor_info->type_functors.functors_notag;
+            functor_desc = MR_type_ctor_functors(type_ctor_info).functors_notag;
             exp_type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
                 functor_desc->MR_notag_functor_arg_type);
@@ -3615,7 +3615,7 @@
     switch (MR_type_ctor_rep(type_ctor_info)) {
         case MR_TYPECTOR_REP_EQUIV:
             exp_type_info = MR_pseudo_type_info_is_ground(
-                type_ctor_info->type_layout.layout_equiv);
+                MR_type_ctor_layout(type_ctor_info).layout_equiv);
             MR_new_univ_on_hp(ExpUniv, exp_type_info, value);
             SUCCESS_INDICATOR = TRUE;
             break;
@@ -3623,7 +3623,7 @@
         case MR_TYPECTOR_REP_EQUIV_GROUND:
             exp_type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                type_ctor_info->type_layout.layout_equiv);
+                MR_type_ctor_layout(type_ctor_info).layout_equiv);
             MR_new_univ_on_hp(ExpUniv, exp_type_info, value);
             SUCCESS_INDICATOR = TRUE;
             break;
@@ -3703,7 +3703,7 @@
         case MR_TYPECTOR_REP_DU_USEREQ:
             SUCCESS_INDICATOR = TRUE;
             Ptag = MR_tag(value);
-            ptag_layout = &type_ctor_info->type_layout.layout_du[Ptag];
+            ptag_layout = &MR_type_ctor_layout(type_ctor_info).layout_du[Ptag];
 
             switch(ptag_layout->MR_sectag_locn) {
                 case MR_SECTAG_LOCAL:
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury.c,v
retrieving revision 1.30
diff -u -b -r1.30 mercury.c
--- runtime/mercury.c	2002/01/04 05:19:05	1.30
+++ runtime/mercury.c	2002/01/08 16:03:14
@@ -181,7 +181,7 @@
 			(MR_Pred) y);
 	}
 
-	arity = type_ctor_info->arity;
+	arity = type_ctor_info->MR_type_ctor_arity;
 	params = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
 	args = (MR_Mercury_Type_Info *) params;
 
@@ -191,19 +191,25 @@
 		** and then call it, passing the right number of
 		** type_info arguments
 		*/
-		case 0: return ((MR_UnifyFunc_0 *) type_ctor_info->unify_pred)
+		case 0: return ((MR_UnifyFunc_0 *)
+				type_ctor_info->MR_type_ctor_unify_pred)
 				(x, y);
-		case 1: return ((MR_UnifyFunc_1 *) type_ctor_info->unify_pred)
+		case 1: return ((MR_UnifyFunc_1 *)
+				type_ctor_info->MR_type_ctor_unify_pred)
 				(args[1], x, y);
-		case 2: return ((MR_UnifyFunc_2 *) type_ctor_info->unify_pred)
+		case 2: return ((MR_UnifyFunc_2 *)
+				type_ctor_info->MR_type_ctor_unify_pred)
 				(args[1], args[2], x, y);
-		case 3: return ((MR_UnifyFunc_3 *) type_ctor_info->unify_pred)
+		case 3: return ((MR_UnifyFunc_3 *)
+				type_ctor_info->MR_type_ctor_unify_pred)
 				(args[1], args[2], args[3],
 				 x, y);
-		case 4: return ((MR_UnifyFunc_4 *) type_ctor_info->unify_pred)
+		case 4: return ((MR_UnifyFunc_4 *)
+				type_ctor_info->MR_type_ctor_unify_pred)
 				(args[1], args[2], args[3],
 				 args[4], x, y);
-		case 5: return ((MR_UnifyFunc_5 *) type_ctor_info->unify_pred)
+		case 5: return ((MR_UnifyFunc_5 *)
+				type_ctor_info->MR_type_ctor_unify_pred)
 				(args[1], args[2], args[3],
 				 args[4], args[5], x, y);
 		default:
@@ -241,7 +247,7 @@
 	    	return;
 	}
 
-	arity = type_ctor_info->arity;
+	arity = type_ctor_info->MR_type_ctor_arity;
 	params = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
 	args = (MR_Mercury_Type_Info *) params;
 
@@ -251,23 +257,29 @@
 		** and then call it, passing the right number of
 		** type_info arguments
 		*/
-		case 0: ((MR_CompareFunc_0 *) type_ctor_info->compare_pred)
+		case 0: ((MR_CompareFunc_0 *)
+			 type_ctor_info->MR_type_ctor_compare_pred)
 			 (res, x, y);
 			 break;
-		case 1: ((MR_CompareFunc_1 *) type_ctor_info->compare_pred)
+		case 1: ((MR_CompareFunc_1 *)
+			 type_ctor_info->MR_type_ctor_compare_pred)
 			 (args[1], res, x, y);
 			 break;
-		case 2: ((MR_CompareFunc_2 *) type_ctor_info->compare_pred)
+		case 2: ((MR_CompareFunc_2 *)
+			 type_ctor_info->MR_type_ctor_compare_pred)
 			 (args[1], args[2], res, x, y);
 			 break;
-		case 3: ((MR_CompareFunc_3 *) type_ctor_info->compare_pred)
+		case 3: ((MR_CompareFunc_3 *)
+			 type_ctor_info->MR_type_ctor_compare_pred)
 			 (args[1], args[2], args[3], res, x, y);
 			 break;
-		case 4: ((MR_CompareFunc_4 *) type_ctor_info->compare_pred)
+		case 4: ((MR_CompareFunc_4 *)
+			 type_ctor_info->MR_type_ctor_compare_pred)
 			 (args[1], args[2], args[3],
 			  args[4], res, x, y);
 			 break;
-		case 5: ((MR_CompareFunc_5 *) type_ctor_info->compare_pred)
+		case 5: ((MR_CompareFunc_5 *)
+			 type_ctor_info->MR_type_ctor_compare_pred)
 			 (args[1], args[2], args[3],
 			  args[4], args[5], res, x, y);
 			 break;
Index: runtime/mercury_deconstruct.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deconstruct.c,v
retrieving revision 1.2
diff -u -b -r1.2 mercury_deconstruct.c
--- runtime/mercury_deconstruct.c	2002/01/11 04:43:31	1.2
+++ runtime/mercury_deconstruct.c	2002/01/12 09:36:44
@@ -200,7 +200,7 @@
         {
             MR_ReservedAddrTypeLayout ra_layout;
         
-            ra_layout = type_ctor_info->type_layout.layout_reserved_addr;
+            ra_layout = MR_type_ctor_layout(type_ctor_info).layout_reserved_addr;
             data = *term_ptr;
 
             /*
@@ -239,7 +239,7 @@
         case MR_TYPECTOR_REP_DU_USEREQ:
         case MR_TYPECTOR_REP_DU:
             data = *term_ptr;
-            du_type_layout = type_ctor_info->type_layout.layout_du;
+            du_type_layout = MR_type_ctor_layout(type_ctor_info).layout_du;
             /* fall through */
 
         /*
@@ -285,13 +285,13 @@
         case MR_TYPECTOR_REP_EQUIV:
             eqv_type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                type_ctor_info->type_layout.layout_equiv);
+                MR_type_ctor_layout(type_ctor_info).layout_equiv);
             return MR_named_arg_num(eqv_type_info, term_ptr, arg_name,
                 arg_num_ptr);
 
         case MR_TYPECTOR_REP_EQUIV_GROUND:
             eqv_type_info = MR_pseudo_type_info_is_ground(
-                type_ctor_info->type_layout.layout_equiv);
+                MR_type_ctor_layout(type_ctor_info).layout_equiv);
             return MR_named_arg_num(eqv_type_info, term_ptr, arg_name,
                 arg_num_ptr);
 
@@ -307,7 +307,7 @@
         case MR_TYPECTOR_REP_NOTAG_USEREQ:
         case MR_TYPECTOR_REP_NOTAG_GROUND:
         case MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ:
-            notag_functor_desc = type_ctor_info->type_functors.functors_notag;
+            notag_functor_desc = MR_type_ctor_functors(type_ctor_info).functors_notag;
 
             if (notag_functor_desc->MR_notag_functor_arg_name != NULL
             && streq(arg_name, notag_functor_desc->MR_notag_functor_arg_name))
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.41
diff -u -b -r1.41 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h	2001/12/31 04:26:50	1.41
+++ runtime/mercury_deep_copy_body.h	2002/01/08 03:06:52
@@ -1,5 +1,8 @@
 /*
-** Copyright (C) 1997-2001 The University of Melbourne.
+** vim: ts=4 sw=4 expandtab
+*/
+/*
+** Copyright (C) 1997-2002 The University of Melbourne.
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
@@ -56,7 +59,7 @@
 	{
 	    int j;
 	    MR_ReservedAddrTypeLayout ra_layout =
-		    	type_ctor_info->type_layout.layout_reserved_addr;
+                MR_type_ctor_layout(type_ctor_info).layout_reserved_addr;
 
 	    /*
 	    ** First check if this value is one of
@@ -91,7 +94,7 @@
 
     case MR_TYPECTOR_REP_DU:
     case MR_TYPECTOR_REP_DU_USEREQ:
-    	du_type_layout = type_ctor_info->type_layout.layout_du;
+        du_type_layout = MR_type_ctor_layout(type_ctor_info).layout_du;
 	/* fallthru */
 
     /*
@@ -373,27 +376,28 @@
     case MR_TYPECTOR_REP_NOTAG_USEREQ:
         new_data = copy_arg(NULL, data_ptr, NULL,
             MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-            type_ctor_info->type_layout.layout_notag->
+            MR_type_ctor_layout(type_ctor_info).layout_notag->
             MR_notag_functor_arg_type, lower_limit, upper_limit);
         break;
 
     case MR_TYPECTOR_REP_NOTAG_GROUND:
     case MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ:
-        type_info = MR_pseudo_type_info_is_ground(type_ctor_info->
-            type_layout.layout_notag->MR_notag_functor_arg_type);
+        type_info = MR_pseudo_type_info_is_ground(
+            MR_type_ctor_layout(type_ctor_info).layout_notag
+            ->MR_notag_functor_arg_type);
         goto try_again;
         break;
 
     case MR_TYPECTOR_REP_EQUIV:
         new_data = copy_arg(NULL, data_ptr, NULL,
             MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-            type_ctor_info->type_layout.layout_equiv,
+            MR_type_ctor_layout(type_ctor_info).layout_equiv,
             lower_limit, upper_limit);
         break;
 
     case MR_TYPECTOR_REP_EQUIV_GROUND:
-        type_info = MR_pseudo_type_info_is_ground(type_ctor_info->
-            type_layout.layout_equiv);
+        type_info = MR_pseudo_type_info_is_ground(
+            MR_type_ctor_layout(type_ctor_info).layout_equiv);
         goto try_again;
         break;
 
@@ -763,7 +767,7 @@
             MR_fill_in_higher_order_type_info(new_type_info_arena,
                 type_ctor_info, arity, new_type_info_args);
         } else {
-            arity = type_ctor_info->arity;
+            arity = type_ctor_info->MR_type_ctor_arity;
             type_info_args = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
             MR_incr_saved_hp(MR_LVALUE_CAST(MR_Word, new_type_info_arena),
                 MR_first_order_type_info_size(arity));
Index: runtime/mercury_ho_call.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.47
diff -u -b -r1.47 mercury_ho_call.c
--- runtime/mercury_ho_call.c	2001/12/04 00:44:33	1.47
+++ runtime/mercury_ho_call.c	2002/01/08 03:09:48
@@ -305,7 +305,8 @@
 	} while(0)
 
 #define	tailcall_user_pred()						\
-	MR_tailcall(type_ctor_info->unify_pred, MR_LABEL(mercury__unify_2_0))
+	MR_tailcall(type_ctor_info->MR_type_ctor_unify_pred, 		\
+		MR_LABEL(mercury__unify_2_0))
 
 #define	start_label		unify_start
 #define	call_user_code_label	call_unify_in_proc
@@ -377,7 +378,7 @@
 	} while(0)
 
 #define	tailcall_user_pred()						\
-	MR_tailcall(type_ctor_info->compare_pred,			\
+	MR_tailcall(type_ctor_info->MR_type_ctor_compare_pred,		\
 		MR_LABEL(mercury__compare_3_3))
 
 #define	start_label		compare_start
@@ -421,7 +422,8 @@
 #define	tailcall_user_pred()						\
 	do {								\
 		MR_save_transient_registers();				\
-		(void) MR_call_engine(type_ctor_info->unify_pred, FALSE);\
+		(void) MR_call_engine(type_ctor_info->			\
+			MR_type_ctor_unify_pred, FALSE);		\
 		MR_restore_transient_registers();			\
 		return (MR_r1);						\
 	} while (0)
@@ -461,7 +463,8 @@
 #define	tailcall_user_pred()						\
 	do {								\
 		MR_save_transient_registers();				\
-		(void) MR_call_engine(type_ctor_info->compare_pred, FALSE);\
+		(void) MR_call_engine(type_ctor_info->			\
+			MR_type_ctor_compare_pred, FALSE);		\
 		MR_restore_transient_registers();			\
 		return (MR_r1);						\
 	} while (0)
Index: runtime/mercury_make_type_info_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_make_type_info_body.h,v
retrieving revision 1.7
diff -u -b -r1.7 mercury_make_type_info_body.h
--- runtime/mercury_make_type_info_body.h	2001/12/31 04:26:50	1.7
+++ runtime/mercury_make_type_info_body.h	2002/01/08 03:15:01
@@ -69,7 +69,7 @@
 			pseudo_type_info);
 		start_region_size = 2;
 	} else {
-		arity = type_ctor_info->arity;
+		arity = type_ctor_info->MR_type_ctor_arity;
 		start_region_size = 1;
 	}
 
Index: runtime/mercury_mcpp.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.h,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_mcpp.h
--- runtime/mercury_mcpp.h	2002/01/16 00:04:34	1.13
+++ runtime/mercury_mcpp.h	2002/01/18 08:04:04
@@ -116,7 +116,7 @@
 #define MR_TYPECTOR_REP(a) MR_BOX_INT(mercury::runtime::Constants::a)
 
 // XXX This is hardcoded
-#define MR_RTTI_VERSION MR_BOX_INT(4)
+#define MR_RTTI_VERSION MR_BOX_INT(6)
 
 // XXX It is intended that we eventually define the constants in
 // private_builtin.m and mercury_mcpp.cpp in terms of these #defines
@@ -171,12 +171,9 @@
 	MR_BOX_INT(-1),							\
 	MR_MAYBE_STATIC_CODE(n##_unify),				\
 	MR_MAYBE_STATIC_CODE(n##_compare),				\
-	MR_TYPECTOR_REP(cr),						\
-	NULL,								\
-	NULL,								\
 	MR_string_const(MR_STRINGIFY(m), sizeof(MR_STRINGIFY(m))-1),	\
 	MR_string_const(MR_STRINGIFY(n), sizeof(MR_STRINGIFY(n))-1),	\
-	MR_RTTI_VERSION,						\
+	MR_BOX_INT(-1),							\
 	MR_BOX_INT(-1),							\
 	MR_BOX_INT(-1)							\
     MR_STRUCT_INIT_END(})						\
@@ -266,8 +263,8 @@
 #define MR_TYPEINFO_TYPE_CTOR_INFO_SLOT		0
 
 #define MR_TYPE_CTOR_INFO_ARITY_SLOT		0
-#define MR_TYPE_CTOR_INFO_UNIFY_PRED_SLOT	1
-#define MR_TYPE_CTOR_INFO_COMPARE_PRED_SLOT	3
+#define MR_TYPE_CTOR_INFO_UNIFY_PRED_SLOT	5
+#define MR_TYPE_CTOR_INFO_COMPARE_PRED_SLOT	6
 
 } /* end namespace mercury */
 
Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.8
diff -u -b -r1.8 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h	2002/01/12 10:06:16	1.8
+++ runtime/mercury_ml_expand_body.h	2002/01/12 10:08:22
@@ -230,7 +230,7 @@
             /* fall through */
 
         case MR_TYPECTOR_REP_ENUM:
-            handle_functor_name(type_ctor_info->type_layout.
+            handle_functor_name(MR_type_ctor_layout(type_ctor_info).
                     layout_enum[*data_word_ptr]->MR_enum_functor_name);
             handle_zero_arity_args();
             break;
@@ -245,7 +245,7 @@
 				MR_Word data;
 				MR_ReservedAddrTypeLayout ra_layout;
 
-				ra_layout = type_ctor_info->type_layout.layout_reserved_addr;
+				ra_layout = MR_type_ctor_layout(type_ctor_info).layout_reserved_addr;
 				data = *data_word_ptr;
 
 				/*
@@ -292,7 +292,7 @@
             /* fall through */
 
         case MR_TYPECTOR_REP_DU:
-			du_type_layout = type_ctor_info->type_layout.layout_du;
+			du_type_layout = MR_type_ctor_layout(type_ctor_info).layout_du;
 			/* fall through */
 
 			/*
@@ -440,7 +440,7 @@
 
         case MR_TYPECTOR_REP_NOTAG:
             expand_info->arity = 1;
-            handle_functor_name(type_ctor_info->type_layout.layout_notag
+            handle_functor_name(MR_type_ctor_layout(type_ctor_info).layout_notag
 				->MR_notag_functor_name);
 
 #ifdef  EXPAND_ARGS_FIELD
@@ -452,15 +452,15 @@
             expand_info->EXPAND_ARGS_FIELD.arg_type_infos[0] =
                 MR_create_type_info(
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                    type_ctor_info->type_layout.layout_notag->
+                    MR_type_ctor_layout(type_ctor_info).layout_notag->
                         MR_notag_functor_arg_type);
 #endif  /* EXPAND_ARGS_FIELD */
 
 #ifdef  EXPAND_ONE_ARG
   #ifdef    EXPAND_NAMED_ARG
-            if (type_ctor_info->type_layout.layout_notag
+            if (MR_type_ctor_layout(type_ctor_info).layout_notag
                     ->MR_notag_functor_arg_name != NULL
-               && streq(chosen_name, type_ctor_info->type_layout.layout_notag
+               && streq(chosen_name, MR_type_ctor_layout(type_ctor_info).layout_notag
                     ->MR_notag_functor_arg_name))
             {
                 chosen = 0;
@@ -473,7 +473,7 @@
                 expand_info->chosen_type_info =
                     MR_create_type_info(
                         MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                        type_ctor_info->type_layout.layout_notag->
+                        MR_type_ctor_layout(type_ctor_info).layout_notag->
                             MR_notag_functor_arg_type);
             } else {
                 expand_info->chosen_index_exists = FALSE;
@@ -487,7 +487,7 @@
 
         case MR_TYPECTOR_REP_NOTAG_GROUND:
             expand_info->arity = 1;
-            handle_functor_name(type_ctor_info->type_layout.layout_notag
+            handle_functor_name(MR_type_ctor_layout(type_ctor_info).layout_notag
                     ->MR_notag_functor_name);
 
 #ifdef  EXPAND_ARGS_FIELD
@@ -497,16 +497,17 @@
             expand_info->EXPAND_ARGS_FIELD.arg_type_infos =
                 MR_GC_NEW_ARRAY(MR_TypeInfo, 1);
             expand_info->EXPAND_ARGS_FIELD.arg_type_infos[0] =
-                MR_pseudo_type_info_is_ground(type_ctor_info->
-                    type_layout.layout_notag->MR_notag_functor_arg_type);
+                MR_pseudo_type_info_is_ground(
+		    MR_type_ctor_layout(type_ctor_info).layout_notag->
+		    MR_notag_functor_arg_type);
 #endif  /* EXPAND_ARGS_FIELD */
 
 #ifdef  EXPAND_ONE_ARG
   #ifdef    EXPAND_NAMED_ARG
-            if (type_ctor_info->type_layout.layout_notag
+            if (MR_type_ctor_layout(type_ctor_info).layout_notag
                     ->MR_notag_functor_arg_name != NULL
-               && streq(chosen_name, type_ctor_info->type_layout.layout_notag
-                    ->MR_notag_functor_arg_name))
+               && streq(chosen_name, MR_type_ctor_layout(type_ctor_info).
+		    layout_notag->MR_notag_functor_arg_name))
             {
                 chosen = 0;
             }
@@ -516,8 +517,9 @@
                 expand_info->chosen_index_exists = TRUE;
                 expand_info->chosen_value_ptr = data_word_ptr;
                 expand_info->chosen_type_info =
-                MR_pseudo_type_info_is_ground(type_ctor_info->
-                    type_layout.layout_notag->MR_notag_functor_arg_type);
+                MR_pseudo_type_info_is_ground(
+                    MR_type_ctor_layout(type_ctor_info).layout_notag
+		    ->MR_notag_functor_arg_type);
             } else {
                 expand_info->chosen_index_exists = FALSE;
             }
@@ -530,7 +532,7 @@
 
                 eqv_type_info = MR_create_type_info(
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                    type_ctor_info->type_layout.layout_equiv);
+                    MR_type_ctor_layout(type_ctor_info).layout_equiv);
                 EXPAND_FUNCTION_NAME(eqv_type_info, data_word_ptr,
                     EXTRA_ARGS expand_info);
             }
@@ -538,7 +540,7 @@
 
         case MR_TYPECTOR_REP_EQUIV_GROUND:
             EXPAND_FUNCTION_NAME(MR_pseudo_type_info_is_ground(
-                type_ctor_info->type_layout.layout_equiv),
+                MR_type_ctor_layout(type_ctor_info).layout_equiv),
                 data_word_ptr, EXTRA_ARGS expand_info);
             break;
 
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.45
diff -u -b -r1.45 mercury_tabling.c
--- runtime/mercury_tabling.c	2001/12/31 04:26:51	1.45
+++ runtime/mercury_tabling.c	2002/01/08 03:12:00
@@ -1,5 +1,8 @@
 /*
-** Copyright (C) 1997-2001 The University of Melbourne.
+** vim: ts=4 sw=4 expandtab
+*/
+/*
+** Copyright (C) 1997-2002 The University of Melbourne.
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
 */
@@ -586,7 +589,7 @@
 			type_info);
 		node = MR_int_hash_lookup_or_add(node, arity);
 	} else {
-		arity = type_ctor_info->arity;
+                arity = type_ctor_info->MR_type_ctor_arity;
 		arg_vector = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
 	}
 
@@ -634,7 +637,7 @@
         case MR_TYPECTOR_REP_ENUM: 
         case MR_TYPECTOR_REP_ENUM_USEREQ: 
             MR_DEBUG_TABLE_ENUM(table,
-                    type_ctor_info->type_ctor_num_functors, data);
+                    MR_type_ctor_num_functors(type_ctor_info), data);
             break;
 
         case MR_TYPECTOR_REP_RESERVED_ADDR: 
@@ -642,7 +645,7 @@
 	    {
 		int i;
 		MR_ReservedAddrTypeLayout ra_layout =
-			    type_ctor_info->type_layout.layout_reserved_addr;
+                            MR_type_ctor_layout(type_ctor_info).layout_reserved_addr;
 
 		/*
 		** First check if this value is one of
@@ -652,7 +655,7 @@
 		    (MR_Unsigned) ra_layout->MR_ra_num_res_numeric_addrs)
 		{
 		    MR_DEBUG_TABLE_ENUM(table,
-                        type_ctor_info->type_ctor_num_functors,
+                        MR_type_ctor_num_functors(type_ctor_info),
                         ra_layout->MR_ra_constants[data]->MR_ra_functor_ordinal);
 		    break;
 		}
@@ -665,7 +668,7 @@
 		    if (data == (MR_Word) ra_layout->MR_ra_res_symbolic_addrs[i]) {
 			int offset = i + ra_layout->MR_ra_num_res_numeric_addrs;
 			MR_DEBUG_TABLE_ENUM(table,
-			    type_ctor_info->type_ctor_num_functors,
+                            MR_type_ctor_num_functors(type_ctor_info),
 			    ra_layout->MR_ra_constants[offset]->
 			    	MR_ra_functor_ordinal);
 			/* "break" here would just exit the "for" loop */
@@ -684,7 +687,7 @@
             
         case MR_TYPECTOR_REP_DU: 
         case MR_TYPECTOR_REP_DU_USEREQ: 
-	    du_type_layout = type_ctor_info->type_layout.layout_du;
+            du_type_layout = MR_type_ctor_layout(type_ctor_info).layout_du;
 	    /* fall through */
 	
 	/*
@@ -732,7 +735,7 @@
                 }
 
                 MR_DEBUG_TABLE_ENUM(table,
-                        type_ctor_info->type_ctor_num_functors,
+                        MR_type_ctor_num_functors(type_ctor_info),
                         functor_desc->MR_du_functor_ordinal);
 
                 exist_info = functor_desc->MR_du_functor_exist_info;
@@ -790,7 +793,7 @@
 
                 eqv_type_info = MR_make_type_info(
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                    type_ctor_info->type_layout.layout_notag->
+                    MR_type_ctor_layout(type_ctor_info).layout_notag->
                         MR_notag_functor_arg_type, &allocated_memory_cells);
                 MR_DEBUG_TABLE_ANY(table, eqv_type_info, data);
                 MR_deallocate(allocated_memory_cells);
@@ -800,7 +803,7 @@
         case MR_TYPECTOR_REP_NOTAG_GROUND: 
         case MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ:
             MR_DEBUG_TABLE_ANY(table, MR_pseudo_type_info_is_ground(
-                type_ctor_info->type_layout.layout_notag->
+                MR_type_ctor_layout(type_ctor_info).layout_notag->
                 MR_notag_functor_arg_type), data);
             break;
 
@@ -811,7 +814,7 @@
 
                 eqv_type_info = MR_make_type_info(
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                    type_ctor_info->type_layout.layout_equiv,
+                    MR_type_ctor_layout(type_ctor_info).layout_equiv,
                     &allocated_memory_cells);
                 MR_DEBUG_TABLE_ANY(table, eqv_type_info, data);
                 MR_deallocate(allocated_memory_cells);
@@ -820,7 +823,7 @@
 
         case MR_TYPECTOR_REP_EQUIV_GROUND:
             MR_DEBUG_TABLE_ANY(table, MR_pseudo_type_info_is_ground(
-                type_ctor_info->type_layout.layout_equiv), data);
+                MR_type_ctor_layout(type_ctor_info).layout_equiv), data);
             break;
 
         case MR_TYPECTOR_REP_EQUIV_VAR:
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.44
diff -u -b -r1.44 mercury_type_info.c
--- runtime/mercury_type_info.c	2001/12/31 04:26:51	1.44
+++ runtime/mercury_type_info.c	2002/01/08 03:14:34
@@ -215,7 +215,7 @@
 		arg_vector_2 = MR_TYPEINFO_GET_HIGHER_ORDER_ARG_VECTOR(
 				type_info_2);
 	} else {
-		num_arg_types = type_ctor_info_1->arity;
+		num_arg_types = type_ctor_info_1->MR_type_ctor_arity;
 		arg_vector_1 = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(
 				type_info_1);
 		arg_vector_2 = MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(
@@ -259,7 +259,7 @@
 		maybe_equiv_type_info = MR_create_type_info(
 				MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(
 					maybe_equiv_type_info),
-				type_ctor_info->type_layout.layout_equiv);
+				MR_type_ctor_layout(type_ctor_info).layout_equiv);
 
 		type_ctor_info = MR_TYPEINFO_GET_TYPE_CTOR_INFO(
 				maybe_equiv_type_info);
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.80
diff -u -b -r1.80 mercury_type_info.h
--- runtime/mercury_type_info.h	2002/01/17 11:34:04	1.80
+++ runtime/mercury_type_info.h	2002/01/17 11:54:37
@@ -1,4 +1,7 @@
 /*
+** vim: ts=4 sw=4 expandtab
+*/
+/*
 ** Copyright (C) 1995-2002 The University of Melbourne.
 ** This file may only be copied under the terms of the GNU Library General
 ** Public License - see the file COPYING.LIB in the Mercury distribution.
@@ -68,11 +71,12 @@
 ** compiler/type_ctor_info.m.
 */
 
-#define MR_RTTI_VERSION                 MR_RTTI_VERSION__VERSION_NO
+#define MR_RTTI_VERSION                 MR_RTTI_VERSION__COMPACT
 #define MR_RTTI_VERSION__INITIAL        2
 #define MR_RTTI_VERSION__USEREQ         3
 #define MR_RTTI_VERSION__CLEAN_LAYOUT   4
 #define MR_RTTI_VERSION__VERSION_NO     5
+#define MR_RTTI_VERSION__COMPACT        6
 
 /*
 ** Check that the RTTI version is in a sensible range.
@@ -83,7 +87,16 @@
 */
 
 #define MR_TYPE_CTOR_INFO_CHECK_RTTI_VERSION_RANGE(typector)    \
-    assert(typector->type_ctor_old_version == MR_RTTI_VERSION__VERSION_NO)
+    ( assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__VERSION_NO) \
+    || assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__COMPACT))
+
+/*---------------------------------------------------------------------------*/
+
+#ifdef  MR_BOOTSTRAP_TYPE_CTOR_COMPACT
+  #define       MR_TypeCtorInfo_Struct  MR_NewTypeCtorInfo_Struct
+#else
+  #define       MR_TypeCtorInfo_Struct  MR_OldTypeCtorInfo_Struct
+#endif
 
 /*---------------------------------------------------------------------------*/
 
@@ -319,82 +332,6 @@
 		(MR_TypeInfo)     (ti2)					\
 	};
 
-/*
-** Used to define MR_TypeCtorInfos for the builtin types in the hlc grades.
-** This needs to be exported for use by the array type in the library.
-*/
-
-#ifdef MR_HIGHLEVEL_CODE
-
-  #define MR_builtin_type_ctor_info_name(TYPE, ARITY)			      \
-		MR_type_ctor_info_name(builtin, TYPE, ARITY)
-
-  #define MR_type_ctor_info_name(MODULE, TYPE, ARITY)			      \
-	MR_PASTE2(mercury__,						      \
-	MR_PASTE2(MODULE,						      \
-	MR_PASTE2(__,							      \
-	MR_PASTE2(MODULE,						      \
-	MR_PASTE2(__type_ctor_info_,					      \
-	MR_PASTE2(TYPE,							      \
-	MR_PASTE2(_,							      \
-	          ARITY)))))))
-
-  #define MR_type_ctor_info_func_name(MODULE, TYPE, ARITY, FUNC)	      \
-	MR_PASTE2(mercury__,						      \
-	MR_PASTE2(MODULE,						      \
-	MR_PASTE2(__,							      \
-	MR_PASTE2(FUNC,							      \
-	MR_PASTE2(__,							      \
-	MR_PASTE2(TYPE,							      \
-	MR_PASTE2(_,							      \
-	MR_PASTE2(ARITY,						      \
-	          _0))))))))
-
-  #define MR_special_func_type(NAME, ARITY) \
-	MR_PASTE2(MR_, MR_PASTE2(NAME, MR_PASTE2(Func_, ARITY)))
-
-    #define MR_define_type_ctor_info(module, type, arity, type_rep)	      \
-	const struct MR_TypeCtorInfo_Struct				      \
-		MR_type_ctor_info_name(module, type, arity) =		      \
-	{								      \
-		arity,							      \
-		MR_RTTI_VERSION,					      \
-		type_rep,						      \
-		-1,							      \
-		(MR_Box) MR_type_ctor_info_func_name(module, type, arity,     \
-				do_unify),				      \
-		(MR_Box) MR_type_ctor_info_func_name(module, type, arity,     \
-				do_compare),				      \
-		type_rep,						      \
-		NULL,							      \
-		NULL,							      \
-		MR_STRINGIFY(module),					      \
-		MR_STRINGIFY(type),					      \
-		MR_RTTI_VERSION,					      \
-		{ 0 },							      \
-		{ 0 },							      \
-		-1							      \
-	}
-
-#else /* MR_HIGHLEVEL_CODE */
-
-  #define MR_builtin_type_ctor_info_name(TYPE, ARITY)			      \
-	MR_PASTE2(mercury_data_,					      \
-	MR_PASTE2(__type_ctor_info_,					      \
-	MR_PASTE2(TYPE,							      \
-	MR_PASTE2(_,							      \
-		 ARITY))))
-
-  #define MR_type_ctor_info_name(MODULE, TYPE, ARITY)			      \
-	MR_PASTE2(mercury_data_,					      \
-	MR_PASTE2(MODULE,						      \
-	MR_PASTE2(__type_ctor_info_,					      \
-	MR_PASTE2(TYPE,							      \
-	MR_PASTE2(_,							      \
-		 ARITY)))))
-
-#endif /* MR_HIGHLEVEL_CODE */
-
 /*---------------------------------------------------------------------------*/
 
 /*
@@ -848,7 +785,7 @@
 typedef struct {
     MR_int_least32_t        MR_sectag_sharers;
     MR_Sectag_Locn          MR_sectag_locn;
-    const MR_DuFunctorDesc * const * MR_sectag_alternatives;
+    const MR_DuFunctorDesc * const *MR_sectag_alternatives;
 } MR_DuPtagLayout;
 
 typedef const MR_DuPtagLayout *MR_DuTypeLayout;
@@ -1010,32 +947,76 @@
     ** `:- type' declaration.
     */
 
-struct MR_TypeCtorInfo_Struct {
-    MR_Integer          arity;
+struct MR_OldTypeCtorInfo_Struct {
+    MR_Integer          MR_type_ctor_arity;
     MR_int_least8_t     MR_type_ctor_version;
     MR_TypeCtorRepInt   MR_type_ctor_rep_CAST_ME;
     MR_int_least8_t     MR_type_ctor_num_ptags;		/* if DU */
-    MR_ProcAddr         unify_pred;
-    MR_ProcAddr         compare_pred;
+    MR_ProcAddr         MR_type_ctor_unify_pred;
+    MR_ProcAddr         MR_type_ctor_compare_pred;
     MR_Integer          MR_type_ctor_old_rep_CAST_ME;	/* unused */
     MR_ProcAddr         MR_unused1;	/* spare */
     MR_ProcAddr         MR_unused2;	/* spare */
-    MR_ConstString      type_ctor_module_name;
-    MR_ConstString      type_ctor_name;
-    MR_Integer          MR_type_ctor_old_version;	/* unused */
-    MR_TypeFunctors     type_functors;
-    MR_TypeLayout       type_layout;
-    MR_int_least32_t    type_ctor_num_functors;
+    MR_ConstString      MR_xtype_ctor_module_name;
+    MR_ConstString      MR_xtype_ctor_name;
+    MR_Integer          MR_xtype_ctor_old_version;       /* unused */
+    MR_TypeFunctors     MR_xtype_ctor_functors;
+    MR_TypeLayout       MR_xtype_ctor_layout;
+    MR_int_least32_t    MR_xtype_ctor_num_functors;
+};
 
+struct MR_NewTypeCtorInfo_Struct {
+    MR_Integer          MR_type_ctor_arity;
+    MR_int_least8_t     MR_type_ctor_version;
+    MR_TypeCtorRepInt   MR_type_ctor_rep_CAST_ME;
+    MR_int_least8_t     MR_type_ctor_num_ptags;         /* if DU */
+    MR_ProcAddr         MR_type_ctor_unify_pred;
+    MR_ProcAddr         MR_type_ctor_compare_pred;
+    MR_ConstString      MR_xtype_ctor_module_name;
+    MR_ConstString      MR_xtype_ctor_name;
+    MR_TypeFunctors     MR_xtype_ctor_functors;
+    MR_TypeLayout       MR_xtype_ctor_layout;
+    MR_int_least32_t    MR_xtype_ctor_num_functors;
+
 /*
 ** The following fields will be added later, once we can exploit them:
 **  union MR_TableNode_Union    **type_std_table;
 **  MR_ProcAddr         prettyprinter;
 */
 };
+
+#define MR_type_ctor_rep(tci)                                               \
+    ((MR_TypeCtorRep) (tci)->MR_type_ctor_rep_CAST_ME)
 
-#define	MR_type_ctor_rep(type_ctor_info)			\
-		((MR_TypeCtorRep) ((type_ctor_info))->MR_type_ctor_rep_CAST_ME)
+#define MR_type_ctor_module_name(tci)                                       \
+    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
+        MR_RTTI_VERSION__COMPACT) ?                                         \
+        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_module_name):\
+        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_module_name))
+
+#define MR_type_ctor_name(tci)                                              \
+    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
+        MR_RTTI_VERSION__COMPACT) ?                                         \
+        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_name) :  \
+        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_name))
+
+#define MR_type_ctor_functors(tci)                                          \
+    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
+        MR_RTTI_VERSION__COMPACT) ?                                         \
+        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_functors) :\
+        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_functors))
+
+#define MR_type_ctor_layout(tci)                                            \
+    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
+        MR_RTTI_VERSION__COMPACT) ?                                         \
+        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_layout) :\
+        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_layout))
+
+#define MR_type_ctor_num_functors(tci)                                      \
+    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
+        MR_RTTI_VERSION__COMPACT) ?                                         \
+        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_num_functors) :\
+        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_num_functors))
 
 /*---------------------------------------------------------------------------*/
 
@@ -1063,26 +1044,47 @@
 
 #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_TYPE				\
     MR_STATIC_CODE_CONST struct MR_TypeCtorInfo_Struct
+
+#ifdef MR_BOOTSTRAP_TYPE_CTOR_COMPACT
 
-#define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_BODY(m, n, a, cr, u, c)	\
+  #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_BODY(m, n, a, cr, u, c)      \
     {									\
 	a,								\
-	MR_RTTI_VERSION,						\
+        MR_RTTI_VERSION__COMPACT,                                       \
 	cr,								\
 	-1,								\
 	MR_MAYBE_STATIC_CODE(MR_ENTRY(u)),				\
 	MR_MAYBE_STATIC_CODE(MR_ENTRY(c)),				\
+        MR_string_const(MR_STRINGIFY(m), sizeof(MR_STRINGIFY(m))-1),    \
+        MR_string_const(MR_STRINGIFY(n), sizeof(MR_STRINGIFY(n))-1),    \
+        { 0 },                                                          \
+        { 0 },                                                          \
+        -1                                                              \
+    }
+
+#else
+
+  #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_BODY(m, n, a, cr, u, c)      \
+    {                                                                   \
+        a,                                                              \
+        MR_RTTI_VERSION__VERSION_NO,                                    \
 	cr,								\
+        -1,                                                             \
+        MR_MAYBE_STATIC_CODE(MR_ENTRY(u)),                              \
+        MR_MAYBE_STATIC_CODE(MR_ENTRY(c)),                              \
+        cr,                                                             \
 	NULL,								\
 	NULL,								\
 	MR_string_const(MR_STRINGIFY(m), sizeof(MR_STRINGIFY(m))-1),	\
 	MR_string_const(MR_STRINGIFY(n), sizeof(MR_STRINGIFY(n))-1),	\
-	MR_RTTI_VERSION,						\
+        MR_RTTI_VERSION__VERSION_NO,                                    \
 	{ 0 },								\
 	{ 0 },								\
 	-1								\
     }
 
+#endif
+
 #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_PRED(m, n, a, cr, u, c)	\
 	MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(m, m, n, a, cr, u, c)
 
@@ -1096,6 +1098,103 @@
 		mercury__unused_0_0,                                   	\
 		mercury__unused_0_0)
 
+/*
+** Used to define MR_TypeCtorInfos for the builtin types in the hlc grades.
+** This needs to be exported for use by the array type in the library.
+*/
+
+#ifdef MR_HIGHLEVEL_CODE
+
+  #define MR_builtin_type_ctor_info_name(TYPE, ARITY)                   \
+    MR_type_ctor_info_name(builtin, TYPE, ARITY)
+
+  #define MR_type_ctor_info_name(MODULE, TYPE, ARITY)                   \
+    MR_PASTE2(mercury__,                                                \
+    MR_PASTE2(MODULE,                                                   \
+    MR_PASTE2(__,                                                       \
+    MR_PASTE2(MODULE,                                                   \
+    MR_PASTE2(__type_ctor_info_,                                        \
+    MR_PASTE2(TYPE,                                                     \
+    MR_PASTE2(_, ARITY)))))))
+
+  #define MR_type_ctor_info_func_name(MODULE, TYPE, ARITY, FUNC)        \
+    MR_PASTE2(mercury__,                                                \
+    MR_PASTE2(MODULE,                                                   \
+    MR_PASTE2(__,                                                       \
+    MR_PASTE2(FUNC,                                                     \
+    MR_PASTE2(__,                                                       \
+    MR_PASTE2(TYPE,                                                     \
+    MR_PASTE2(_,                                                        \
+    MR_PASTE2(ARITY, _0))))))))
+
+  #define MR_special_func_type(NAME, ARITY)                             \
+	MR_PASTE2(MR_, MR_PASTE2(NAME, MR_PASTE2(Func_, ARITY)))
+
+  #ifdef MR_BOOTSTRAP_TYPE_CTOR_COMPACT
+
+    #define MR_define_type_ctor_info(module, type, arity, type_rep)         \
+        const struct MR_TypeCtorInfo_Struct                                 \
+            MR_type_ctor_info_name(module, type, arity) =                   \
+        {                                                                   \
+            arity,                                                          \
+            MR_RTTI_VERSION__COMPACT,                                       \
+            type_rep,                                                       \
+            -1,                                                             \
+            (MR_Box) MR_type_ctor_info_func_name(module, type, arity,       \
+                            do_unify),                                      \
+            (MR_Box) MR_type_ctor_info_func_name(module, type, arity,       \
+                            do_compare),                                    \
+            MR_STRINGIFY(module),                                           \
+            MR_STRINGIFY(type),                                             \
+            { 0 },                                                          \
+            { 0 },                                                          \
+            -1                                                              \
+        }
+
+  #else /* MR_BOOTSTRAP_TYPE_CTOR_COMPACT */
+
+    #define MR_define_type_ctor_info(module, type, arity, type_rep)         \
+        const struct MR_TypeCtorInfo_Struct                                 \
+            MR_type_ctor_info_name(module, type, arity) =                   \
+        {                                                                   \
+            arity,                                                          \
+            MR_RTTI_VERSION__VERSION_NO,                                    \
+            type_rep,                                                       \
+            -1,                                                             \
+            (MR_Box) MR_type_ctor_info_func_name(module, type, arity,       \
+                            do_unify),                                      \
+            (MR_Box) MR_type_ctor_info_func_name(module, type, arity,       \
+                            do_compare),                                    \
+            type_rep,                                                       \
+            NULL,                                                           \
+            NULL,                                                           \
+            MR_STRINGIFY(module),                                           \
+            MR_STRINGIFY(type),                                             \
+            MR_RTTI_VERSION__VERSION_NO,                                    \
+            { 0 },                                                          \
+            { 0 },                                                          \
+            -1                                                              \
+        }
+
+  #endif /* MR_BOOTSTRAP_TYPE_CTOR_COMPACT */
+
+#else /* MR_HIGHLEVEL_CODE */
+
+  #define MR_builtin_type_ctor_info_name(TYPE, ARITY)			            \
+	MR_PASTE2(mercury_data_,					                            \
+	MR_PASTE2(__type_ctor_info_,					                        \
+	MR_PASTE2(TYPE,							                                \
+	MR_PASTE2(_, ARITY))))
+
+  #define MR_type_ctor_info_name(MODULE, TYPE, ARITY)			            \
+	MR_PASTE2(mercury_data_,					                            \
+	MR_PASTE2(MODULE,						                                \
+	MR_PASTE2(__type_ctor_info_,					                        \
+	MR_PASTE2(TYPE,							                                \
+	MR_PASTE2(_, ARITY)))))
+
+#endif /* MR_HIGHLEVEL_CODE */
+
 /*---------------------------------------------------------------------------*/
 
 /*
Index: runtime/mercury_type_tables.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_tables.c,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_type_tables.c
--- runtime/mercury_type_tables.c	2000/11/23 02:00:49	1.5
+++ runtime/mercury_type_tables.c	2002/01/08 03:14:00
@@ -26,14 +26,14 @@
 static	MR_TableNode	MR_type_ctor_table = { 0 };
 
 #define	names_match(tc1, module_name, type_name, arity)			\
-	( streq(tc1->type_ctor_name, type_name)				\
-	&& streq(tc1->type_ctor_module_name, module_name)		\
-	&& tc1->arity == arity)
+	( streq(MR_type_ctor_name(tc1), type_name)			\
+	&& streq(MR_type_ctor_module_name(tc1), module_name)		\
+	&& tc1->MR_type_ctor_arity == arity)
 
 #define	names_match_tc(tc1, tc2)					\
-	( streq(tc1->type_ctor_name, tc2->type_ctor_name)		\
-	&& streq(tc1->type_ctor_module_name, tc2->type_ctor_module_name)\
-	&& tc1->arity == tc2->arity )
+	( streq(MR_type_ctor_name(tc1), MR_type_ctor_name(tc2))		\
+	&& streq(MR_type_ctor_module_name(tc1), MR_type_ctor_module_name(tc2))\
+	&& tc1->MR_type_ctor_arity == tc2->MR_type_ctor_arity )
 
 void
 MR_register_type_ctor_info(MR_TypeCtorInfo type_ctor_info)
@@ -43,7 +43,7 @@
 	MR_TypeCtorInfo	cur_type_ctor_info;
 
 	slot = MR_string_hash_lookup_or_add(&MR_type_ctor_table,
-			type_ctor_info->type_ctor_name);
+			MR_type_ctor_name(type_ctor_info));
 
 	MR_for_dlist (element_ptr, slot->MR_type_table) {
 		cur_type_ctor_info =
Index: runtime/mercury_unify_compare_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_unify_compare_body.h,v
retrieving revision 1.13
diff -u -b -r1.13 mercury_unify_compare_body.h
--- runtime/mercury_unify_compare_body.h	2001/12/31 04:26:53	1.13
+++ runtime/mercury_unify_compare_body.h	2002/01/08 03:08:05
@@ -56,12 +56,12 @@
             MR_save_transient_hp();
             type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                type_ctor_info->type_layout.layout_equiv);
+                MR_type_ctor_layout(type_ctor_info).layout_equiv);
             MR_restore_transient_hp();
             goto start_label;
 
         case MR_TYPECTOR_REP_EQUIV_GROUND:
-            type_info = (MR_TypeInfo) type_ctor_info->type_layout.layout_equiv;
+            type_info = (MR_TypeInfo) MR_type_ctor_layout(type_ctor_info).layout_equiv;
             goto start_label;
 
         case MR_TYPECTOR_REP_EQUIV_VAR:
@@ -71,13 +71,13 @@
             MR_save_transient_hp();
             type_info = MR_create_type_info(
                 MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info),
-                type_ctor_info->type_layout.layout_notag->
+                MR_type_ctor_layout(type_ctor_info).layout_notag->
                 MR_notag_functor_arg_type);
             MR_restore_transient_hp();
             goto start_label;
 
         case MR_TYPECTOR_REP_NOTAG_GROUND:
-            type_info = (MR_TypeInfo) type_ctor_info->type_layout.
+            type_info = (MR_TypeInfo) MR_type_ctor_layout(type_ctor_info).
                 layout_notag->MR_notag_functor_arg_type;
             goto start_label;
 
@@ -117,7 +117,7 @@
                     int                     sectag;                           \
                                                                               \
                     ptag = MR_tag(data);                                      \
-                    ptaglayout = &type_ctor_info->type_layout.layout_du[ptag];\
+                    ptaglayout = &MR_type_ctor_layout(type_ctor_info).layout_du[ptag];\
                     data_value = (MR_Word *) MR_body(data, ptag);             \
                                                                               \
                     switch (ptaglayout->MR_sectag_locn) {                     \
@@ -164,7 +164,7 @@
                     return_answer(FALSE);
                 }
 
-                ptaglayout = &type_ctor_info->type_layout.layout_du[x_ptag];
+                ptaglayout = &MR_type_ctor_layout(type_ctor_info).layout_du[x_ptag];
                 x_data_value = (MR_Word *) MR_body(x, x_ptag);
                 y_data_value = (MR_Word *) MR_body(y, y_ptag);
 
@@ -322,12 +322,12 @@
             ** may be worthwhile.
             */
 
-            if (type_ctor_info->arity == 0) {
+            if (type_ctor_info->MR_type_ctor_arity == 0) {
                 MR_r1 = x;
                 MR_r2 = y;
             }
 #ifdef  MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_1
-            else if (type_ctor_info->arity == 1) {
+            else if (type_ctor_info->MR_type_ctor_arity == 1) {
                 MR_Word    *args_base;
 
                 args_base = (MR_Word *)
@@ -338,7 +338,7 @@
             }
 #endif
 #ifdef  MR_UNIFY_COMPARE_BY_CTOR_REP_SPEC_2
-            else if (type_ctor_info->arity == 2) {
+            else if (type_ctor_info->MR_type_ctor_arity == 2) {
                 MR_Word    *args_base;
 
                 args_base = (MR_Word *)
@@ -354,7 +354,7 @@
                 int     type_arity;
                 MR_Word *args_base;
 
-                type_arity = type_ctor_info->arity;
+                type_arity = type_ctor_info->MR_type_ctor_arity;
                 args_base = (MR_Word *)
                     MR_TYPEINFO_GET_FIRST_ORDER_ARG_VECTOR(type_info);
                 MR_save_registers();
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
Index: tests/hard_coded/type_tables.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/type_tables.m,v
retrieving revision 1.3
diff -u -b -r1.3 type_tables.m
--- tests/hard_coded/type_tables.m	2000/11/25 10:42:04	1.3
+++ tests/hard_coded/type_tables.m	2002/01/08 14:00:07
@@ -14,9 +14,13 @@
 
 :- type list	--->	a ; b.
 
-:- pragma(c_code, main(IO0::di, IO::uo), "
+:- pragma foreign_decl("C", "
 extern const struct MR_TypeCtorInfo_Struct mercury_data_list__type_ctor_info_list_1;
 extern const struct MR_TypeCtorInfo_Struct mercury_data_type_tables__type_ctor_info_list_0;
+").
+
+:- pragma foreign_proc("C", main(IO0::di, IO::uo), [will_not_call_mercury],
+"
 	MR_TypeCtorInfo	tc1;
 	MR_TypeCtorInfo	tc2;
 
@@ -26,7 +30,11 @@
 	tc1 = MR_lookup_type_ctor_info(""list"", ""list"", 1);
 	tc2 = MR_lookup_type_ctor_info(""type_tables"", ""list"", 0);
 
-	printf(""%s %s\\n"", tc1->type_ctor_module_name, tc1->type_ctor_name);
-	printf(""%s %s\\n"", tc2->type_ctor_module_name, tc2->type_ctor_name);
+	printf(""%s %s\\n"",
+		MR_type_ctor_module_name(tc1),
+		MR_type_ctor_name(tc1));
+	printf(""%s %s\\n"",
+		MR_type_ctor_module_name(tc2),
+		MR_type_ctor_name(tc2));
 	IO = IO0;
 ").
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
Index: trace/mercury_trace.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace.c,v
retrieving revision 1.45
diff -u -b -r1.45 mercury_trace.c
--- trace/mercury_trace.c	2001/12/04 00:44:38	1.45
+++ trace/mercury_trace.c	2002/01/08 05:02:02
@@ -883,8 +883,8 @@
 
 	type_ctor_info = MR_PSEUDO_TYPEINFO_GET_TYPE_CTOR_INFO(pti);
 
-	return (streq(type_ctor_info->type_ctor_module_name, "io")
-		&& streq(type_ctor_info->type_ctor_name, "state"));
+	return (streq(MR_type_ctor_module_name(type_ctor_info), "io")
+		&& streq(MR_type_ctor_name(type_ctor_info), "state"));
 }
 
 static bool
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