[m-rev.] for review: ROTOR fixes

Peter Ross pro at missioncriticalit.com
Wed Mar 5 21:38:41 AEDT 2003


Hi,

For fjh to review.

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


Estimated hours taken: 3
Branches: main

Get the mercury compiler working with ROTOR.  The MS shared source CLI
implementation.

compiler/mlds_to_il.m:
	ROTOR doesn't allow calli calls to be made tail calls, so
	don't make them tail calls.
	
library/array.m:
	Fix some function signatures which were incorrectly declared
	as returning int rather than MR_bool, which the MS CLR accepts
	but ROTOR doesn't.
	
runtime/mercury_il.il:
	Remove the tail. prefix to the calli instructions.

Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.126
diff -u -r1.126 mlds_to_il.m
--- compiler/mlds_to_il.m	13 Feb 2003 06:03:10 -0000	1.126
+++ compiler/mlds_to_il.m	5 Mar 2003 10:30:59 -0000
@@ -1619,7 +1619,10 @@
 		\+ (
 			{ MsCLR = yes },
 			{ ReturnParam \= CallerReturnParam }
-		)
+		),
+		% The ROTOR implementation only allows const calls to be tail
+		% calls.
+		{ Function = const(_) }
 	->
 		{ TailCallInstrs = [tailcall] },
 		% For calls marked with "tail.", we need a `ret'
Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.119
diff -u -r1.119 array.m
--- library/array.m	22 Feb 2003 11:17:34 -0000	1.119
+++ library/array.m	5 Mar 2003 10:31:08 -0000
@@ -601,7 +601,7 @@
 :- pragma foreign_code("MC++", "
     MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(array, array, 1, MR_TYPECTOR_REP_ARRAY)
 
-    static int
+    static MR_bool
     special___Unify___array_1_0(MR_TypeInfo type_info, MR_Array x, MR_Array y)
     {
             return mercury::array::mercury_code::ML_array_equal(
@@ -616,7 +616,7 @@
 	    	type_info, result, x, y);
     }
 
-    static int
+    static MR_bool
     do_unify__array_1_0(MR_TypeInfo type_info, MR_Box x, MR_Box y)
     {
             return mercury::array__cpp_code::mercury_code::special___Unify___array_1_0(
Index: runtime/mercury_il.il
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_il.il,v
retrieving revision 1.20
diff -u -r1.20 mercury_il.il
--- runtime/mercury_il.il	3 Mar 2003 14:45:30 -0000	1.20
+++ runtime/mercury_il.il	5 Mar 2003 10:31:08 -0000
@@ -377,7 +377,8 @@
 	ldarg 'procedure'
 	unbox int32
 	ldobj int32
-	tail.
+	// XXX ROTOR doesn't allow tail.calli
+	// tail.
 	calli	bool (class [mscorlib]System.Object, class [mscorlib]System.Object)
 	ret
 }
@@ -393,7 +394,8 @@
 	ldarg 'procedure'
 	unbox int32
 	ldobj int32
-	tail.
+	// XXX ROTOR doesn't allow tail.calli
+	// tail.
 	calli	bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
 	ret
 }
@@ -409,7 +411,8 @@
 	ldarg 'procedure'
 	unbox int32
 	ldobj int32
-	tail.
+	// XXX ROTOR doesn't allow tail.calli
+	// tail.
 	calli	bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
 	ret
 }
@@ -427,7 +430,8 @@
 	ldarg 'procedure'
 	unbox int32
 	ldobj int32
-	tail.
+	// XXX ROTOR doesn't allow tail.calli
+	// tail.
 	calli	bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
 	ret
 }
@@ -446,7 +450,8 @@
 	ldarg 'procedure'
 	unbox int32
 	ldobj int32
-	tail.
+	// XXX ROTOR doesn't allow tail.calli
+	// tail.
 	calli	bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
 	ret
 }
@@ -468,7 +473,8 @@
 	ldarg 'procedure'
 	unbox int32
 	ldobj int32
-	tail.
+	// XXX ROTOR doesn't allow tail.calli
+	// tail.
 	calli	bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
 	ret
 }

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