[m-rev.] diff: box value classes on IL backend

Peter Ross peter.ross at miscrit.be
Wed Jan 16 12:06:59 AEDT 2002


On Mon, Jan 14, 2002 at 10:35:24PM +1100, Tyson Dowd wrote:
> On 14-Jan-2002, Peter Ross <peter.ross at miscrit.be> wrote:
> > Hi,
> > 
> > 
> > ===================================================================
> > 
> > 
> > Estimated hours taken: 12
> > Branches: main
> > 
> > Fix a bug where value classes introduced by pragma foreign type's were
> > not being boxed.  Note that we don't detect all possible value classes
> > just the ones which are represented specially by the .NET backend.
> > 
> > ilasm.m:
> >     Move name_to_simple_type to the interface.
> > 
> > mlds_to_il.m:
> >     Check whether a class is a value class before deciding whether or
> >     not it has been already boxed.
> 
> 
> I don't see how this code can be buggy, or that this is a fix for the
> code.
> 
How about the following, I have checked it in, but would still
appreciate review comments.

===================================================================


Estimated hours taken: 4
Branches: main

Allow the foreign_type declaration to accept value types.

compiler/prog_data.m:
    Add an indicator to il foreign types whether or not they are
    reference or value types.

compiler/prog_io_pragma.m:
    Parse whether or not the foreign type is a reference or a value type.

compiler/make_hlds.m:
    Decide whether or not a foreign_type is already boxed.

compiler/hlds_data.m:
compiler/mlds.m:
    Add to the foreign_type an indicator of whether or not it is already
    boxed.

compiler/mlds_to_il.m:
    Remove code which attempted to determine when a value type was
    incorrectly defined as a reference type.
    Unboxed types on the .NET backend are value types.
    Fix a bug where converting a value_class to a value_class was
    failing.

compiler/ilasm.m:
    Remove name_to_simple_type from the interface as it is no longer
    needed in mlds_to_il.

compiler/mercury_to_mercury.m:
    Output the new foreign_type format.

compiler/foreign.m:
compiler/hlds_out.m:
compiler/intermod.m:
compiler/magic_util.m:
compiler/ml_code_gen.m:
compiler/ml_code_util.m:
compiler/ml_type_gen.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_java.m:
compiler/recompilation_usage.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unify_proc.m:
    Changes to handle the boxed indicator.


doc/reference_manual.texi:
    Document how to specify a value type.


Index: compiler/foreign.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/foreign.m,v
retrieving revision 1.9
diff -u -r1.9 foreign.m
--- compiler/foreign.m	6 Nov 2001 15:20:41 -0000	1.9
+++ compiler/foreign.m	16 Jan 2002 00:53:45 -0000
@@ -581,7 +581,7 @@
 		map__search(Types, TypeId, TypeDefn)
 	->
 		hlds_data__get_type_defn_body(TypeDefn, Body),
-		( Body = foreign_type(ForeignType, _) ->
+		( Body = foreign_type(_, ForeignType, _) ->
 			ExportType = foreign(ForeignType)
 		;
 			ExportType = mercury(Type)
Index: compiler/hlds_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.62
diff -u -r1.62 hlds_data.m
--- compiler/hlds_data.m	6 Dec 2001 09:27:34 -0000	1.62
+++ compiler/hlds_data.m	16 Jan 2002 00:53:45 -0000
@@ -292,6 +292,7 @@
 	;	uu_type(list(type))	% not yet implemented!
 	;	eqv_type(type)
 	;	foreign_type(
+			bool,		% is the type already boxed
 			sym_name,	% structured name of foreign type
 					% which represents the mercury type.
 			string		% Location of the definition for this
Index: compiler/hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.271
diff -u -r1.271 hlds_out.m
--- compiler/hlds_out.m	31 Oct 2001 14:02:54 -0000	1.271
+++ compiler/hlds_out.m	16 Jan 2002 00:53:45 -0000
@@ -2669,7 +2669,7 @@
 hlds_out__write_type_body(_Indent, _Tvarset, abstract_type) -->
 	io__write_string(".\n").
 
-hlds_out__write_type_body(_Indent, _Tvarset, foreign_type(_, _)) -->
+hlds_out__write_type_body(_Indent, _Tvarset, foreign_type(_, _, _)) -->
 	{ error("hlds_out__write_type_body: foreign type body found") }.
 
 :- pred hlds_out__write_constructors(int, tvarset, list(constructor),
Index: compiler/ilasm.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ilasm.m,v
retrieving revision 1.28
diff -u -r1.28 ilasm.m
--- compiler/ilasm.m	14 Jan 2002 04:23:57 -0000	1.28
+++ compiler/ilasm.m	16 Jan 2002 00:53:45 -0000
@@ -269,15 +269,6 @@
 	--->	type(ilds__type)
 	;	methodref(ilds__methodref).
 
-:- type ref_or_value
-	--->	reference(simple_type)
-	;	value(simple_type).
-
-	% If possible converts a class name to a simple type and an
-	% indicator of whether or not that simple type is a reference or
-	% value class.
-:- pred name_to_simple_type(class_name::in, ref_or_value::out) is semidet.
-
 :- implementation.
 
 :- import_module char, string, pprint, getopt.
@@ -746,6 +737,15 @@
 output_simple_type('&'(Type), Info0, Info) --> 
 	output_type(Type, Info0, Info),
 	io__write_string("&").
+
+:- type ref_or_value
+	--->	reference(simple_type)
+	;	value(simple_type).
+
+	% If possible converts a class name to a simple type and an
+	% indicator of whether or not that simple type is a reference or
+	% value class.
+:- pred name_to_simple_type(class_name::in, ref_or_value::out) is semidet.
 
 name_to_simple_type(Name, Type) :-
 		% Parition II section 'Built-in Types' (7.2 in Beta2) states
Index: compiler/intermod.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/intermod.m,v
retrieving revision 1.110
diff -u -r1.110 intermod.m
--- compiler/intermod.m	8 Jan 2002 06:44:17 -0000	1.110
+++ compiler/intermod.m	16 Jan 2002 00:53:46 -0000
@@ -1218,7 +1218,7 @@
 		{ Body = abstract_type },
 		{ TypeBody = abstract_type }
 	;
-		{ Body = foreign_type(_, _) },
+		{ Body = foreign_type(_, _, _) },
 		{ TypeBody = abstract_type },
 			% XXX trd
 			% Also here we need to output the pragma
Index: compiler/magic_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/magic_util.m,v
retrieving revision 1.15
diff -u -r1.15 magic_util.m
--- compiler/magic_util.m	24 Oct 2001 13:34:19 -0000	1.15
+++ compiler/magic_util.m	16 Jan 2002 00:53:46 -0000
@@ -1379,7 +1379,7 @@
 	{ error("magic_util__check_type_defn: eqv_type") }.
 magic_util__check_type_defn(abstract_type, _, Errors0, Errors) -->
 	{ set__insert(Errors0, abstract, Errors) }.
-magic_util__check_type_defn(foreign_type(_, _), _, _, _) -->
+magic_util__check_type_defn(foreign_type(_, _, _), _, _, _) -->
 	{ error("magic_util__check_type_defn: foreign_type") }.
 
 :- pred magic_util__check_ctor(set(type_id)::in, constructor::in, 
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.396
diff -u -r1.396 make_hlds.m
--- compiler/make_hlds.m	11 Jan 2002 07:46:22 -0000	1.396
+++ compiler/make_hlds.m	16 Jan 2002 00:53:46 -0000
@@ -397,11 +397,19 @@
 	;	
 		{ Pragma = foreign_type(ForeignType, _MercuryType, Name) },
 
-		{ ForeignType = il(ForeignTypeLocation, ForeignTypeName) },
+		{ ForeignType = il(RefOrVal,
+				ForeignTypeLocation, ForeignTypeName) },
+
+		{ RefOrVal = reference,
+			IsBoxed = yes
+		; RefOrVal = value,
+			IsBoxed = no
+		},
 
 		{ varset__init(VarSet) },
 		{ Args = [] },
-		{ Body = foreign_type(ForeignTypeName, ForeignTypeLocation) },
+		{ Body = foreign_type(IsBoxed,
+				ForeignTypeName, ForeignTypeLocation) },
 		{ Cond = true },
 
 		{ TypeId = Name - 0 },
Index: compiler/mercury_to_mercury.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.200
diff -u -r1.200 mercury_to_mercury.m
--- compiler/mercury_to_mercury.m	15 Jan 2002 23:42:33 -0000	1.200
+++ compiler/mercury_to_mercury.m	16 Jan 2002 00:53:47 -0000
@@ -468,15 +468,17 @@
 	;
 		{ Pragma = foreign_type(ForeignType, _MercuryType,
 				MercuryTypeSymName) },
-		io__write_string(":- pragma foreign_type("),
+		{ ForeignType = il(RefOrVal, ForeignLocStr, ForeignTypeName) },
 
-		{ ForeignType = il(ForeignLocStr, ForeignTypeName) },
+		io__write_string(":- pragma foreign_type("),
 		io__write_string("il, "),
-
-		% output_type(varset__init, no, MercuryType),
 		mercury_output_sym_name(MercuryTypeSymName),
 		io__write_string(", "),
-		io__write_string("\"class ["),
+		( { RefOrVal = reference },
+			io__write_string("\"class [")
+		; { RefOrVal = value },
+			io__write_string("\"valuetype [")
+		),
 		io__write_string(ForeignLocStr),
 		io__write_string("]"),
 		{ sym_name_to_string(ForeignTypeName, ".", ForeignTypeStr) },
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.106
diff -u -r1.106 ml_code_gen.m
--- compiler/ml_code_gen.m	11 Jan 2002 07:41:23 -0000	1.106
+++ compiler/ml_code_gen.m	16 Jan 2002 00:53:47 -0000
@@ -858,7 +858,7 @@
 	module_info_types(ModuleInfo, Types),
 	list__filter_map((pred(TypeDefn::in, Import::out) is semidet :-
 			hlds_data__get_type_defn_body(TypeDefn, Body),
-			Body = foreign_type(_, Location),
+			Body = foreign_type(_, _, Location),
 			Name = il_assembly_name(mercury_module_name_to_mlds(
 					unqualified(Location))),
 			Import = foreign_import(Name)
Index: compiler/ml_code_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_util.m,v
retrieving revision 1.49
diff -u -r1.49 ml_code_util.m
--- compiler/ml_code_util.m	11 Jan 2002 07:41:24 -0000	1.49
+++ compiler/ml_code_util.m	16 Jan 2002 00:53:47 -0000
@@ -2042,7 +2042,7 @@
 ml_type_might_contain_pointers(mlds__native_float_type) = no.
 ml_type_might_contain_pointers(mlds__native_bool_type) = no.
 ml_type_might_contain_pointers(mlds__native_char_type) = no.
-ml_type_might_contain_pointers(mlds__foreign_type(_, _)) = yes.
+ml_type_might_contain_pointers(mlds__foreign_type(_, _, _)) = yes.
 ml_type_might_contain_pointers(mlds__class_type(_, _, Category)) =
 	(if Category = mlds__enum then no else yes).
 ml_type_might_contain_pointers(mlds__ptr_type(_)) = yes.
Index: compiler/ml_type_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_type_gen.m,v
retrieving revision 1.20
diff -u -r1.20 ml_type_gen.m
--- compiler/ml_type_gen.m	11 Jan 2002 07:41:25 -0000	1.20
+++ compiler/ml_type_gen.m	16 Jan 2002 00:53:47 -0000
@@ -126,7 +126,7 @@
 			Ctors, TagValues, MaybeEqualityMembers)
 	).
 	% XXX Fixme!  Same issues here as for eqv_type/1.
-ml_gen_type_2(foreign_type(_, _), _, _, _) --> [].
+ml_gen_type_2(foreign_type(_, _, _), _, _, _) --> [].
 
 %-----------------------------------------------------------------------------%
 %
Index: compiler/mlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds.m,v
retrieving revision 1.79
diff -u -r1.79 mlds.m
--- compiler/mlds.m	11 Jan 2002 07:41:26 -0000	1.79
+++ compiler/mlds.m	16 Jan 2002 00:53:47 -0000
@@ -627,6 +627,7 @@
 		% This is a type of the MLDS target language.  Currently
 		% this is only used by the il backend.
 	;	mlds__foreign_type(
+			bool,		% is type already boxed?
 			sym_name,	% structured name representing the type
 			string		% location of the type (ie assembly)
 		)
@@ -1602,9 +1603,10 @@
 		module_info_types(ModuleInfo, Types),
 		map__search(Types, TypeId, TypeDefn),
 		hlds_data__get_type_defn_body(TypeDefn, Body),
-		Body = foreign_type(ForeignType, ForeignLocation)
+		Body = foreign_type(IsBoxed, ForeignType, ForeignLocation)
 	->
-		MLDSType = mlds__foreign_type(ForeignType, ForeignLocation)
+		MLDSType = mlds__foreign_type(IsBoxed,
+				ForeignType, ForeignLocation)
 	;
 		classify_type(Type, ModuleInfo, Category),
 		ExportedType = to_exported_type(ModuleInfo, Type),
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.113
diff -u -r1.113 mlds_to_c.m
--- compiler/mlds_to_c.m	11 Jan 2002 07:41:27 -0000	1.113
+++ compiler/mlds_to_c.m	16 Jan 2002 00:53:47 -0000
@@ -660,7 +660,7 @@
 	io__write_string("MR_Float").
 mlds_output_pragma_export_type(prefix, mlds__native_char_type) -->
 	io__write_string("MR_Char").
-mlds_output_pragma_export_type(prefix, mlds__foreign_type(_, _)) -->
+mlds_output_pragma_export_type(prefix, mlds__foreign_type(_, _, _)) -->
 	{ error("mlds_output_pragma_export_type: foreign_type") }.
 mlds_output_pragma_export_type(prefix, mlds__class_type(_, _, _)) -->
 	io__write_string("MR_Word").
@@ -1616,7 +1616,7 @@
 mlds_output_type_prefix(mlds__native_float_type) --> io__write_string("float").
 mlds_output_type_prefix(mlds__native_bool_type)  --> io__write_string("bool").
 mlds_output_type_prefix(mlds__native_char_type)  --> io__write_string("char").
-mlds_output_type_prefix(mlds__foreign_type(_, _)) -->
+mlds_output_type_prefix(mlds__foreign_type(_, _, _)) -->
 	{ error("mlds_output_type_prefix: foreign_type") }.
 mlds_output_type_prefix(mlds__class_type(Name, Arity, ClassKind)) -->
 	( { ClassKind = mlds__enum } ->
@@ -1784,7 +1784,7 @@
 mlds_output_type_suffix(mlds__native_float_type, _) --> [].
 mlds_output_type_suffix(mlds__native_bool_type, _) --> [].
 mlds_output_type_suffix(mlds__native_char_type, _) --> [].
-mlds_output_type_suffix(mlds__foreign_type(_, _), _) --> [].
+mlds_output_type_suffix(mlds__foreign_type(_, _, _), _) --> [].
 mlds_output_type_suffix(mlds__class_type(_, _, _), _) --> [].
 mlds_output_type_suffix(mlds__ptr_type(_), _) --> [].
 mlds_output_type_suffix(mlds__array_type(_), ArraySize) -->
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.56
diff -u -r1.56 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	11 Jan 2002 07:41:29 -0000	1.56
+++ compiler/mlds_to_gcc.m	16 Jan 2002 00:53:47 -0000
@@ -1683,7 +1683,7 @@
 	).
 build_type(mercury_type(Type, TypeCategory, _), _, _, GCC_Type) -->
 	build_mercury_type(Type, TypeCategory, GCC_Type).
-build_type(mlds__foreign_type(_, _), _, _, _) --> 
+build_type(mlds__foreign_type(_, _, _), _, _, _) --> 
 	{ sorry(this_file, "foreign_type not implemented") }.
 build_type(mlds__native_int_type, _, _, gcc__integer_type_node) --> [].
 build_type(mlds__native_float_type, _, _, gcc__double_type_node) --> [].
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.94
diff -u -r1.94 mlds_to_il.m
--- compiler/mlds_to_il.m	14 Jan 2002 04:23:57 -0000	1.94
+++ compiler/mlds_to_il.m	16 Jan 2002 00:53:48 -0000
@@ -2468,12 +2468,7 @@
 	}.
 
 :- pred already_boxed(ilds__type::in) is semidet.
-already_boxed(ilds__type(_, class(Name))) :-
-		% XXX Value classes are not already boxed, this call
-		% catches some of the value classes (which can be
-		% introduced by a :- pragma foreign_type), but not all
-		% possible values classes.
-	\+ name_to_simple_type(Name, value(_)).
+already_boxed(ilds__type(_, class(_))).
 already_boxed(ilds__type(_, '[]'(_, _))).
 
 :- pred binaryop_to_il(binary_op, instr_tree, il_info,
@@ -2927,11 +2922,16 @@
 
 mlds_type_to_ilds_type(_, mlds__native_float_type) = ilds__type([], float64).
 
-mlds_type_to_ilds_type(_, mlds__foreign_type(ForeignType, Assembly))
+mlds_type_to_ilds_type(_, mlds__foreign_type(IsBoxed, ForeignType, Assembly))
 	= ilds__type([], Class) :-
 	sym_name_to_class_name(ForeignType, ForeignClassName),
-	Class = class(structured_name(assembly(Assembly),
-			ForeignClassName, [])).
+	( IsBoxed = yes,
+		Class = class(structured_name(assembly(Assembly),
+				ForeignClassName, []))
+	; IsBoxed = no,
+		Class = value_class(structured_name(assembly(Assembly),
+				ForeignClassName, []))
+	).
 
 mlds_type_to_ilds_type(ILDataRep, mlds__ptr_type(MLDSType)) =
 	ilds__type([], '&'(mlds_type_to_ilds_type(ILDataRep, MLDSType))).
@@ -3680,14 +3680,10 @@
 	error("no value class for System.String").
 simple_type_to_value_class(refany) = _ :-
 	error("no value class for refany").
-simple_type_to_value_class(class(Name)) = Result :-
-	( name_to_simple_type(Name, value(Simple)) ->
-		Result = simple_type_to_value_class(Simple)
-	;
-		error("no value class for class")
-	).
-simple_type_to_value_class(value_class(_)) = _ :-
-	error("no value class for value_class").
+simple_type_to_value_class(class(Name)) = _ :-
+	error("no value class for class").
+simple_type_to_value_class(value_class(Name)) =
+	ilds__type([], value_class(Name)).
 simple_type_to_value_class(interface(_)) = _ :-
 	error("no value class for interface").
 simple_type_to_value_class('[]'(_, _)) = _ :-
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.17
diff -u -r1.17 mlds_to_java.m
--- compiler/mlds_to_java.m	11 Jan 2002 07:41:30 -0000	1.17
+++ compiler/mlds_to_java.m	16 Jan 2002 00:53:48 -0000
@@ -870,7 +870,7 @@
 get_java_type_initializer(mlds__native_int_type) = "0".
 get_java_type_initializer(mlds__native_float_type) = "0".
 get_java_type_initializer(mlds__native_char_type) = "0".
-get_java_type_initializer(mlds__foreign_type(_, _)) = _ :-
+get_java_type_initializer(mlds__foreign_type(_, _, _)) = _ :-
 	unexpected(this_file, 
 		"get_type_initializer: variable has foreign_type"). 
 get_java_type_initializer(mlds__class_type(_, _, _)) = "null".
@@ -1226,7 +1226,7 @@
 output_type(mlds__native_float_type) --> io__write_string("double").
 output_type(mlds__native_bool_type) --> io__write_string("boolean").
 output_type(mlds__native_char_type)  --> io__write_string("char").
-output_type(mlds__foreign_type(_, _))  -->
+output_type(mlds__foreign_type(_, _, _))  -->
 	{ unexpected(this_file, "output_type: foreign_type NYI.") }.
 output_type(mlds__class_type(Name, Arity, ClassKind)) -->
 	( { ClassKind = mlds__enum } ->
Index: compiler/prog_data.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_data.m,v
retrieving revision 1.73
diff -u -r1.73 prog_data.m
--- compiler/prog_data.m	12 Dec 2001 00:30:13 -0000	1.73
+++ compiler/prog_data.m	16 Jan 2002 00:53:49 -0000
@@ -294,10 +294,16 @@
 	% Currently we only support foreign_language_types for IL.
 	%
 
+:- type ref_or_val
+	--->	reference
+	;	value.
+
 :- type foreign_language_type
+			% An indicator of whether the type is a
+			% reference of value type.
 			% The location of the .NET name (the assembly),
 			% and the .NET type name (represented as a sym_name)
-	--->	il(string, sym_name).
+	--->	il(ref_or_val, string, sym_name).
 
 %
 % Stuff for tabling pragmas
Index: compiler/prog_io_pragma.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/prog_io_pragma.m,v
retrieving revision 1.39
diff -u -r1.39 prog_io_pragma.m
--- compiler/prog_io_pragma.m	12 Dec 2001 00:30:13 -0000	1.39
+++ compiler/prog_io_pragma.m	16 Jan 2002 00:53:50 -0000
@@ -238,7 +238,15 @@
 		string__left(String1, Index, AssemblyName),
 		string__split(String1, Index + 1, _, TypeNameStr),
 		string_to_sym_name(TypeNameStr, ".", TypeSymName),
-		ForeignType = ok(il(AssemblyName, TypeSymName))
+		ForeignType = ok(il(reference, AssemblyName, TypeSymName))
+	;
+		string__append("valuetype [", String1, String0),
+		string__sub_string_search(String1, "]", Index)
+	->
+		string__left(String1, Index, AssemblyName),
+		string__split(String1, Index + 1, _, TypeNameStr),
+		string_to_sym_name(TypeNameStr, ".", TypeSymName),
+		ForeignType = ok(il(value, AssemblyName, TypeSymName))
 	;
 		ForeignType = error(
 			"invalid foreign language type description", ErrorTerm)
Index: compiler/recompilation_usage.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_usage.m,v
retrieving revision 1.3
diff -u -r1.3 recompilation_usage.m
--- compiler/recompilation_usage.m	24 Oct 2001 13:34:37 -0000	1.3
+++ compiler/recompilation_usage.m	16 Jan 2002 00:53:50 -0000
@@ -1026,7 +1026,7 @@
 recompilation_usage__find_items_used_by_type_body(uu_type(Types)) -->
 	recompilation_usage__find_items_used_by_types(Types).
 recompilation_usage__find_items_used_by_type_body(abstract_type) --> [].
-recompilation_usage__find_items_used_by_type_body(foreign_type(_, _)) --> [].
+recompilation_usage__find_items_used_by_type_body(foreign_type(_, _, _)) --> [].
 
 :- pred recompilation_usage__find_items_used_by_mode_defn(hlds_mode_defn::in,
 	recompilation_usage_info::in, recompilation_usage_info::out) is det.
Index: compiler/term_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/term_util.m,v
retrieving revision 1.15
diff -u -r1.15 term_util.m
--- compiler/term_util.m	24 Oct 2001 13:34:37 -0000	1.15
+++ compiler/term_util.m	16 Jan 2002 00:53:52 -0000
@@ -270,7 +270,7 @@
 		Weights = Weights0
 	;
 		% This type does not introduce any functors
-		TypeBody = foreign_type(_, _),
+		TypeBody = foreign_type(_, _, _),
 		Weights = Weights0
 	).
 
Index: compiler/type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.18
diff -u -r1.18 type_ctor_info.m
--- compiler/type_ctor_info.m	31 Dec 2001 04:26:41 -0000	1.18
+++ compiler/type_ctor_info.m	16 Jan 2002 00:53:52 -0000
@@ -261,7 +261,7 @@
 		TypeTables = [],
 		NumPtags = -1
 	;
-		TypeBody = foreign_type(_, _),
+		TypeBody = foreign_type(_, _, _),
 		TypeCtorRep = unknown,
 		NumFunctors = -1,
 		FunctorsInfo = no_functors,
Index: compiler/unify_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.98
diff -u -r1.98 unify_proc.m
--- compiler/unify_proc.m	4 Jan 2002 07:50:07 -0000	1.98
+++ compiler/unify_proc.m	16 Jan 2002 00:53:55 -0000
@@ -760,7 +760,7 @@
 		unify_proc__quantify_clauses_body([H1, H2], Goal, Context,
 			Clauses)
 	;
-		{ TypeBody = foreign_type(_, _) },
+		{ TypeBody = foreign_type(_, _, _) },
 			% XXX Is this the correct thing to do?
 			% I assume at code gen time I could examine the types
 			% of the unification and output different code because
@@ -823,7 +823,7 @@
 		% invoked.
 		{ error("trying to create index proc for eqv type") }
 	;
-		{ TypeBody = foreign_type(_, _) },
+		{ TypeBody = foreign_type(_, _, _) },
 		{ error("trying to create index proc for a foreign type") }
 	;
 		{ TypeBody = uu_type(_) },
@@ -903,7 +903,7 @@
 		unify_proc__quantify_clauses_body([Res, H1, H2], Goal, Context,
 			Clauses)
 	;
-		{ TypeBody = foreign_type(_, _) },
+		{ TypeBody = foreign_type(_, _, _) },
 		% XXX
 		% I think we should delay handling this for foreign types until
 		% code gen time.
Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.235
diff -u -r1.235 reference_manual.texi
--- doc/reference_manual.texi	12 Dec 2001 00:30:22 -0000	1.235
+++ doc/reference_manual.texi	16 Jan 2002 00:54:03 -0000
@@ -5464,9 +5464,13 @@
 languages (IL, C# and Managed C++) supported by Mercury's
 @samp{foreign_proc} mechanism.  
 This syntax is documented in the ECMA specifications for .NET).
-Currently on the .NET CLR backend only reference classes are supported using
- at samp{pragma foreign_type}, and hence the only supported syntax for
-DotNetForeignType is @samp{"class [AssemblyName]ClassName"}.
+Currently on the .NET CLR backend reference and value types are
+supported using
+ at samp{pragma foreign_type}, and hence the supported syntax is
+DotNetForeignType is @samp{"class [AssemblyName]ReferenceTypeName"} for
+reference types and
+DotNetForeignType is @samp{"valuetype [AssemblyName]ValueTypeName"} for
+value types.
 @c XXX this restriction should be lifted
 Note that extra whitespace is not handled --- there should only be a single
 space between the class keyword and the assembly specifier.

--------------------------------------------------------------------------
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