[m-rev.] for review: a step towards Mercury-level RTTI for Java and IL

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Aug 1 17:59:45 AEST 2002


On 27-Jun-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > +:- type type_ctor_details
> > +	--->	enum(
> > +			enum_axioms		:: equality_axioms,
> > +			enum_functors		:: list(enum_functor),
> > +			enum_value_table	:: map(int, enum_functor),
> > +			enum_name_table		:: map(string, enum_functor)
> > +		)
> > +	;	du(
> > +			du_axioms		:: equality_axioms,
> > +			du_functors		:: list(du_functor),
> > +			du_value_table		:: ptag_map,
> > +			du_name_table		:: map(string, map(int,
> > +							du_functor))
> > +		)
> > +	;	reserved(
> > +			res_axioms		:: equality_axioms,
> > +			res_functors		:: list(maybe_reserved_functor),
> > +			res_value_table_res	:: list(reserved_functor),
> > +			res_value_table_du	:: ptag_map,
> > +			res_name_table		:: map(string, map(int,
> > +							maybe_reserved_functor))
> > +		)
> > +	;	notag(
> > +			notag_axioms		:: equality_axioms,
> > +			notag_functor		:: notag_functor
> > +		)
> 
> A short description of these four alternatives added above would be useful.

Done.

> > +	% Descriptor for a functor in reserved address type.
> > +	%
> > +	% This type mostly corresponds to the C union
> > +	% MR_MaybeResAddrFunctorDesc.
> 
> Why only mostly corresponds to MR_MaybeResAddrFunctorDesc?  A
> description of why would be useful.

Done.

> > +	% Describes the types of the existentially types arguments of a
> > +	% discriminated union functor.
> > +	%
> > +	% This type corresponds to the C type MR_DuExistInfo.
> 
> s/existentially types/existentially typed/

Done.

> > +output_du_arg_types(RttiTypeCtor, Ordinal, ArgTypes, DeclSet0, DeclSet) -->
> > +	list__foldl2(output_maybe_pseudo_type_info_or_self_defn, ArgTypes,
> >  		DeclSet0, DeclSet1),
> > +	{ ArgTypeDatas = list__map(maybe_pseudo_type_info_or_self_to_rtti_data,
> > +		ArgTypes) },
> > +	output_rtti_datas_decls(ArgTypeDatas, "", "", 0, _,
> >  		DeclSet1, DeclSet2),
> > +	output_generic_rtti_data_defn_start(RttiTypeCtor, field_types(Ordinal),
> > +		DeclSet2, DeclSet),
> > +	io__write_string(" = {\n"),
> > +	{ ArgRttiDatas = list__map(maybe_pseudo_type_info_or_self_to_rtti_data,
> > +		ArgTypes) },
> >  	output_cast_addr_of_rtti_datas("(MR_PseudoTypeInfo) ", ArgRttiDatas),
> > +	io__write_string("};\n").
> > +
> Could this list be empty?  If so you need to put a dummy entry in here.

No, it can't. This is tested in the caller.

> > +:- pred output_du_arg_names(rtti_type_ctor::in, int::in,
> > +	list(maybe(string))::in, decl_set::in, decl_set::out,
> > +	io__state::di, io__state::uo) is det.
> > +
> > +output_du_arg_names(RttiTypeCtor, Ordinal, MaybeNames, DeclSet0, DeclSet) -->
> > +	output_generic_rtti_data_defn_start(RttiTypeCtor, field_names(Ordinal),
> > +		DeclSet0, DeclSet),
> > +	io__write_string(" = {\n"),
> > +	output_maybe_quoted_strings(MaybeNames),
> > +	io__write_string("};\n").
> > +
> Again what if there is are no names?

Again, empty lists are handled in the caller.

> Maybe it would be a good idea for each place where we output an array to check
> that the array isn't empty.  Maybe some sort of utility predicate, which takes
> as an argument the dummy value to put output.

Done.

> > @@ -689,22 +1109,25 @@
> >  % the type names mentioned here should be defined in runtime/mercury.h
> >  % (or in some header file that is included by that one)
> >  
> > +% XXX factor out code common with rtti_name_c_type in rtti_out.m
> > +% XXX check res_addr entries
> 
> Have you checked this?

I had checked them for correctness before submitting the original diff,
but did not factor out the common code. I have now done so; see the following
relative diff.

> > +:- func compute_contains_var_bit_vector(
> > +	list(rtti_maybe_pseudo_type_info_or_self)) = int.
> > +
> 
> A comment explaining what this function does would be useful.

Done.

> >  			% We treat foreign_types as equivalent to the
> >  			% type builtin__c_pointer.
> 
> This comment needs to be removed.

Done.

> > +		require(unify(ArgInfos, []),
> > +			"type_ctor_info__make_maybe_res_functors: bad arsg"),
> 
> s/arsg/args/

Done.

> > +:- func map__init_singleton(K, V) = map(K, V).
> 
> This change is not mentioned in the log message.  The added predicate
> should also be documented in the NEWS file.

I originally intended to add it separately, but after the comments by Simon and
Ralph, I have deleted it instead.

The updated log message and the relative diff follow. I will commit this
tomorrow afternoon if noone objects before then.

Zoltan.

Another step towards RTTI in Mercury.

This step redefines the representation of type_ctor_infos inside the compiler
to be identical to the representation we will need for efficient interpretation
of RTTI data structures in Mercury, following on from an earlier step which
did the same for (pseudo)typeinfos.

Instead of the type_ctor_info being broken down into its components in
type_ctor_info.m, the breakdown process is now performed in rtti_out.m (for the
LLDS backend) and rtti_to_mlds.m (for the MLDS backend). Eventually, the IL and
Java backends will stop using rtti_to_mlds.m for this purpose, and will instead
write out the type_ctor_data structures as static data to be interpreted
directly.

We now predefine the C types representing type_info and pseudo_type_infos
for types of arity up to 20 for the LLDS C backend as well as for the
MLDS C backend. The LLDS backend can define them for higher arities
on demand; the MLDS backend (for now) still cannot.

runtime/mercury_type_info.h:
	To be able to represent all the kinds of types we now support
	
	- add a data structure for converting values of reserved_addr types
	  from their printable representation to their internal representation
	  (it was previously missing), and

	- add a type_ctor_rep to represent foreign types.

	Add missing MR_ prefixes on some field names.

	Add typedefs for all the types that the rtti_names can refer to.
	There were already such typedefs in runtime/mercury.h for the MLDS
	grades, we now have them for the LLDS grades too.

	Predefine the C types representing type_info and pseudo_type_infos
	for types of arity up to 20. There were already such typedefs in
	runtime/mercury.h for the MLDS grades, we now have them for the
	LLDS grades too.

runtime/mercury.h:
	Delete the typedefs that are now in mercury_type_info.h.

runtime/mercury.h:
	Delete the definitions of the C types representing type_info and
	pseudo_type_infos, since these are now in mercury_type_info.h.
	#include mercury_type_info.h.

compiler/rtti.m:
	Add new, purely Mercury data structures for representing
	type_ctor_infos and their components, designed both for efficient
	interpretation and as a source for the generation of static data
	structures in C.

	This entailed deleting most of the alternatives of the rtti_data type
	while preserving their rtti_name equivalents; the deleted alternatives
	represent tables are no longer created in type_ctor_info.m but which
	are created dynamically in rtti_out.m and rtti_to_mlds.m (which need
	a way for one table to refer to another).

	Centralize the correspondence between rtti_names and the C and Java
	types of the corresponding structures (the C and Java names differ in
	prefixes only). Among other things, this remove the double maintenance 
	problem we have previously with the LLDS and MLDS backends maintaining
	their own maps of the correspondence.

	Add utility predicates on the new data structures for use by both
	rtti_out.m and rtti_to_mlds.m.

compiler/hlds_module.m:
	Always store the ids of unification and comparison procedures in
	type_ctor_gen_infos, to simplify their handling.

compiler/type_ctor_info.m:
	Generate the new data structures for representing type_ctor_infos.

	Conform to the changed data structures for type_ctor_gen_infos.

compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
	Rewrite substantial parts of these modules to convert the new data
	structures for representing type_ctor_infos to sets of discrete
	structures dynamically.

	Most of the dynamically created structures are unique by construction,
	but this is not true for typeinfos and pseudo-typeinfos. Therefore
	add mechanisms to ensure that we don't generate redundant structures
	representing typeinfos and pseudo-typeinfos.

compiler/mlds_to_c.m:
compiler/mlds_to_java.m:
	Use the standard mechanisms for creating C and Java type names.

compiler/mlds_to_gcc.m:
	Conform to the changed data structures in rtti.m and
	mercury_type_info.h.

compiler/opt_debug.m:
	Conform to the changed data structures in rtti.m.

compiler/dead_proc_elim.m:
	Conform to the changed data structures for type_ctor_gen_infos.

compiler/pseudo_type_info.m:
	Add a predicate to construct a representation of a type that may or may
	not be ground.

compiler/mlds_to_gcc.m:
java/runtime/TypeCtorRep.java:
library/private_builtin.m:
library/rtti_implemenation.m:
runtime/mercury_mcpp.{cpp,h}:
	Add the type_ctor_rep for foreign types to the lists of type_ctor_reps.

library/construct.m:
library/deconstruct.m:
	Add missing MR_ prefixes on field names.

runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.c:
runtime/mercury_type_info.c:
runtime/mercury_unify_compare_body.h:
	Handle the type_ctor_rep for foreign types.

	Add missing MR_ prefixes on field names.

library/list.m:
	Add two utility predicates, is_empty and is_not_empty, for use with
	higher order code.

NEWS:
	Mention the new predicates in list.m. Delete a duplicate entry.

Diffing .
--- ws19.basis/NEWS	Thu Jul 18 17:32:46 2002
+++ ws19/NEWS	Wed Jul 31 12:44:22 2002
@@ -161,7 +161,7 @@
   Also beware that std_util__functor and std_util__deconstruct now
   return `[|]' rather than `.' for lists, and calls to std_util__construct
   which construct lists may need to be updated.
-* We've added a predicate list__map_foldl2.
+* We've added the predicate list__is_empty/1 and list__is_not_empty/1.
 
 * We've added a function version of error/1, called func_error/1, to require.m.
 
Diffing bench
Diffing bench/progs
Diffing bench/progs/compress
Diffing bench/progs/icfp2000
Diffing bench/progs/icfp2001
Diffing bench/progs/nuc
Diffing bench/progs/ray
Diffing bench/progs/tree234
Diffing bindist
Diffing boehm_gc
Diffing boehm_gc/Mac_files
Diffing boehm_gc/cord
Diffing boehm_gc/cord/private
Diffing boehm_gc/doc
Diffing boehm_gc/include
Diffing boehm_gc/include/private
Diffing boehm_gc/tests
Diffing browser
Diffing bytecode
Diffing compiler
--- ws19.basis/compiler/mlds_to_c.m	Thu Jul 25 14:06:01 2002
+++ ws19/compiler/mlds_to_c.m	Thu Jul 25 13:10:43 2002
@@ -1828,8 +1828,8 @@
 		io__write_string("jmp_buf")
 	).
 mlds_output_type_prefix(mlds__rtti_type(RttiName)) -->
-	io__write_string("MR_"),
-	io__write_string(mlds_rtti_type_name(RttiName)).
+	{ rtti_name_c_type(RttiName, CType, _IsArray) },
+	io__write_string(CType).
 mlds_output_type_prefix(mlds__unknown_type) -->
 	{ error("mlds_to_c.m: prefix has unknown type") }.
 
--- ws19.basis/compiler/mlds_to_java.m	Wed Jun 26 14:12:52 2002
+++ ws19/compiler/mlds_to_java.m	Thu Jul 25 01:44:50 2002
@@ -1668,8 +1668,9 @@
 % generated as such.
 %
 output_type(mlds__rtti_type(RttiName)) -->
-	io__write_string("static mercury.runtime."),
-	io__write_string(mlds_rtti_type_name(RttiName)).
+	{ rtti_name_java_type(RttiName, JavaTypeName, _IsArray) },
+	io__write_string("static "),
+	io__write_string(JavaTypeName).
 output_type(mlds__unknown_type) -->
 	{ unexpected(this_file, "output_type: unknown type") }.
 
--- ws19.basis/compiler/rtti.m	Thu May 30 08:57:41 2002
+++ ws19/compiler/rtti.m	Wed Jul 31 17:52:59 2002
@@ -111,8 +111,14 @@
 	% runtime system needs to know about the data representation scheme
 	% used by a type constructor.
 	%
-	% The alternatives that correspond to discriminated union types have
-	% four kinds of information.
+	% There are four alternatives that correspond to discriminated union:
+	% enum, du, reserved and notag. Enum is for types that define only
+	% constants. Notag is for types that define only one unary functor.
+	% Reserved is for types in which at least one functor is represented
+	% using a reserved value, which may be the address of an object or a
+	% small integer (including zero). Du is for all other types.
+	%
+	% All four alternatives have four kinds of information.
 	%
 	% First, an indication of whether the type has user-defined equality or
 	% not.
@@ -228,8 +234,10 @@
 
 	% Descriptor for a functor in reserved address type.
 	%
-	% This type mostly corresponds to the C union
-	% MR_MaybeResAddrFunctorDesc.
+	% This type corresponds to the C type MR_MaybeResAddrFunctorDesc,
+	% although their structure is slightly different in order to make
+	% searches on an array of the C structures as convenient as searches
+	% on a list of values of this Mercury type.
 :- type maybe_reserved_functor
 	--->	res_func(
 			mrf_res			:: reserved_functor
@@ -251,7 +259,7 @@
 			remote_sec_tag		:: int
 		).
 
-	% Describes the types of the existentially types arguments of a
+	% Describes the types of the existentially typed arguments of a
 	% discriminated union functor.
 	%
 	% This type corresponds to the C type MR_DuExistInfo.
@@ -436,12 +444,11 @@
 
 %-----------------------------------------------------------------------------%
 %
-% The data structures representing the XXX
+% The data structures representing the top-level global data structures
+% generated by the Mercury compiler. Usually readonly, with one exception:
+% data containing code addresses must be initialized at runtime in grades
+% that don't support static code initializers.
 
-	% Global data generated by the compiler. Usually readonly,
-	% with one exception: data containing code addresses must
-	% be initialized at runtime in grades that don't support static
-	% code initializers.
 :- type rtti_data
 	--->	type_ctor_info(
 			type_ctor_data
@@ -492,8 +499,7 @@
 
 %-----------------------------------------------------------------------------%
 %
-% The functions
-
+% The functions operating on RTTI data.
 
 	% Return the id of the type constructor.
 :- func tcd_get_rtti_type_ctor(type_ctor_data) = rtti_type_ctor.
@@ -587,6 +593,27 @@
 	% one passed is numeric.
 :- pred res_addr_is_numeric(reserved_address::in) is semidet.
 
+        % Return true iff the given type of RTTI data structure includes
+	% code addresses.
+:- func rtti_name_would_include_code_addr(rtti_name) = bool.
+
+        % Return true iff the given type_info's RTTI data structure includes
+	% code addresses.
+:- func type_info_would_incl_code_addr(rtti_type_info) = bool.
+
+        % Return true iff the given pseudo_type_info's RTTI data structure
+	% includes code addresses.
+:- func pseudo_type_info_would_incl_code_addr(rtti_pseudo_type_info) = bool.
+
+	% rtti_name_c_type(RttiName, Type, IsArray):
+	%	To declare a variable of the type specified by RttiName,
+	%	put Type before the name of the variable; if IsArray is true,
+	%	also put "[]" after the name.
+:- pred rtti_name_c_type(rtti_name::in, string::out, bool::out) is det.
+
+	% Analogous to rtti_name_c_type.
+:- pred rtti_name_java_type(rtti_name::in, string::out, bool::out) is det.
+
 :- implementation.
 
 :- import_module parse_tree__prog_util.	% for mercury_public_builtin_module
@@ -646,28 +673,8 @@
 	mercury_public_builtin_module(Builtin),
 	Ctor = rtti_type_ctor(Builtin, "tuple", 0).
 
-rtti_name_has_array_type(exist_locns(_))		= yes.
-rtti_name_has_array_type(exist_info(_))			= no.
-rtti_name_has_array_type(field_names(_))		= yes.
-rtti_name_has_array_type(field_types(_))		= yes.
-rtti_name_has_array_type(res_addrs)			= yes.
-rtti_name_has_array_type(res_addr_functors)		= yes.
-rtti_name_has_array_type(enum_functor_desc(_))		= no.
-rtti_name_has_array_type(notag_functor_desc)		= no.
-rtti_name_has_array_type(du_functor_desc(_))		= no.
-rtti_name_has_array_type(res_functor_desc(_))		= no.
-rtti_name_has_array_type(enum_name_ordered_table)	= yes.
-rtti_name_has_array_type(enum_value_ordered_table)	= yes.
-rtti_name_has_array_type(du_name_ordered_table)		= yes.
-rtti_name_has_array_type(du_stag_ordered_table(_))	= yes.
-rtti_name_has_array_type(du_ptag_ordered_table)		= yes.
-rtti_name_has_array_type(res_value_ordered_table)	= no.
-rtti_name_has_array_type(res_name_ordered_table)	= yes.
-rtti_name_has_array_type(type_ctor_info)		= no.
-rtti_name_has_array_type(type_info(_))			= no.
-rtti_name_has_array_type(pseudo_type_info(_))		= no.
-rtti_name_has_array_type(base_typeclass_info(_, _, _))	= yes.
-rtti_name_has_array_type(type_hashcons_pointer)		= no.
+rtti_name_has_array_type(RttiName) = IsArray :-
+	rtti_name_type(RttiName, _, IsArray).
 
 rtti_name_is_exported(exist_locns(_))		= no.
 rtti_name_is_exported(exist_info(_))            = no.
@@ -1078,3 +1085,100 @@
 
 res_addr_is_numeric(null_pointer).
 res_addr_is_numeric(small_pointer(_)).
+
+rtti_name_would_include_code_addr(exist_locns(_)) =		no.
+rtti_name_would_include_code_addr(exist_info(_)) =		no.
+rtti_name_would_include_code_addr(field_names(_)) =		no.
+rtti_name_would_include_code_addr(field_types(_)) =		no.
+rtti_name_would_include_code_addr(res_addrs) =			no.
+rtti_name_would_include_code_addr(res_addr_functors) =		no.
+rtti_name_would_include_code_addr(enum_functor_desc(_)) =	no.
+rtti_name_would_include_code_addr(notag_functor_desc) =		no.
+rtti_name_would_include_code_addr(du_functor_desc(_)) =		no.
+rtti_name_would_include_code_addr(res_functor_desc(_)) = 	no.
+rtti_name_would_include_code_addr(enum_name_ordered_table) =	no.
+rtti_name_would_include_code_addr(enum_value_ordered_table) =	no.
+rtti_name_would_include_code_addr(du_name_ordered_table) =	no.
+rtti_name_would_include_code_addr(du_stag_ordered_table(_)) =	no.
+rtti_name_would_include_code_addr(du_ptag_ordered_table) =	no.
+rtti_name_would_include_code_addr(res_value_ordered_table) =	no.
+rtti_name_would_include_code_addr(res_name_ordered_table) =	no.
+rtti_name_would_include_code_addr(type_hashcons_pointer) =	no.
+rtti_name_would_include_code_addr(type_ctor_info) =		yes.
+rtti_name_would_include_code_addr(base_typeclass_info(_, _, _)) = yes.
+rtti_name_would_include_code_addr(type_info(TypeInfo)) =
+	type_info_would_incl_code_addr(TypeInfo).
+rtti_name_would_include_code_addr(pseudo_type_info(PseudoTypeInfo)) =
+	pseudo_type_info_would_incl_code_addr(PseudoTypeInfo).
+
+type_info_would_incl_code_addr(plain_arity_zero_type_info(_)) = yes.
+type_info_would_incl_code_addr(plain_type_info(_, _)) =	no.
+type_info_would_incl_code_addr(var_arity_type_info(_, _)) = no.
+
+pseudo_type_info_would_incl_code_addr(plain_arity_zero_pseudo_type_info(_))
+	= yes.
+pseudo_type_info_would_incl_code_addr(plain_pseudo_type_info(_, _)) = no.
+pseudo_type_info_would_incl_code_addr(var_arity_pseudo_type_info(_, _))	= no.
+pseudo_type_info_would_incl_code_addr(type_var(_)) = no.
+
+rtti_name_c_type(RttiName, CTypeName, IsArray) :-
+	rtti_name_type(RttiName, GenTypeName, IsArray),
+	CTypeName = string__append("MR_", GenTypeName).
+
+rtti_name_java_type(RttiName, JavaTypeName, IsArray) :-
+	rtti_name_type(RttiName, GenTypeName, IsArray),
+	JavaTypeName = string__append("mercury.runtime.", GenTypeName).
+
+	% rtti_name_type(RttiName, Type, IsArray):
+:- pred rtti_name_type(rtti_name::in, string::out, bool::out) is det.
+
+rtti_name_type(exist_locns(_),             "DuExistLocn", yes).
+rtti_name_type(exist_info(_),              "DuExistInfo", no).
+rtti_name_type(field_names(_),             "ConstString", yes).
+rtti_name_type(field_types(_),             "PseudoTypeInfo", yes).
+rtti_name_type(res_addrs,                  "ReservedAddr", yes).
+rtti_name_type(res_addr_functors,          "ReservedAddrFunctorDescPtr", yes).
+rtti_name_type(enum_functor_desc(_),       "EnumFunctorDesc", no).
+rtti_name_type(notag_functor_desc,         "NotagFunctorDesc", no).
+rtti_name_type(du_functor_desc(_),         "DuFunctorDesc", no).
+rtti_name_type(res_functor_desc(_),        "ReservedAddrFunctorDesc", no).
+rtti_name_type(enum_name_ordered_table,    "EnumFunctorDescPtr", yes).
+rtti_name_type(enum_value_ordered_table,   "EnumFunctorDescPtr", yes).
+rtti_name_type(du_name_ordered_table,      "DuFunctorDescPtr", yes).
+rtti_name_type(du_stag_ordered_table(_),   "DuFunctorDescPtr", yes).
+rtti_name_type(du_ptag_ordered_table,      "DuPtagLayout", yes).
+rtti_name_type(res_value_ordered_table,    "ReservedAddrTypeLayout", no).
+rtti_name_type(res_name_ordered_table,     "MaybeResAddrFunctorDesc", yes).
+rtti_name_type(type_ctor_info,             "TypeCtorInfo_Struct", no).
+rtti_name_type(base_typeclass_info(_,_,_), "BaseTypeclassInfo", yes).
+rtti_name_type(type_hashcons_pointer,      "TrieNodePtr", no).
+rtti_name_type(type_info(TypeInfo), TypeName, no) :-
+	TypeName = type_info_name_type(TypeInfo).
+rtti_name_type(pseudo_type_info(PseudoTypeInfo), TypeName, no) :-
+	TypeName = pseudo_type_info_name_type(PseudoTypeInfo).
+
+:- func type_info_name_type(rtti_type_info) = string.
+
+type_info_name_type(plain_arity_zero_type_info(_)) =
+	"TypeCtorInfo_Struct".
+type_info_name_type(plain_type_info(_, ArgTypes)) =
+	string__format("FA_TypeInfo_Struct%d", [i(list__length(ArgTypes))]).
+type_info_name_type(var_arity_type_info(_, ArgTypes)) =
+	string__format("VA_TypeInfo_Struct%d", [i(list__length(ArgTypes))]).
+
+:- func pseudo_type_info_name_type(rtti_pseudo_type_info) = string.
+
+pseudo_type_info_name_type(plain_arity_zero_pseudo_type_info(_)) =
+	"TypeCtorInfo_Struct".
+pseudo_type_info_name_type(plain_pseudo_type_info(_TypeCtor, ArgTypes)) =
+	string__format("FA_PseudoTypeInfo_Struct%d",
+		[i(list__length(ArgTypes))]).
+pseudo_type_info_name_type(var_arity_pseudo_type_info(_TypeCtor, ArgTypes)) =
+	string__format("VA_PseudoTypeInfo_Struct%d",
+		[i(list__length(ArgTypes))]).
+pseudo_type_info_name_type(type_var(_)) = _ :-
+	% we use small integers to represent type_vars,
+	% rather than pointers, so there is no pointed-to type
+	error("pseudo_type_info_name_type: type_var").
+
+%-----------------------------------------------------------------------------%
--- ws19.basis/compiler/rtti_out.m	Thu May 30 08:57:41 2002
+++ ws19/compiler/rtti_out.m	Thu Jul 25 10:41:28 2002
@@ -77,20 +77,6 @@
 		class_id::in, string::in, bool::in,
 		io__state::di, io__state::uo) is det.
 
-        % Return true iff the given type of RTTI data structure includes
-	% code addresses.
-:- func rtti_name_would_include_code_addr(rtti_name) = bool.
-
-:- pred rtti_name_linkage(rtti_name::in, linkage::out) is det.
-
-	% rtti_name_c_type(RttiName, Type, TypeSuffix):
-	%	The type of the specified RttiName is given by Type
-	%	and TypeSuffix, which are C code fragments suitable
-	%	for use in a C declaration `<TypeName> foo <TypeSuffix>'.
-	%	TypeSuffix will be "[]" if the given RttiName
-	%	has an array type.
-:- pred rtti_name_c_type(rtti_name::in, string::out, string::out) is det.
-
 :- implementation.
 
 :- import_module parse_tree__prog_out.
@@ -472,7 +458,10 @@
 			type_info(ArgTypeInfo))
 	;
 		{ ArgType = pseudo(ArgPseudoTypeInfo) },
-		output_addr_of_rtti_data(pseudo_type_info(ArgPseudoTypeInfo))
+		% We need to cast the argument to MR_PseudoTypeInfo in case
+		% it turns out to be a small integer, not a pointer.
+		output_cast_addr_of_rtti_data("(MR_PseudoTypeInfo) ",
+			pseudo_type_info(ArgPseudoTypeInfo))
 	),
 	io__write_string(",\n\t"),
 	(
@@ -675,6 +664,8 @@
 	output_generic_rtti_data_defn_start(RttiTypeCtor, field_types(Ordinal),
 		DeclSet2, DeclSet),
 	io__write_string(" = {\n"),
+	{ require(list__is_not_empty(ArgTypes),
+		"output_du_arg_types: empty list") },
 	{ ArgRttiDatas = list__map(maybe_pseudo_type_info_or_self_to_rtti_data,
 		ArgTypes) },
 	output_cast_addr_of_rtti_datas("(MR_PseudoTypeInfo) ", ArgRttiDatas),
@@ -688,6 +679,8 @@
 	output_generic_rtti_data_defn_start(RttiTypeCtor, field_names(Ordinal),
 		DeclSet0, DeclSet),
 	io__write_string(" = {\n"),
+	{ require(list__is_not_empty(MaybeNames),
+		"output_du_arg_names: empty list") },
 	output_maybe_quoted_strings(MaybeNames),
 	io__write_string("};\n").
 
@@ -998,11 +991,16 @@
 	{ c_data_const_string(Globals, InclCodeAddr, ConstStr) },
 	io__write_string(ConstStr),
 
-	{ rtti_name_c_type(RttiName, CType, Suffix) },
+	{ rtti_name_c_type(RttiName, CType, IsArray) },
 	c_util__output_quoted_string(CType),
 	io__write_string(" "),
 	OutputName,
-	io__write_string(Suffix).
+	(
+		{ IsArray = yes },
+		io__write_string("[]")
+	;
+		{ IsArray = no }
+	).
 
 	% Each type_info and pseudo_type_info may have a different C type,
 	% depending on what kind of type_info or pseudo_type_info it is,
@@ -1013,53 +1011,43 @@
 
 output_rtti_type_decl(RttiName) -->
 	(
-		{ rtti_type_needs_template(RttiName, DefineType,
-			TypeNameBase, NumArgTypes) }
+		{ rtti_type_template_arity(RttiName, Arity) },
+		{ Arity > max_always_declared_arity }
 	->
 		{ Template = 
-"#ifndef %s%d_GUARD
-#define %s%d_GUARD
-%s(%s%d, %d);
+"#ifndef MR_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY_%d_GUARD
+#define MR_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY_%d_GUARD
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(%d);
 #endif
 "		},
-		io__format(Template, [
-			s(TypeNameBase), i(NumArgTypes),
-			s(TypeNameBase), i(NumArgTypes),
-			s(DefineType), s(TypeNameBase),
-			i(NumArgTypes), i(NumArgTypes)
-		])
+		io__format(Template, [i(Arity), i(Arity), i(Arity)])
 	;
 		[]
 	).
 
-:- pred rtti_type_needs_template(rtti_name::in, string::out, string::out,
-	int::out) is semidet.
+:- pred rtti_type_template_arity(rtti_name::in, int::out) is semidet.
 
-rtti_type_needs_template(RttiName, DefineType, TypeNameBase, NumArgTypes) :-
+rtti_type_template_arity(RttiName, NumArgTypes) :-
 		  RttiName = type_info(TypeInfo),
 		  (
-		    TypeInfo = plain_type_info(_, ArgTypes),
-		    TypeNameBase = "MR_FA_TypeInfo_Struct",
-		    DefineType = "MR_FIXED_ARITY_TYPEINFO_STRUCT"
-		  ;
-		    TypeInfo = var_arity_type_info(_, ArgTypes),
-		    TypeNameBase = "MR_VA_TypeInfo_Struct",
-		    DefineType = "MR_VAR_ARITY_TYPEINFO_STRUCT"
+		TypeInfo = plain_type_info(_, ArgTypes)
+	;
+		TypeInfo = var_arity_type_info(_, ArgTypes)
 		  ),
 	NumArgTypes = list__length(ArgTypes).
-rtti_type_needs_template(RttiName, DefineType, TypeNameBase, NumArgTypes) :-
+rtti_type_template_arity(RttiName, NumArgTypes) :-
 		  RttiName = pseudo_type_info(PseudoTypeInfo),
 		  (
-		    PseudoTypeInfo = plain_pseudo_type_info(_, ArgTypes),
-		    TypeNameBase = "MR_FA_PseudoTypeInfo_Struct",
-		    DefineType = "MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT"
-		  ;
-		    PseudoTypeInfo = var_arity_pseudo_type_info(_, ArgTypes),
-		    TypeNameBase = "MR_VA_PseudoTypeInfo_Struct",
-		    DefineType = "MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT"
+		PseudoTypeInfo = plain_pseudo_type_info(_, ArgTypes)
+	;
+		PseudoTypeInfo = var_arity_pseudo_type_info(_, ArgTypes)
 		  ),
 	NumArgTypes = list__length(ArgTypes).
 
+:- func max_always_declared_arity = int.
+
+max_always_declared_arity = 20.
+
 %-----------------------------------------------------------------------------%
 
 rtti_out__init_rtti_data_if_nec(Data) -->
@@ -1404,44 +1392,7 @@
 
 %-----------------------------------------------------------------------------%
 
-rtti_name_would_include_code_addr(exist_locns(_)) =               no.
-rtti_name_would_include_code_addr(exist_info(_)) =                no.
-rtti_name_would_include_code_addr(field_names(_)) =               no.
-rtti_name_would_include_code_addr(field_types(_)) =               no.
-rtti_name_would_include_code_addr(res_addrs) =               	  no.
-rtti_name_would_include_code_addr(res_addr_functors) =       	  no.
-rtti_name_would_include_code_addr(enum_functor_desc(_)) =         no.
-rtti_name_would_include_code_addr(notag_functor_desc) =           no.
-rtti_name_would_include_code_addr(du_functor_desc(_)) =           no.
-rtti_name_would_include_code_addr(res_functor_desc(_)) = 	  no.
-rtti_name_would_include_code_addr(enum_name_ordered_table) =      no.
-rtti_name_would_include_code_addr(enum_value_ordered_table) =     no.
-rtti_name_would_include_code_addr(du_name_ordered_table) =        no.
-rtti_name_would_include_code_addr(du_stag_ordered_table(_)) =     no.
-rtti_name_would_include_code_addr(du_ptag_ordered_table) =        no.
-rtti_name_would_include_code_addr(res_value_ordered_table) =   	  no.
-rtti_name_would_include_code_addr(res_name_ordered_table) =    	  no.
-rtti_name_would_include_code_addr(type_ctor_info) =               yes.
-rtti_name_would_include_code_addr(base_typeclass_info(_, _, _)) = yes.
-rtti_name_would_include_code_addr(type_info(TypeInfo)) =
-	type_info_would_incl_code_addr(TypeInfo).
-rtti_name_would_include_code_addr(pseudo_type_info(PseudoTypeInfo)) =
-	pseudo_type_info_would_incl_code_addr(PseudoTypeInfo).
-rtti_name_would_include_code_addr(type_hashcons_pointer) =        no.
-
-:- func type_info_would_incl_code_addr(rtti_type_info) = bool.
-
-type_info_would_incl_code_addr(plain_arity_zero_type_info(_)) = yes.
-type_info_would_incl_code_addr(plain_type_info(_, _)) =		no.
-type_info_would_incl_code_addr(var_arity_type_info(_, _)) =	no.
-
-:- func pseudo_type_info_would_incl_code_addr(rtti_pseudo_type_info) = bool.
-
-pseudo_type_info_would_incl_code_addr(plain_arity_zero_pseudo_type_info(_))
-	= yes.
-pseudo_type_info_would_incl_code_addr(plain_pseudo_type_info(_, _))     = no.
-pseudo_type_info_would_incl_code_addr(var_arity_pseudo_type_info(_, _))	= no.
-pseudo_type_info_would_incl_code_addr(type_var(_))			= no.
+:- pred rtti_name_linkage(rtti_name::in, linkage::out) is det.
 
 rtti_name_linkage(RttiName, Linkage) :-
 	(
@@ -1459,70 +1410,9 @@
 		)
         ).
 
-rtti_name_c_type(exist_locns(_),           "MR_DuExistLocn", "[]").
-rtti_name_c_type(exist_info(_),            "MR_DuExistInfo", "").
-rtti_name_c_type(field_names(_),           "MR_ConstString", "[]").
-rtti_name_c_type(field_types(_),           "MR_PseudoTypeInfo", "[]").
-rtti_name_c_type(res_addrs,                "/* const */ void *", "[]").
-rtti_name_c_type(res_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(res_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 *", "[]").
-rtti_name_c_type(du_stag_ordered_table(_), "MR_DuFunctorDesc *", "[]").
-rtti_name_c_type(du_ptag_ordered_table,    "MR_DuPtagLayout", "[]").
-rtti_name_c_type(res_value_ordered_table,  "MR_ReservedAddrTypeLayout", "").
-rtti_name_c_type(res_name_ordered_table,   "MR_MaybeResAddrFunctorDesc", "[]").
-rtti_name_c_type(type_ctor_info,           "struct MR_TypeCtorInfo_Struct",
-						"").
-rtti_name_c_type(base_typeclass_info(_, _, _), "MR_Code *", "[]").
-rtti_name_c_type(type_info(TypeInfo), TypePrefix, TypeSuffix) :-
-	type_info_name_c_type(TypeInfo, TypePrefix, TypeSuffix).
-rtti_name_c_type(pseudo_type_info(PseudoTypeInfo), TypePrefix, TypeSuffix) :-
-	pseudo_type_info_name_c_type(PseudoTypeInfo, TypePrefix, TypeSuffix).
-rtti_name_c_type(type_hashcons_pointer,    "union MR_TableNode_Union **", "").
-
-:- pred type_info_name_c_type(rtti_type_info, string, string).
-:- mode type_info_name_c_type(in, out, out) is det.
-
-type_info_name_c_type(plain_arity_zero_type_info(_),
-		"struct MR_TypeCtorInfo_Struct", "").
-type_info_name_c_type(plain_type_info(_TypeCtor, ArgTypes),
-		TypeInfoStruct, "") :-
-	TypeInfoStruct = string__format("struct MR_FA_TypeInfo_Struct%d",
-		[i(list__length(ArgTypes))]).
-type_info_name_c_type(var_arity_type_info(_TypeCtor, ArgTypes),
-		TypeInfoStruct, "") :-
-	TypeInfoStruct = string__format("struct MR_VA_TypeInfo_Struct%d",
-		[i(list__length(ArgTypes))]).
-
-:- pred pseudo_type_info_name_c_type(rtti_pseudo_type_info, string, string).
-:- mode pseudo_type_info_name_c_type(in, out, out) is det.
-
-pseudo_type_info_name_c_type(plain_arity_zero_pseudo_type_info(_),
-		"struct MR_TypeCtorInfo_Struct", "").
-pseudo_type_info_name_c_type(plain_pseudo_type_info(_TypeCtor, ArgTypes),
-		TypeInfoStruct, "") :-
-	TypeInfoStruct = string__format("struct MR_FA_PseudoTypeInfo_Struct%d",
-		[i(list__length(ArgTypes))]).
-pseudo_type_info_name_c_type(var_arity_pseudo_type_info(_TypeCtor, ArgTypes),
-		TypeInfoStruct, "") :-
-	TypeInfoStruct = string__format("struct MR_VA_PseudoTypeInfo_Struct%d",
-		[i(list__length(ArgTypes))]).
-pseudo_type_info_name_c_type(type_var(_), _, _) :-
-	% we use small integers to represent type_vars,
-	% rather than pointers, so there is no pointed-to type
-	error("pseudo_type_info_name_c_type: type_var").
-
 %-----------------------------------------------------------------------------%
 
 :- func this_file = string.
 this_file = "rtti_out.m".
-
-:- end_module rtti_out.
 
 %-----------------------------------------------------------------------------%
--- ws19.basis/compiler/rtti_to_mlds.m	Thu May 30 08:57:41 2002
+++ ws19/compiler/rtti_to_mlds.m	Wed Jul 24 21:17:58 2002
@@ -22,13 +22,6 @@
 	% return a list of MLDS definitions for the given rtti_data list.
 :- func rtti_data_list_to_mlds(module_info, list(rtti_data)) = mlds__defns.
 
-	% Return a name, consisting only of alphabetic characters,
-	% that would be suitable for the type name for the type
-	% of the given rtti_name.  If rtti_name_has_array_type(Name) = yes,
-	% then the name returned by mlds_rtti_type_name(Name) is the
-	% array element type, otherwise it is the complete type.
-:- func mlds_rtti_type_name(rtti_name) = string.
-
 :- implementation.
 :- import_module parse_tree__prog_data, parse_tree__prog_data.
 :- import_module parse_tree__prog_out, parse_tree__prog_util.
@@ -1103,63 +1096,5 @@
 gen_init_reserved_address(ModuleInfo, ReservedAddress) =
 	init_obj(ml_gen_reserved_address(ModuleInfo, ReservedAddress,
 		mlds__generic_type)).
-
-%-----------------------------------------------------------------------------%
-
-% the type names mentioned here should be defined in runtime/mercury.h
-% (or in some header file that is included by that one)
-
-% XXX factor out code common with rtti_name_c_type in rtti_out.m
-% XXX check res_addr entries
-mlds_rtti_type_name(exist_locns(_)) =		"DuExistLocn".
-mlds_rtti_type_name(exist_info(_)) =		"DuExistInfo".
-mlds_rtti_type_name(field_names(_)) =		"ConstString".
-mlds_rtti_type_name(field_types(_)) =		"PseudoTypeInfo".
-mlds_rtti_type_name(res_addrs) =		"ReservedAddrs".
-mlds_rtti_type_name(res_addr_functors) =	"ReservedAddrFunctors".
-mlds_rtti_type_name(enum_functor_desc(_)) =	"EnumFunctorDesc".
-mlds_rtti_type_name(notag_functor_desc) =	"NotagFunctorDesc".
-mlds_rtti_type_name(du_functor_desc(_)) =	"DuFunctorDesc".
-mlds_rtti_type_name(res_functor_desc(_)) =	"ReservedAddrFunctorDesc".
-mlds_rtti_type_name(enum_name_ordered_table) =	"EnumFunctorDescPtr".
-mlds_rtti_type_name(enum_value_ordered_table) =	"EnumFunctorDescPtr".
-mlds_rtti_type_name(du_name_ordered_table) =	"DuFunctorDescPtr".
-mlds_rtti_type_name(du_stag_ordered_table(_)) =	"DuFunctorDescPtr".
-mlds_rtti_type_name(du_ptag_ordered_table) =	"DuPtagLayout".
-mlds_rtti_type_name(res_value_ordered_table) =	"ReservedAddrTypeDesc".
-mlds_rtti_type_name(res_name_ordered_table) =	"ReservedAddrTypeDesc".
-mlds_rtti_type_name(type_ctor_info) =		"TypeCtorInfo_Struct".
-mlds_rtti_type_name(base_typeclass_info(_, _, _)) = "BaseTypeclassInfo".
-mlds_rtti_type_name(type_info(TypeInfo)) =
-	mlds_type_info_type_name(TypeInfo).
-mlds_rtti_type_name(pseudo_type_info(PseudoTypeInfo)) =
-	mlds_pseudo_type_info_type_name(PseudoTypeInfo).
-mlds_rtti_type_name(type_hashcons_pointer) =	"TableNodePtrPtr".
-
-:- func mlds_type_info_type_name(rtti_type_info) = string.
-
-mlds_type_info_type_name(plain_arity_zero_type_info(_)) =
-	"TypeCtorInfo_Struct".
-mlds_type_info_type_name(plain_type_info(_TypeCtor, ArgTypes)) =
-	string__format("FA_TypeInfo_Struct%d", [i(list__length(ArgTypes))]).
-mlds_type_info_type_name(var_arity_type_info(_TypeCtor,
-		ArgTypes)) =
-	string__format("VA_TypeInfo_Struct%d", [i(list__length(ArgTypes))]).
-
-:- func mlds_pseudo_type_info_type_name(rtti_pseudo_type_info) = string.
-
-mlds_pseudo_type_info_type_name(plain_arity_zero_pseudo_type_info(_)) =
-	"TypeCtorInfo_Struct".
-mlds_pseudo_type_info_type_name(plain_pseudo_type_info(_TypeCtor, ArgTypes)) =
-	string__format("FA_PseudoTypeInfo_Struct%d",
-		[i(list__length(ArgTypes))]).
-mlds_pseudo_type_info_type_name(var_arity_pseudo_type_info(_TypeCtor,
-		ArgTypes)) =
-	string__format("VA_PseudoTypeInfo_Struct%d",
-		[i(list__length(ArgTypes))]).
-mlds_pseudo_type_info_type_name(type_var(_)) = _ :-
-	% we use small integers to represent type_vars,
-	% rather than pointers, so there is no pointed-to type
-	error("mlds_rtti_type_name: type_var").
 
 %-----------------------------------------------------------------------------%
--- ws19.basis/compiler/type_ctor_info.m	Tue Jul  2 16:56:09 2002
+++ ws19/compiler/type_ctor_info.m	Thu Aug  1 16:00:49 2002
@@ -44,6 +44,14 @@
 :- pred type_ctor_info__generate_rtti(module_info::in, list(rtti_data)::out)
 	is det.
 
+	% Compute the "contains var" bit vector. The input is a list describing
+	% the types of the arguments of a function symbol. The output is an
+	% bit vector (represented as a 16 bit integer) in which each bit is set
+	% if the type of the corresponding argument contains a type variable.
+	% If the function symbol has more than 16 arguments, then the last bit
+	% is true if any of the arguments after the 15th contain a type
+	% variable in their type.
+
 :- func compute_contains_var_bit_vector(
 	list(rtti_maybe_pseudo_type_info_or_self)) = int.
 
@@ -206,8 +214,6 @@
 		TypeBody = abstract_type,
 		error("type_ctor_info__gen_type_ctor_data: abstract_type")
 	;
-			% We treat foreign_types as equivalent to the
-			% type builtin__c_pointer.
 		TypeBody = foreign_type(_),
 		Details = foreign
 	;
@@ -529,7 +535,7 @@
 		require(unify(Arity, 0),
 			"type_ctor_info__make_maybe_res_functors: bad arity"),
 		require(unify(ArgInfos, []),
-			"type_ctor_info__make_maybe_res_functors: bad arsg"),
+			"type_ctor_info__make_maybe_res_functors: bad args"),
 		require(unify(MaybeExistInfo, no),
 			"type_ctor_info__make_maybe_res_functors: bad exist"),
 		ResFunctor = reserved_functor(FunctorName, NextOrdinal,
@@ -728,7 +734,7 @@
 		map__det_insert(NameMap0, Arity, DuFunctor, NameMap),
 		map__det_update(NameTable0, Name, NameMap, NameTable)
 	;
-		NameMap = map__init_singleton(Arity, DuFunctor),
+		NameMap = map__det_insert(map__init, Arity, DuFunctor),
 		map__det_insert(NameTable0, Name, NameMap, NameTable)
 	).
 
@@ -751,7 +757,7 @@
 		map__det_insert(NameMap0, Arity, MaybeResFunctor, NameMap),
 		map__det_update(NameTable0, Name, NameMap, NameTable)
 	;
-		NameMap = map__init_singleton(Arity, MaybeResFunctor),
+		NameMap = map__det_insert(map__init, Arity, MaybeResFunctor),
 		map__det_insert(NameTable0, Name, NameMap, NameTable)
 	).
 
Diffing compiler/notes
Diffing debian
Diffing deep_profiler
Diffing deep_profiler/notes
Diffing doc
Diffing extras
Diffing extras/aditi
Diffing extras/cgi
Diffing extras/complex_numbers
Diffing extras/complex_numbers/samples
Diffing extras/complex_numbers/tests
Diffing extras/concurrency
Diffing extras/curs
Diffing extras/curs/samples
Diffing extras/curses
Diffing extras/curses/sample
Diffing extras/dynamic_linking
Diffing extras/graphics
Diffing extras/graphics/mercury_opengl
Diffing extras/graphics/mercury_tcltk
Diffing extras/graphics/samples
Diffing extras/graphics/samples/calc
Diffing extras/graphics/samples/maze
Diffing extras/graphics/samples/pent
Diffing extras/lazy_evaluation
Diffing extras/lex
Diffing extras/lex/samples
Diffing extras/logged_output
Diffing extras/moose
Diffing extras/moose/samples
Diffing extras/morphine
Diffing extras/morphine/non-regression-tests
Diffing extras/morphine/scripts
Diffing extras/morphine/source
Diffing extras/odbc
Diffing extras/posix
Diffing extras/quickcheck
Diffing extras/quickcheck/tutes
Diffing extras/references
Diffing extras/references/samples
Diffing extras/references/tests
Diffing extras/stream
Diffing extras/trailed_update
Diffing extras/trailed_update/samples
Diffing extras/trailed_update/tests
Diffing extras/xml
Diffing extras/xml/samples
Diffing java
Diffing java/library
Diffing java/runtime
Diffing library
--- ws19.basis/library/list.m	Wed Mar 13 03:33:23 2002
+++ ws19/library/list.m	Wed Jul 24 15:35:54 2002
@@ -56,6 +56,10 @@
 
 %-----------------------------------------------------------------------------%
 
+:- pred list__is_empty(list(T)::in) is semidet.
+
+:- pred list__is_not_empty(list(T)::in) is semidet.
+
 	% Standard append predicate:
 	% list__append(Start, End, List) is true iff
 	% `List' is the result of concatenating `Start' and `End'.
@@ -734,6 +738,10 @@
 :- import_module bintree_set, require, std_util.
 
 %-----------------------------------------------------------------------------%
+
+list__is_empty([]).
+
+list__is_not_empty([_ | _]).
 
 list__append([], Ys, Ys).
 list__append([X | Xs], Ys, [X | Zs]) :-
--- ws19.basis/library/map.m	Thu May 30 08:57:41 2002
+++ ws19/library/map.m	Thu Aug  1 16:01:03 2002
@@ -37,8 +37,6 @@
 :- func map__init = map(K, V).
 :- mode map__init = uo is det.
 
-:- func map__init_singleton(K, V) = map(K, V).
-
 	% Check whether a map is empty.
 :- pred map__is_empty(map(_,_)).
 :- mode map__is_empty(in) is semidet.
@@ -788,9 +786,6 @@
 
 map__init = M :-
 	map__init(M).
-
-map__init_singleton(K, V) =
-	map__det_insert(map__init, K, V).
 
 map__search(M, K) = V :-
 	map__search(M, K, V).
Diffing profiler
Diffing robdd
Diffing runtime
--- ws19.basis/runtime/mercury.h	Thu Apr 25 19:31:56 2002
+++ ws19/runtime/mercury.h	Thu Jul 25 09:48:50 2002
@@ -170,256 +170,6 @@
 typedef MR_Box *MR_Tuple;
 
 /*
-** Typedefs used for the types of RTTI data structures.
-** Many of these types are defined in mercury_type_info.h,
-** but the ones which are used only by the MLDS back-end
-** are defined here.
-*/
-typedef struct MR_TypeCtorInfo_Struct	MR_TypeCtorInfo_Struct;
-typedef const MR_EnumFunctorDesc *	MR_EnumFunctorDescPtr;
-typedef const MR_DuFunctorDesc *	MR_DuFunctorDescPtr;
-typedef union MR_TableNode_Union * *	MR_TableNodePtrPtr;
-typedef MR_Box				MR_BaseTypeclassInfo;
-typedef const void * 			MR_ReservedAddrs;
-typedef const MR_ReservedAddrFunctorDesc *MR_ReservedAddrFunctors;
-
-
-/*
-** XXX Currently we hard-code the declarations of the first
-** ten of these type-info struct types; this imposes a fixed
-** limit of 20 on the arity of types.  (If this is exceeded,
-** you'll get a parse error in the generated C code, due to
-** an undeclared type.)
-** Note that the code for compare and unify in runtime/mercury.c
-** also has a fixed limit of 5 on the arity of types (other than
-** higher-order and tuple types, which have no limit).
-** Fortunately types with a high arity tend not to be used very
-** often, so this is probably OK for now...
-*/
-
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct1, 1);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct2, 2);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct3, 3);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct4, 4);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct5, 5);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct6, 6);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct7, 7);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct8, 8);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct9, 9);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct10, 10);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct11, 11);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct12, 12);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct13, 13);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct14, 14);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct15, 15);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct16, 16);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct17, 17);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct18, 18);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct19, 19);
-MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(MR_VA_PseudoTypeInfo_Struct20, 20);
-
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct1, 1);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct2, 2);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct3, 3);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct4, 4);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct5, 5);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct6, 6);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct7, 7);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct8, 8);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct9, 9);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct10, 10);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct11, 11);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct12, 12);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct13, 13);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct14, 14);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct15, 15);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct16, 16);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct17, 17);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct18, 18);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct19, 19);
-MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(MR_FA_PseudoTypeInfo_Struct20, 20);
-
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct1, 1);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct2, 2);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct3, 3);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct4, 4);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct5, 5);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct6, 6);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct7, 7);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct8, 8);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct9, 9);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct10, 10);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct11, 11);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct12, 12);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct13, 13);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct14, 14);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct15, 15);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct16, 16);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct17, 17);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct18, 18);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct19, 19);
-MR_VAR_ARITY_TYPEINFO_STRUCT(MR_VA_TypeInfo_Struct20, 20);
-
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct1, 1);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct2, 2);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct3, 3);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct4, 4);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct5, 5);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct6, 6);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct7, 7);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct8, 8);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct9, 9);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct10, 10);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct11, 11);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct12, 12);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct13, 13);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct14, 14);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct15, 15);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct16, 16);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct17, 17);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct18, 18);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct19, 19);
-MR_FIXED_ARITY_TYPEINFO_STRUCT(MR_FA_TypeInfo_Struct20, 20);
-
-/*
-** Since standard C doesn't support zero-sized arrays,
-** we use the same type for unary higher-order pseudo-type-infos
-** as for zero-arity higher-order pseudo-type-infos.
-*/
-
-typedef struct MR_VA_PseudoTypeInfo_Struct1 MR_VA_PseudoTypeInfo_Struct0;
-typedef struct MR_VA_PseudoTypeInfo_Struct1 MR_VA_PseudoTypeInfo_Struct1;
-typedef struct MR_VA_PseudoTypeInfo_Struct2 MR_VA_PseudoTypeInfo_Struct2;
-typedef struct MR_VA_PseudoTypeInfo_Struct3 MR_VA_PseudoTypeInfo_Struct3;
-typedef struct MR_VA_PseudoTypeInfo_Struct4 MR_VA_PseudoTypeInfo_Struct4;
-typedef struct MR_VA_PseudoTypeInfo_Struct5 MR_VA_PseudoTypeInfo_Struct5;
-typedef struct MR_VA_PseudoTypeInfo_Struct6 MR_VA_PseudoTypeInfo_Struct6;
-typedef struct MR_VA_PseudoTypeInfo_Struct7 MR_VA_PseudoTypeInfo_Struct7;
-typedef struct MR_VA_PseudoTypeInfo_Struct8 MR_VA_PseudoTypeInfo_Struct8;
-typedef struct MR_VA_PseudoTypeInfo_Struct9 MR_VA_PseudoTypeInfo_Struct9;
-typedef struct MR_VA_PseudoTypeInfo_Struct10 MR_VA_PseudoTypeInfo_Struct10;
-typedef struct MR_VA_PseudoTypeInfo_Struct11 MR_VA_PseudoTypeInfo_Struct11;
-typedef struct MR_VA_PseudoTypeInfo_Struct12 MR_VA_PseudoTypeInfo_Struct12;
-typedef struct MR_VA_PseudoTypeInfo_Struct13 MR_VA_PseudoTypeInfo_Struct13;
-typedef struct MR_VA_PseudoTypeInfo_Struct14 MR_VA_PseudoTypeInfo_Struct14;
-typedef struct MR_VA_PseudoTypeInfo_Struct15 MR_VA_PseudoTypeInfo_Struct15;
-typedef struct MR_VA_PseudoTypeInfo_Struct16 MR_VA_PseudoTypeInfo_Struct16;
-typedef struct MR_VA_PseudoTypeInfo_Struct17 MR_VA_PseudoTypeInfo_Struct17;
-typedef struct MR_VA_PseudoTypeInfo_Struct18 MR_VA_PseudoTypeInfo_Struct18;
-typedef struct MR_VA_PseudoTypeInfo_Struct19 MR_VA_PseudoTypeInfo_Struct19;
-typedef struct MR_VA_PseudoTypeInfo_Struct20 MR_VA_PseudoTypeInfo_Struct20;
-
-typedef struct MR_FA_PseudoTypeInfo_Struct1 MR_FA_PseudoTypeInfo_Struct1;
-typedef struct MR_FA_PseudoTypeInfo_Struct2 MR_FA_PseudoTypeInfo_Struct2;
-typedef struct MR_FA_PseudoTypeInfo_Struct3 MR_FA_PseudoTypeInfo_Struct3;
-typedef struct MR_FA_PseudoTypeInfo_Struct4 MR_FA_PseudoTypeInfo_Struct4;
-typedef struct MR_FA_PseudoTypeInfo_Struct5 MR_FA_PseudoTypeInfo_Struct5;
-typedef struct MR_FA_PseudoTypeInfo_Struct6 MR_FA_PseudoTypeInfo_Struct6;
-typedef struct MR_FA_PseudoTypeInfo_Struct7 MR_FA_PseudoTypeInfo_Struct7;
-typedef struct MR_FA_PseudoTypeInfo_Struct8 MR_FA_PseudoTypeInfo_Struct8;
-typedef struct MR_FA_PseudoTypeInfo_Struct9 MR_FA_PseudoTypeInfo_Struct9;
-typedef struct MR_FA_PseudoTypeInfo_Struct10 MR_FA_PseudoTypeInfo_Struct10;
-typedef struct MR_FA_PseudoTypeInfo_Struct11 MR_FA_PseudoTypeInfo_Struct11;
-typedef struct MR_FA_PseudoTypeInfo_Struct12 MR_FA_PseudoTypeInfo_Struct12;
-typedef struct MR_FA_PseudoTypeInfo_Struct13 MR_FA_PseudoTypeInfo_Struct13;
-typedef struct MR_FA_PseudoTypeInfo_Struct14 MR_FA_PseudoTypeInfo_Struct14;
-typedef struct MR_FA_PseudoTypeInfo_Struct15 MR_FA_PseudoTypeInfo_Struct15;
-typedef struct MR_FA_PseudoTypeInfo_Struct16 MR_FA_PseudoTypeInfo_Struct16;
-typedef struct MR_FA_PseudoTypeInfo_Struct17 MR_FA_PseudoTypeInfo_Struct17;
-typedef struct MR_FA_PseudoTypeInfo_Struct18 MR_FA_PseudoTypeInfo_Struct18;
-typedef struct MR_FA_PseudoTypeInfo_Struct19 MR_FA_PseudoTypeInfo_Struct19;
-typedef struct MR_FA_PseudoTypeInfo_Struct20 MR_FA_PseudoTypeInfo_Struct20;
-
-typedef struct MR_VA_TypeInfo_Struct1 MR_VA_TypeInfo_Struct0;
-typedef struct MR_VA_TypeInfo_Struct1 MR_VA_TypeInfo_Struct1;
-typedef struct MR_VA_TypeInfo_Struct2 MR_VA_TypeInfo_Struct2;
-typedef struct MR_VA_TypeInfo_Struct3 MR_VA_TypeInfo_Struct3;
-typedef struct MR_VA_TypeInfo_Struct4 MR_VA_TypeInfo_Struct4;
-typedef struct MR_VA_TypeInfo_Struct5 MR_VA_TypeInfo_Struct5;
-typedef struct MR_VA_TypeInfo_Struct6 MR_VA_TypeInfo_Struct6;
-typedef struct MR_VA_TypeInfo_Struct7 MR_VA_TypeInfo_Struct7;
-typedef struct MR_VA_TypeInfo_Struct8 MR_VA_TypeInfo_Struct8;
-typedef struct MR_VA_TypeInfo_Struct9 MR_VA_TypeInfo_Struct9;
-typedef struct MR_VA_TypeInfo_Struct10 MR_VA_TypeInfo_Struct10;
-typedef struct MR_VA_TypeInfo_Struct11 MR_VA_TypeInfo_Struct11;
-typedef struct MR_VA_TypeInfo_Struct12 MR_VA_TypeInfo_Struct12;
-typedef struct MR_VA_TypeInfo_Struct13 MR_VA_TypeInfo_Struct13;
-typedef struct MR_VA_TypeInfo_Struct14 MR_VA_TypeInfo_Struct14;
-typedef struct MR_VA_TypeInfo_Struct15 MR_VA_TypeInfo_Struct15;
-typedef struct MR_VA_TypeInfo_Struct16 MR_VA_TypeInfo_Struct16;
-typedef struct MR_VA_TypeInfo_Struct17 MR_VA_TypeInfo_Struct17;
-typedef struct MR_VA_TypeInfo_Struct18 MR_VA_TypeInfo_Struct18;
-typedef struct MR_VA_TypeInfo_Struct19 MR_VA_TypeInfo_Struct19;
-typedef struct MR_VA_TypeInfo_Struct20 MR_VA_TypeInfo_Struct20;
-
-typedef struct MR_FA_TypeInfo_Struct1 MR_FA_TypeInfo_Struct1;
-typedef struct MR_FA_TypeInfo_Struct2 MR_FA_TypeInfo_Struct2;
-typedef struct MR_FA_TypeInfo_Struct3 MR_FA_TypeInfo_Struct3;
-typedef struct MR_FA_TypeInfo_Struct4 MR_FA_TypeInfo_Struct4;
-typedef struct MR_FA_TypeInfo_Struct5 MR_FA_TypeInfo_Struct5;
-typedef struct MR_FA_TypeInfo_Struct6 MR_FA_TypeInfo_Struct6;
-typedef struct MR_FA_TypeInfo_Struct7 MR_FA_TypeInfo_Struct7;
-typedef struct MR_FA_TypeInfo_Struct8 MR_FA_TypeInfo_Struct8;
-typedef struct MR_FA_TypeInfo_Struct9 MR_FA_TypeInfo_Struct9;
-typedef struct MR_FA_TypeInfo_Struct10 MR_FA_TypeInfo_Struct10;
-typedef struct MR_FA_TypeInfo_Struct11 MR_FA_TypeInfo_Struct11;
-typedef struct MR_FA_TypeInfo_Struct12 MR_FA_TypeInfo_Struct12;
-typedef struct MR_FA_TypeInfo_Struct13 MR_FA_TypeInfo_Struct13;
-typedef struct MR_FA_TypeInfo_Struct14 MR_FA_TypeInfo_Struct14;
-typedef struct MR_FA_TypeInfo_Struct15 MR_FA_TypeInfo_Struct15;
-typedef struct MR_FA_TypeInfo_Struct16 MR_FA_TypeInfo_Struct16;
-typedef struct MR_FA_TypeInfo_Struct17 MR_FA_TypeInfo_Struct17;
-typedef struct MR_FA_TypeInfo_Struct18 MR_FA_TypeInfo_Struct18;
-typedef struct MR_FA_TypeInfo_Struct19 MR_FA_TypeInfo_Struct19;
-typedef struct MR_FA_TypeInfo_Struct20 MR_FA_TypeInfo_Struct20;
-
-/* the next two blocks of #defines are for bootstrapping */
-
-#define	MR_FO_PseudoTypeInfo_Struct0 MR_FA_PseudoTypeInfo_Struct0
-#define	MR_FO_PseudoTypeInfo_Struct1 MR_FA_PseudoTypeInfo_Struct1
-#define	MR_FO_PseudoTypeInfo_Struct2 MR_FA_PseudoTypeInfo_Struct2
-#define	MR_FO_PseudoTypeInfo_Struct3 MR_FA_PseudoTypeInfo_Struct3
-#define	MR_FO_PseudoTypeInfo_Struct4 MR_FA_PseudoTypeInfo_Struct4
-#define	MR_FO_PseudoTypeInfo_Struct5 MR_FA_PseudoTypeInfo_Struct5
-#define	MR_FO_PseudoTypeInfo_Struct6 MR_FA_PseudoTypeInfo_Struct6
-#define	MR_FO_PseudoTypeInfo_Struct7 MR_FA_PseudoTypeInfo_Struct7
-#define	MR_FO_PseudoTypeInfo_Struct8 MR_FA_PseudoTypeInfo_Struct8
-#define	MR_FO_PseudoTypeInfo_Struct9 MR_FA_PseudoTypeInfo_Struct9
-#define	MR_FO_PseudoTypeInfo_Struct10 MR_FA_PseudoTypeInfo_Struct10
-#define	MR_FO_PseudoTypeInfo_Struct11 MR_FA_PseudoTypeInfo_Struct11
-#define	MR_FO_PseudoTypeInfo_Struct12 MR_FA_PseudoTypeInfo_Struct12
-#define	MR_FO_PseudoTypeInfo_Struct13 MR_FA_PseudoTypeInfo_Struct13
-#define	MR_FO_PseudoTypeInfo_Struct14 MR_FA_PseudoTypeInfo_Struct14
-#define	MR_FO_PseudoTypeInfo_Struct15 MR_FA_PseudoTypeInfo_Struct15
-#define	MR_FO_PseudoTypeInfo_Struct16 MR_FA_PseudoTypeInfo_Struct16
-#define	MR_FO_PseudoTypeInfo_Struct17 MR_FA_PseudoTypeInfo_Struct17
-#define	MR_FO_PseudoTypeInfo_Struct18 MR_FA_PseudoTypeInfo_Struct18
-#define	MR_FO_PseudoTypeInfo_Struct19 MR_FA_PseudoTypeInfo_Struct19
-#define	MR_FO_PseudoTypeInfo_Struct20 MR_FA_PseudoTypeInfo_Struct20
-
-#define	MR_HO_PseudoTypeInfo_Struct0 MR_VA_PseudoTypeInfo_Struct0
-#define	MR_HO_PseudoTypeInfo_Struct1 MR_VA_PseudoTypeInfo_Struct1
-#define	MR_HO_PseudoTypeInfo_Struct2 MR_VA_PseudoTypeInfo_Struct2
-#define	MR_HO_PseudoTypeInfo_Struct3 MR_VA_PseudoTypeInfo_Struct3
-#define	MR_HO_PseudoTypeInfo_Struct4 MR_VA_PseudoTypeInfo_Struct4
-#define	MR_HO_PseudoTypeInfo_Struct5 MR_VA_PseudoTypeInfo_Struct5
-#define	MR_HO_PseudoTypeInfo_Struct6 MR_VA_PseudoTypeInfo_Struct6
-#define	MR_HO_PseudoTypeInfo_Struct7 MR_VA_PseudoTypeInfo_Struct7
-#define	MR_HO_PseudoTypeInfo_Struct8 MR_VA_PseudoTypeInfo_Struct8
-#define	MR_HO_PseudoTypeInfo_Struct9 MR_VA_PseudoTypeInfo_Struct9
-#define	MR_HO_PseudoTypeInfo_Struct10 MR_VA_PseudoTypeInfo_Struct10
-#define	MR_HO_PseudoTypeInfo_Struct11 MR_VA_PseudoTypeInfo_Struct11
-#define	MR_HO_PseudoTypeInfo_Struct12 MR_VA_PseudoTypeInfo_Struct12
-#define	MR_HO_PseudoTypeInfo_Struct13 MR_VA_PseudoTypeInfo_Struct13
-#define	MR_HO_PseudoTypeInfo_Struct14 MR_VA_PseudoTypeInfo_Struct14
-#define	MR_HO_PseudoTypeInfo_Struct15 MR_VA_PseudoTypeInfo_Struct15
-#define	MR_HO_PseudoTypeInfo_Struct16 MR_VA_PseudoTypeInfo_Struct16
-#define	MR_HO_PseudoTypeInfo_Struct17 MR_VA_PseudoTypeInfo_Struct17
-#define	MR_HO_PseudoTypeInfo_Struct18 MR_VA_PseudoTypeInfo_Struct18
-#define	MR_HO_PseudoTypeInfo_Struct19 MR_VA_PseudoTypeInfo_Struct19
-#define	MR_HO_PseudoTypeInfo_Struct20 MR_VA_PseudoTypeInfo_Struct20
-
-/*
 ** The chain of stack frames, used for accurate GC.
 **
 ** Any changes to this struct may require changes to
--- ws19.basis/runtime/mercury_bootstrap.h	Fri Apr 12 11:24:22 2002
+++ ws19/runtime/mercury_bootstrap.h	Thu Jul 25 14:39:25 2002
@@ -15,6 +15,94 @@
 #ifndef	MERCURY_BOOTSTRAP_H
 #define	MERCURY_BOOTSTRAP_H
 
+#define	MR_FA_PseudoTypeInfo_Struct0_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct1_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct2_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct3_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct4_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct5_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct6_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct7_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct8_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct9_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct10_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct11_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct12_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct13_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct14_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct15_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct16_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct17_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct18_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct19_GUARD
+#define	MR_FA_PseudoTypeInfo_Struct20_GUARD
+
+#define	MR_VA_PseudoTypeInfo_Struct0_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct1_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct2_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct3_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct4_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct5_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct6_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct7_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct8_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct9_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct10_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct11_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct12_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct13_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct14_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct15_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct16_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct17_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct18_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct19_GUARD
+#define	MR_VA_PseudoTypeInfo_Struct20_GUARD
+
+#define	MR_FA_TypeInfo_Struct0_GUARD
+#define	MR_FA_TypeInfo_Struct1_GUARD
+#define	MR_FA_TypeInfo_Struct2_GUARD
+#define	MR_FA_TypeInfo_Struct3_GUARD
+#define	MR_FA_TypeInfo_Struct4_GUARD
+#define	MR_FA_TypeInfo_Struct5_GUARD
+#define	MR_FA_TypeInfo_Struct6_GUARD
+#define	MR_FA_TypeInfo_Struct7_GUARD
+#define	MR_FA_TypeInfo_Struct8_GUARD
+#define	MR_FA_TypeInfo_Struct9_GUARD
+#define	MR_FA_TypeInfo_Struct10_GUARD
+#define	MR_FA_TypeInfo_Struct11_GUARD
+#define	MR_FA_TypeInfo_Struct12_GUARD
+#define	MR_FA_TypeInfo_Struct13_GUARD
+#define	MR_FA_TypeInfo_Struct14_GUARD
+#define	MR_FA_TypeInfo_Struct15_GUARD
+#define	MR_FA_TypeInfo_Struct16_GUARD
+#define	MR_FA_TypeInfo_Struct17_GUARD
+#define	MR_FA_TypeInfo_Struct18_GUARD
+#define	MR_FA_TypeInfo_Struct19_GUARD
+#define	MR_FA_TypeInfo_Struct20_GUARD
+
+#define	MR_VA_TypeInfo_Struct0_GUARD
+#define	MR_VA_TypeInfo_Struct1_GUARD
+#define	MR_VA_TypeInfo_Struct2_GUARD
+#define	MR_VA_TypeInfo_Struct3_GUARD
+#define	MR_VA_TypeInfo_Struct4_GUARD
+#define	MR_VA_TypeInfo_Struct5_GUARD
+#define	MR_VA_TypeInfo_Struct6_GUARD
+#define	MR_VA_TypeInfo_Struct7_GUARD
+#define	MR_VA_TypeInfo_Struct8_GUARD
+#define	MR_VA_TypeInfo_Struct9_GUARD
+#define	MR_VA_TypeInfo_Struct10_GUARD
+#define	MR_VA_TypeInfo_Struct11_GUARD
+#define	MR_VA_TypeInfo_Struct12_GUARD
+#define	MR_VA_TypeInfo_Struct13_GUARD
+#define	MR_VA_TypeInfo_Struct14_GUARD
+#define	MR_VA_TypeInfo_Struct15_GUARD
+#define	MR_VA_TypeInfo_Struct16_GUARD
+#define	MR_VA_TypeInfo_Struct17_GUARD
+#define	MR_VA_TypeInfo_Struct18_GUARD
+#define	MR_VA_TypeInfo_Struct19_GUARD
+#define	MR_VA_TypeInfo_Struct20_GUARD
+
 /*
 ** These will be needed until we regularize the module-qualification
 ** of builtin types.
--- ws19.basis/runtime/mercury_type_info.h	Tue Jul 30 20:32:51 2002
+++ ws19/runtime/mercury_type_info.h	Tue Jul 30 20:32:13 2002
@@ -96,9 +96,18 @@
 
 /* Forward declarations */
 
+typedef struct MR_TypeCtorInfo_Struct                   MR_TypeCtorInfo_Struct;
 typedef const struct MR_TypeCtorInfo_Struct             *MR_TypeCtorInfo;
 typedef       struct MR_TypeInfo_Almost_Struct          *MR_TypeInfo;
 typedef const struct MR_PseudoTypeInfo_Almost_Struct    *MR_PseudoTypeInfo;
+typedef const void                                      *MR_ReservedAddr;
+typedef union MR_TrieNode                               *MR_TrieNodePtr;
+
+#ifdef  MR_HIGHLEVEL_CODE
+  typedef MR_Box                                        MR_BaseTypeclassInfo;
+#else
+  typedef MR_Code                                       *MR_BaseTypeclassInfo;
+#endif
 
 /*---------------------------------------------------------------------------*/
 
@@ -182,6 +191,72 @@
         MR_VARIABLE_SIZED);
 
 /*
+** Define the C structures and types of all the type_info and pseudo_type_info
+** structures generated by the compiler for types of a given arity.
+**
+** Since standard C doesn't support zero-sized arrays, we use the same
+** definitions for arity zero as for arity one.
+*/
+
+#define MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(Arity)          \
+    typedef MR_FIXED_ARITY_TYPEINFO_STRUCT(                             \
+        MR_PASTE2(MR_FA_TypeInfo_Struct, Arity), Arity)                 \
+        MR_PASTE2(MR_FA_TypeInfo_Struct, Arity);                        \
+    typedef MR_VAR_ARITY_TYPEINFO_STRUCT(                               \
+        MR_PASTE2(MR_VA_TypeInfo_Struct, Arity), Arity)                 \
+        MR_PASTE2(MR_VA_TypeInfo_Struct, Arity);                        \
+    typedef MR_FIXED_ARITY_PSEUDOTYPEINFO_STRUCT(                       \
+        MR_PASTE2(MR_FA_PseudoTypeInfo_Struct, Arity), Arity)           \
+        MR_PASTE2(MR_FA_PseudoTypeInfo_Struct, Arity);                  \
+    typedef MR_VAR_ARITY_PSEUDOTYPEINFO_STRUCT(                         \
+        MR_PASTE2(MR_VA_PseudoTypeInfo_Struct, Arity), Arity)           \
+        MR_PASTE2(MR_VA_PseudoTypeInfo_Struct, Arity);
+
+#define MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY_ZERO            \
+    typedef struct MR_FA_TypeInfo_Struct1 MR_FA_TypeInfo_Struct0;       \
+    typedef struct MR_VA_TypeInfo_Struct1 MR_VA_TypeInfo_Struct0;       \
+    typedef struct MR_FA_PseudoTypeInfo_Struct1 MR_FA_PseudoTypeInfo_Struct0; \
+    typedef struct MR_VA_PseudoTypeInfo_Struct1 MR_VA_PseudoTypeInfo_Struct0;
+
+/*
+** We hard-code the declarations of all four structures (fixed and variable
+** arity type_infos and pseudo_type_infos) for all arities up to twenty.
+** (This number should be kept in sync with max_always_declared_arity in
+** rtti_out.m.) The LLDS back end declares the structures for arities beyond
+** this as necessary. The MLDS back end doesn't (yet) do so, so this imposes
+** a fixed limit on the arities of types. (If this is exceeded, you'll get
+** a parse error in the generated C code, due to an undeclared type.)
+**
+** Note that the generic code for compare and unify for the MLDS back end
+** also has a fixed limit of five on the arity of types (other than
+** higher-order and tuple types, which have no limit). Fortunately types
+** with a high arity tend not to be used very often, so this is probably OK
+** for now...
+*/
+
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY_ZERO;
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(1);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(2);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(3);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(4);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(5);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(6);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(7);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(8);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(9);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(10);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(11);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(12);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(13);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(14);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(15);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(16);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(17);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(18);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(19);
+MR_DECLARE_ALL_TYPE_INFO_LIKE_STRUCTS_FOR_ARITY(20);
+
+/*
 ** When converting a MR_PseudoTypeInfo to a MR_TypeInfo, we need the
 ** MR_TypeInfos corresponding to the type variables in the MR_PseudoTypeInfo.
 ** A MR_TypeInfoParams array serves this purpose. Because type variables
@@ -707,6 +782,8 @@
     const MR_DuExistInfo    *MR_du_functor_exist_info;
 } MR_DuFunctorDesc;
 
+typedef const MR_DuFunctorDesc              *MR_DuFunctorDescPtr;
+
 /*
 ** This macro represents the number of bits in the
 ** MR_du_functor_arg_type_contains_var field of a MR_DuFunctorDesc.
@@ -742,6 +819,8 @@
     MR_int_least32_t    MR_enum_functor_ordinal;
 } MR_EnumFunctorDesc;
 
+typedef const MR_EnumFunctorDesc            *MR_EnumFunctorDescPtr;
+
 /*---------------------------------------------------------------------------*/
 
 typedef struct {
@@ -750,14 +829,18 @@
     MR_ConstString      MR_notag_functor_arg_name;
 } MR_NotagFunctorDesc;
 
+typedef const MR_NotagFunctorDesc           *MR_NotagFunctorDescPtr;
+
 /*---------------------------------------------------------------------------*/
 
 typedef struct {
     MR_ConstString      MR_ra_functor_name;
     MR_int_least32_t    MR_ra_functor_ordinal;
-    const void          *MR_ra_functor_reserved_addr;
+    MR_ReservedAddr     MR_ra_functor_reserved_addr;
 } MR_ReservedAddrFunctorDesc;
 
+typedef const MR_ReservedAddrFunctorDesc    *MR_ReservedAddrFunctorDescPtr;
+
 /*---------------------------------------------------------------------------*/
 
 /*
@@ -822,33 +905,29 @@
 ** This type is used to describe the representation of discriminated unions
 ** where one or more constants in the discriminated union are represented
 ** using reserved addresses.
+**
+** The MR_ra_num_res_numeric_addrs field contains the number of different
+** reserved numeric addresses. The actual numeric addresses reserved will
+** range from 0 (NULL) to one less than the value of this field.
+**
+** The MR_ra_num_res_symbolic_addrs field contains the number of different
+** reserved symbolic addresses, and the MR_ra_res_symbolic_addrs field
+** contains their values.
+**
+** The MR_ra_constants field points to a vector of descriptors for the
+** functors represented by reserved addresses. The descriptors of the functors
+** with numeric addresses precede those with symbolic addresses. The length of
+** the two parts of the vector are given by the values of the first two fields.
+**
+** The MR_ra_other_functors field describes all the functors in the type that
+** are not represented using reserved addresses.
 */
 
 typedef struct {
-    /*
-    ** The number of different reserved numeric addresses.
-    ** The actual numeric addresses reserved will range from 0 (NULL)
-    ** to one less than the value of this field.
-    */
     MR_int_least16_t    MR_ra_num_res_numeric_addrs;
-
-    /*
-    ** The number of different reserved symbolic addresses,
-    ** and their corresponding values.
-    */
     MR_int_least16_t    MR_ra_num_res_symbolic_addrs;
     const void * const *MR_ra_res_symbolic_addrs;
-
-    /*
-    ** The functor descriptors for any constants represented with reserved
-    ** addresses.  Those with numeric addresses precede those with
-    ** symbolic addresses.
-    */
-    const MR_ReservedAddrFunctorDesc * const * MR_ra_constants;
-
-    /*
-    ** The representation of the remaining functors in the type.
-    */
+    MR_ReservedAddrFunctorDescPtr const *MR_ra_constants;
     MR_DuTypeLayout     MR_ra_other_functors;  
 
 } MR_ReservedAddrTypeDesc;
@@ -980,7 +1059,7 @@
 
 /*
 ** The following fields will be added later, once we can exploit them:
-**  union MR_TableNode_Union    **type_std_table;
+**  MR_TrieNodePtr      type_std_table;
 **  MR_ProcAddr         prettyprinter;
 */
 };
Diffing runtime/GETOPT
Diffing runtime/machdeps
Diffing samples
Diffing samples/c_interface
Diffing samples/c_interface/c_calls_mercury
Diffing samples/c_interface/cplusplus_calls_mercury
Diffing samples/c_interface/mercury_calls_c
Diffing samples/c_interface/mercury_calls_cplusplus
Diffing samples/c_interface/mercury_calls_fortran
Diffing samples/c_interface/simpler_c_calls_mercury
Diffing samples/c_interface/simpler_cplusplus_calls_mercury
Diffing samples/diff
Diffing samples/muz
Diffing samples/rot13
Diffing samples/solutions
Diffing samples/tests
Diffing samples/tests/c_interface
Diffing samples/tests/c_interface/c_calls_mercury
Diffing samples/tests/c_interface/cplusplus_calls_mercury
Diffing samples/tests/c_interface/mercury_calls_c
Diffing samples/tests/c_interface/mercury_calls_cplusplus
Diffing samples/tests/c_interface/mercury_calls_fortran
Diffing samples/tests/c_interface/simpler_c_calls_mercury
Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
Diffing samples/tests/diff
Diffing samples/tests/muz
Diffing samples/tests/rot13
Diffing samples/tests/solutions
Diffing samples/tests/toplevel
Diffing scripts
Diffing tests
Diffing tests/benchmarks
Diffing tests/debugger
--- ws19.basis/tests/debugger/breakpoints.exp2	Thu Aug  1 17:54:20 2002
+++ ws19/tests/debugger/breakpoints.exp2	Wed Jul  3 17:01:37 2002
@@ -39,23 +39,21 @@
 Ambiguous procedure specification. The matches are:
 0: func breakpoints://2-0 (det)
 1: func breakpoints:print_list://2-0 (det)
-2: func dir://2-0 (det)
-3: func float://2-0 (det)
-4: func int://2-0 (det)
-5: func rational://2-0 (det)
+2: func float://2-0 (det)
+3: func int://2-0 (det)
+4: func rational://2-0 (det)
 
-Which do you want to put a breakpoint on (0-5 or *)? 0
+Which do you want to put a breakpoint on (0-4 or *)? 0
  5: + stop  interface func breakpoints://2-0 (det)
 mdb> break //2
 Ambiguous procedure specification. The matches are:
 0: func breakpoints://2-0 (det)
 1: func breakpoints:print_list://2-0 (det)
-2: func dir://2-0 (det)
-3: func float://2-0 (det)
-4: func int://2-0 (det)
-5: func rational://2-0 (det)
+2: func float://2-0 (det)
+3: func int://2-0 (det)
+4: func rational://2-0 (det)
 
-Which do you want to put a breakpoint on (0-5 or *)? 0
+Which do you want to put a breakpoint on (0-4 or *)? 0
  6: + stop  interface func breakpoints://2-0 (det)
 mdb> break breakpoints:print_list:-/2
  7: + stop  interface func breakpoints:print_list:-/2-0 (det)
Diffing tests/debugger/declarative
Diffing tests/dppd
Diffing tests/general
Diffing tests/general/accumulator
Diffing tests/general/structure_reuse
Diffing tests/hard_coded
Diffing tests/hard_coded/exceptions
Diffing tests/hard_coded/purity
Diffing tests/hard_coded/sub-modules
Diffing tests/hard_coded/typeclasses
Diffing tests/invalid
Diffing tests/invalid/purity
Diffing tests/misc_tests
Diffing tests/recompilation
Diffing tests/tabling
Diffing tests/term
Diffing tests/valid
Diffing tests/warnings
Diffing tools
Diffing trace
Diffing util
Diffing vim
Diffing vim/after
Diffing vim/ftplugin
Diffing vim/syntax
--------------------------------------------------------------------------
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