[m-rev.] diff: .NET back-end: s/int/bool/
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Mar 4 01:45:17 AEDT 2003
Estimated hours taken: 2
Branches: main
Fix a bug where the compiler was generating references to special_*
with return type bool, but special___Unify___array_1_0 was defined
with type int. This bug showed up when trying to run Mercury code on
Portable.NET, which is fussier about references to undefined symbols
than Microsoft.NET is.
library/builtin.m:
library/private_builtin.m:
library/type_desc.m:
Consistently use `MR_bool' rather than `int' for the return value
of semidet procedures in MC++ code.
runtime/mercury_il.il:
Use `bool' rather than `int32' for the return value of semidet
procedures. Also, delete get_func_ptr_univ_{unify,compare};
those are not needed, since `univ' is no longer a built-in type.
Workspace: /home/ceres/fjh/mercury
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.88
diff -u -d -r1.88 builtin.m
--- library/builtin.m 3 Mar 2003 03:29:36 -0000 1.88
+++ library/builtin.m 3 Mar 2003 09:27:23 -0000
@@ -569,32 +569,32 @@
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(builtin, pred, 0, MR_TYPECTOR_REP_PRED)
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(builtin, tuple, 0, MR_TYPECTOR_REP_TUPLE)
-static int
+static MR_bool
__Unify____int_0_0(MR_Integer x, MR_Integer y)
{
return x == y;
}
-static int
+static MR_bool
__Unify____string_0_0(MR_String x, MR_String y)
{
return System::String::Equals(x, y);
}
-static int
+static MR_bool
__Unify____character_0_0(MR_Char x, MR_Char y)
{
return x == y;
}
-static int
+static MR_bool
__Unify____float_0_0(MR_Float x, MR_Float y)
{
/* XXX what should this function do when x and y are both NaNs? */
return x == y;
}
-static int
+static MR_bool
__Unify____void_0_0(MR_Word x, MR_Word y)
{
mercury::runtime::Errors::fatal_error(
@@ -602,7 +602,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____c_pointer_0_0(MR_Word x, MR_Word y)
{
mercury::runtime::Errors::fatal_error(
@@ -610,7 +610,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____func_0_0(MR_Word x, MR_Word y)
{
mercury::runtime::Errors::fatal_error(
@@ -618,7 +618,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____pred_0_0(MR_Word x, MR_Word y)
{
mercury::runtime::Errors::fatal_error(
@@ -626,7 +626,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____tuple_0_0(MR_Word x, MR_Word y)
{
mercury::runtime::Errors::fatal_error(
@@ -725,7 +725,7 @@
** These are just wrappers which call the unboxed version.
*/
-static int
+static MR_bool
do_unify__int_0_0(MR_Box x, MR_Box y)
{
return mercury::builtin__cpp_code::mercury_code::__Unify____int_0_0(
@@ -733,7 +733,7 @@
System::Convert::ToInt32(y));
}
-static int
+static MR_bool
do_unify__string_0_0(MR_Box x, MR_Box y)
{
return mercury::builtin__cpp_code::mercury_code::__Unify____string_0_0(
@@ -741,7 +741,7 @@
dynamic_cast<MR_String>(y));
}
-static int
+static MR_bool
do_unify__float_0_0(MR_Box x, MR_Box y)
{
return mercury::builtin__cpp_code::mercury_code::__Unify____float_0_0(
@@ -749,7 +749,7 @@
System::Convert::ToDouble(y));
}
-static int
+static MR_bool
do_unify__character_0_0(MR_Box x, MR_Box y)
{
return mercury::builtin__cpp_code::mercury_code::__Unify____character_0_0(
@@ -757,7 +757,7 @@
System::Convert::ToChar(y));
}
-static int
+static MR_bool
do_unify__void_0_0(MR_Box x, MR_Box y)
{
mercury::runtime::Errors::fatal_error(
@@ -765,7 +765,7 @@
return 0;
}
-static int
+static MR_bool
do_unify__c_pointer_0_0(MR_Box x, MR_Box y)
{
return mercury::builtin__cpp_code::mercury_code::__Unify____c_pointer_0_0(
@@ -773,7 +773,7 @@
dynamic_cast<MR_Word>(y));
}
-static int
+static MR_bool
do_unify__func_0_0(MR_Box x, MR_Box y)
{
mercury::runtime::Errors::fatal_error(
@@ -781,7 +781,7 @@
return 0;
}
-static int
+static MR_bool
do_unify__pred_0_0(MR_Box x, MR_Box y)
{
mercury::runtime::Errors::fatal_error(
@@ -789,7 +789,7 @@
return 0;
}
-static int
+static MR_bool
do_unify__tuple_0_0(MR_Box x, MR_Box y)
{
mercury::runtime::Errors::fatal_error(
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.115
diff -u -d -r1.115 private_builtin.m
--- library/private_builtin.m 3 Mar 2003 03:29:37 -0000 1.115
+++ library/private_builtin.m 3 Mar 2003 09:28:54 -0000
@@ -455,7 +455,7 @@
static int MR_SECTAG_REMOTE = 2;
static int MR_SECTAG_VARIABLE = 3;
-static int
+static MR_bool
__Unify____type_info_1_0(
MR_Word type_info, MR_Word x, MR_Word y)
{
@@ -463,7 +463,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____typeclass_info_1_0(
MR_Word type_info, MR_Word x, MR_Word y)
{
@@ -471,7 +471,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____base_typeclass_info_1_0(
MR_Word type_info, MR_Word x, MR_Word y)
{
@@ -479,7 +479,7 @@
return 0;
}
-static int
+static MR_bool
__Unify____type_ctor_info_1_0(
MR_Word type_info, MR_Word x, MR_Word y)
{
@@ -515,7 +515,7 @@
mercury::runtime::Errors::SORRY(S""compare for base_typeclass_info"");
}
-static int
+static MR_bool
do_unify__type_ctor_info_1_0(
MR_Word type_info, MR_Box x, MR_Box y)
{
@@ -525,7 +525,7 @@
dynamic_cast<MR_Word>(y));
}
-static int
+static MR_bool
do_unify__type_info_1_0(
MR_Word type_info, MR_Box x, MR_Box y)
{
@@ -535,7 +535,7 @@
dynamic_cast<MR_Word>(y));
}
-static int
+static MR_bool
do_unify__typeclass_info_1_0(
MR_Word type_info, MR_Box x, MR_Box y)
{
@@ -545,7 +545,7 @@
dynamic_cast<MR_Word>(y));
}
-static int
+static MR_bool
do_unify__base_typeclass_info_1_0(
MR_Word type_info, MR_Box x, MR_Box y)
{
@@ -1012,7 +1012,7 @@
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(private_builtin, heap_pointer, 0,
MR_TYPECTOR_REP_HP)
-static int
+static MR_bool
__Unify__private_builtin__heap_pointer_0_0(MR_Word x, MR_Word y)
{
mercury::runtime::Errors::fatal_error(
@@ -1028,7 +1028,7 @@
""called compare/3 for type `private_builtin:heap_pointer'"");
}
-static int
+static MR_bool
do_unify__heap_pointer_0_0(MR_Box x, MR_Box y)
{
mercury::runtime::Errors::fatal_error(
@@ -1047,13 +1047,13 @@
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(private_builtin, ref, 1,
MR_TYPECTOR_REP_REFERENCE)
-static int
+static MR_bool
__Unify__private_builtin__ref_1_0(MR_Word type_info, MR_Word x, MR_Word y)
{
return x == y;
}
-static int
+static MR_bool
do_unify__ref_1_0(MR_Word type_info, MR_Box x, MR_Box y)
{
return x == y;
Index: library/type_desc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/type_desc.m,v
retrieving revision 1.18
diff -u -d -r1.18 type_desc.m
--- library/type_desc.m 3 Mar 2003 03:29:38 -0000 1.18
+++ library/type_desc.m 3 Mar 2003 09:30:23 -0000
@@ -221,7 +221,7 @@
return 0;
}
-static int
+static MR_bool
do_unify__type_ctor_desc_0_0(MR_Box x, MR_Box y)
{
return mercury::type_desc__cpp_code::mercury_code::__Unify____type_ctor_desc_0_0(
@@ -267,7 +267,7 @@
return (MR_compare_type_info(x, y) == MR_COMPARE_EQUAL);
}
-static int
+static MR_bool
do_unify__type_desc_0_0(MR_Box x, MR_Box y)
{
return mercury::type_desc__cpp_code::mercury_code::__Unify____type_desc_0_0(
Index: runtime/mercury_il.il
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_il.il,v
retrieving revision 1.19
diff -u -d -r1.19 mercury_il.il
--- runtime/mercury_il.il 15 Feb 2003 21:56:03 -0000 1.19
+++ runtime/mercury_il.il 3 Mar 2003 09:43:48 -0000
@@ -55,7 +55,7 @@
.method public static default int32
get_ftn_ptr_heap_pointer_unify() {
- ldftn int32 ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
do_unify__heap_pointer_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -72,7 +72,7 @@
.method public static default int32
get_ftn_ptr_typeclass_info_unify() {
- ldftn int32 ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
do_unify__typeclass_info_1_0(
class [mscorlib]System.Object[], class [mscorlib]System.Object,
class [mscorlib]System.Object)
@@ -90,7 +90,7 @@
.method public static default int32
get_ftn_ptr_base_typeclass_info_unify() {
- ldftn int32 ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
do_unify__base_typeclass_info_1_0(
class [mscorlib]System.Object[], class [mscorlib]System.Object,
class [mscorlib]System.Object)
@@ -108,7 +108,7 @@
.method public static default int32
get_ftn_ptr_type_info_unify() {
- ldftn int32 ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
do_unify__type_info_1_0(
class [mscorlib]System.Object[], class [mscorlib]System.Object,
class [mscorlib]System.Object)
@@ -126,7 +126,7 @@
.method public static default int32
get_ftn_ptr_type_ctor_info_unify() {
- ldftn int32 ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
do_unify__type_ctor_info_1_0(
class [mscorlib]System.Object[], class [mscorlib]System.Object,
class [mscorlib]System.Object)
@@ -145,7 +145,7 @@
.method public static default int32
get_ftn_ptr_type_ctor_desc_unify() {
- ldftn int32 ['mercury'] 'mercury'.'type_desc__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'type_desc__cpp_code'.'mercury_code'::
do_unify__type_ctor_desc_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -163,7 +163,7 @@
.method public static default int32
get_ftn_ptr_tuple_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__tuple_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -181,7 +181,7 @@
.method public static default int32
get_ftn_ptr_pred_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__pred_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -198,7 +198,7 @@
.method public static default int32
get_ftn_ptr_func_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__func_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -214,7 +214,7 @@
}
.method public static default int32
get_ftn_ptr_float_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__float_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -230,7 +230,7 @@
}
.method public static default int32
get_ftn_ptr_void_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__void_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -247,7 +247,7 @@
.method public static default int32
get_ftn_ptr_c_pointer_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__c_pointer_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -265,7 +265,7 @@
.method public static default int32
get_ftn_ptr_ref_unify() {
- ldftn int32 ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'private_builtin__cpp_code'.'mercury_code'::
do_unify__ref_1_0(
class [mscorlib]System.Object[],
class [mscorlib]System.Object, class [mscorlib]System.Object)
@@ -283,7 +283,7 @@
.method public static default int32
get_ftn_ptr_string_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__string_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -300,7 +300,7 @@
.method public static default int32
get_ftn_ptr_character_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__character_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -317,7 +317,7 @@
.method public static default int32
get_ftn_ptr_int_unify() {
- ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
do_unify__int_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
@@ -334,7 +334,7 @@
.method public static default int32
get_ftn_ptr_array_unify() {
- ldftn int32 ['mercury'] 'mercury'.'array__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'array__cpp_code'.'mercury_code'::
do_unify__array_1_0(
class [mscorlib]System.Object[], class [mscorlib]System.Object,
class [mscorlib]System.Object)
@@ -353,29 +353,12 @@
.method public static default int32
get_ftn_ptr_type_desc_unify() {
- ldftn int32 ['mercury'] 'mercury'.'type_desc__cpp_code'.'mercury_code'::
+ ldftn bool ['mercury'] 'mercury'.'type_desc__cpp_code'.'mercury_code'::
do_unify__type_desc_0_0(
class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
}
-.method public static default int32
-get_ftn_ptr_univ_compare() {
- ldftn void ['mercury'] 'mercury'.'std_util__cpp_code'.'mercury_code'::
- do_compare__univ_0_0(
- class [mscorlib]System.Object[]&,
- class [mscorlib]System.Object, class [mscorlib]System.Object)
- ret
-}
-
-.method public static default int32
-get_ftn_ptr_univ_unify() {
- ldftn int32 ['mercury'] 'mercury'.'std_util__cpp_code'.'mercury_code'::
- do_unify__univ_0_0(
- class [mscorlib]System.Object, class [mscorlib]System.Object)
- ret
-}
-
} // end of class TempHack
// ------------------------------------------------------------------------
@@ -386,7 +369,7 @@
.class public GenericCall {
-.method public static default int32 semidet_call_3(class [mscorlib]System.Object 'procedure',
+.method public static default bool semidet_call_3(class [mscorlib]System.Object 'procedure',
class [mscorlib]System.Object 'X', class [mscorlib]System.Object 'Y')
{
ldarg 'X'
@@ -395,12 +378,12 @@
unbox int32
ldobj int32
tail.
- calli int32 (class [mscorlib]System.Object, class [mscorlib]System.Object)
+ calli bool (class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
}
-.method public static default int32 semidet_call_4(class [mscorlib]System.Object 'procedure',
+.method public static default bool semidet_call_4(class [mscorlib]System.Object 'procedure',
class [mscorlib]System.Object 'T1', class [mscorlib]System.Object 'X',
class [mscorlib]System.Object 'Y')
{
@@ -411,11 +394,11 @@
unbox int32
ldobj int32
tail.
- calli int32 (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
+ calli bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
}
-.method public static default int32 semidet_call_5(class [mscorlib]System.Object 'procedure',
+.method public static default bool semidet_call_5(class [mscorlib]System.Object 'procedure',
class [mscorlib]System.Object 'T1', class [mscorlib]System.Object 'T2',
class [mscorlib]System.Object 'X', class [mscorlib]System.Object 'Y')
{
@@ -427,11 +410,11 @@
unbox int32
ldobj int32
tail.
- calli int32 (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
+ calli bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
}
-.method public static default int32 semidet_call_6(class [mscorlib]System.Object 'procedure',
+.method public static default bool semidet_call_6(class [mscorlib]System.Object 'procedure',
class [mscorlib]System.Object 'T1', class [mscorlib]System.Object 'T2',
class [mscorlib]System.Object 'T3', class [mscorlib]System.Object 'X',
class [mscorlib]System.Object 'Y')
@@ -445,11 +428,11 @@
unbox int32
ldobj int32
tail.
- calli int32 (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
+ calli bool (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
ret
}
-.method public static default int32 semidet_call_7(class [mscorlib]System.Object 'procedure',
+.method public static default bool semidet_call_7(class [mscorlib]System.Object 'procedure',
class [mscorlib]System.Object 'T1', class [mscorlib]System.Object 'T2',
class [mscorlib]System.Object 'T3', class [mscorlib]System.Object 'T4',
class [mscorlib]System.Object 'X', class [mscorlib]System.Object 'Y')
@@ -464,12 +447,12 @@
unbox int32
ldobj int32
tail.
- calli int32 (class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object, class [mscorlib]System.Object)
+ 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
}
-.method public static default int32 semidet_call_8(class [mscorlib]System.Object 'procedure',
+.method public static default bool semidet_call_8(class [mscorlib]System.Object 'procedure',
class [mscorlib]System.Object 'T1', class [mscorlib]System.Object 'T2',
class [mscorlib]System.Object 'T3', class [mscorlib]System.Object 'T4',
class [mscorlib]System.Object 'T5', class [mscorlib]System.Object 'X',
@@ -486,7 +469,7 @@
unbox int32
ldobj int32
tail.
- calli int32 (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)
+ 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
}
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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