[m-rev.] for review: fix IL grade array type-info bugs

Simon Taylor stayl at cs.mu.OZ.AU
Thu Jul 17 19:09:05 AEST 2003


Estimated hours taken: 3
Branches: main

Fix bugs in Zoltan's change to make array.array/1 a foreign type
which broke the IL backend, causing IL compilation errors when
compiling the standard library.

compiler/mlds_to_il.m:
	The type_ctor_info isn't defined in MC++ any more, so don't
	look for it in array__cpp_code.dll.

compiler/rtti.m:
compiler/type_ctor_info.m:
	Don't handle array as a special case.

	Array isn't builtin any more, so generate it as a foreign
	type, with the exception that the type_ctor_rep is
	TYPECTOR_REP_ARRAY, not TYPECTOR_REP_FOREIGN. This is
	needed so that accurate GC can trace arrays.

Index: mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.130
diff -u -u -r1.130 mlds_to_il.m
--- mlds_to_il.m	9 May 2003 00:45:08 -0000	1.130
+++ mlds_to_il.m	17 Jul 2003 07:00:15 -0000
@@ -3355,10 +3355,6 @@
 				; Name = "func", Arity = 0
 				; Name = "tuple", Arity = 0
 				)
-			; LibModuleName0 = "array", 
-				(
-				  Name = "array", Arity = 1
-				)
 			; LibModuleName0 = "type_desc",
 				( 
 				  Name = "type_desc", Arity = 0
Index: rtti.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/rtti.m,v
retrieving revision 1.33
diff -u -u -r1.33 rtti.m
--- rtti.m	8 Jul 2003 10:29:57 -0000	1.33
+++ rtti.m	17 Jul 2003 09:07:29 -0000
@@ -372,7 +372,6 @@
 	;	pred_ctor
 	;	func_ctor
 	;	tuple
-	;	array
 	;	ref
 	;	type_desc
 	;	type_ctor_desc.
@@ -1113,12 +1112,23 @@
 		impl_ctor_rep_to_string(ImplCtor, RepStr)
 	;
 		TypeCtorDetails = foreign,
-		RepStr = "MR_TYPECTOR_REP_FOREIGN"
+		(
+			type_ctor_is_array(
+				qualified(TypeCtorData ^ tcr_module_name,
+					TypeCtorData ^ tcr_type_name) -
+					TypeCtorData ^ tcr_arity)
+		->
+			% XXX This is a kludge to allow accurate GC
+			% to trace arrays. We should allow users to
+			% provide tracing functions for foreign types.
+			RepStr = "MR_TYPECTOR_REP_ARRAY"
+		;
+			RepStr = "MR_TYPECTOR_REP_FOREIGN"
+		)
 	).
 
 :- pred builtin_ctor_rep_to_string(builtin_ctor::in, string::out) is det.
 
-builtin_ctor_rep_to_string(array, "MR_TYPECTOR_REP_ARRAY").
 builtin_ctor_rep_to_string(int, "MR_TYPECTOR_REP_INT").
 builtin_ctor_rep_to_string(string, "MR_TYPECTOR_REP_STRING").
 builtin_ctor_rep_to_string(float, "MR_TYPECTOR_REP_FLOAT").
Index: type_ctor_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_ctor_info.m,v
retrieving revision 1.41
diff -u -u -r1.41 type_ctor_info.m
--- type_ctor_info.m	3 Jul 2003 12:11:17 -0000	1.41
+++ type_ctor_info.m	17 Jul 2003 07:00:15 -0000
@@ -310,7 +310,6 @@
 :- pred builtin_type_ctor(string::in, string::in, int::in, builtin_ctor::out)
 	is semidet.
 
-builtin_type_ctor("array", "array", 1, array).
 builtin_type_ctor("builtin", "int", 0, int).
 builtin_type_ctor("builtin", "string", 0, string).
 builtin_type_ctor("builtin", "float", 0, float).
--------------------------------------------------------------------------
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