[m-rev.] diff: add missing type_ctor_info for tuples.
Tyson Dowd
trd at cs.mu.OZ.AU
Fri Aug 17 00:37:04 AEST 2001
Hi,
===================================================================
Estimated hours taken: 4
Branches: main
compiler/mlds_to_il.m:
Add tuple to this list of hand-coded type_infos (so that we look
in the cpp code module to find the type_info).
library/builtin.m:
Add a type_ctor_info for tuple.
library/std_util.m:
Call into rtti.m to compare type_infos.
runtime/mercury_il.il:
Add some IL code to get the type_ctor_info from a type_info.
(It's hard to write this code in MC++ or C#, and there seems to
be a bug in the IL interface that stops me writing IL
foreign_proc for it at the moment).
runtime/mercury_il.il:
Add helper functions to get the function pointers for tuple
compare and unify procedures.
runtime/mercury_mcpp.cpp:
runtime/mercury_mcpp.h:
Add tuple to the type_ctor_rep.
runtime/mercury_type_info.h:
Mention that changes in the type_ctor_rep might require changes
in mercury_mcpp.{h,cpp}.
Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.75
diff -u -r1.75 mlds_to_il.m
--- compiler/mlds_to_il.m 14 Aug 2001 18:41:17 -0000 1.75
+++ compiler/mlds_to_il.m 16 Aug 2001 12:45:31 -0000
@@ -2955,6 +2955,7 @@
; Name = "c_pointer", Arity = 0
; Name = "pred", Arity = 0
; Name = "func", Arity = 0
+ ; Name = "tuple", Arity = 0
)
; LibModuleName0 = "array",
(
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.60
diff -u -r1.60 builtin.m
--- library/builtin.m 14 Aug 2001 10:18:45 -0000 1.60
+++ library/builtin.m 16 Aug 2001 12:45:35 -0000
@@ -649,6 +649,7 @@
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(builtin, float, 0, MR_TYPECTOR_REP_FLOAT)
MR_DEFINE_BUILTIN_TYPE_CTOR_INFO(builtin, func, 0, MR_TYPECTOR_REP_PRED)
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
__Unify____int_0_0(MR_Integer x, MR_Integer y)
@@ -707,6 +708,14 @@
return 0;
}
+static int
+__Unify____tuple_0_0(MR_Word x, MR_Word y)
+{
+ mercury::runtime::Errors::fatal_error(
+ ""called unify for `tuple' type"");
+ return 0;
+}
+
static void
__Compare____int_0_0(
MR_Word_Ref result, MR_Integer x, MR_Integer y)
@@ -785,6 +794,14 @@
""called compare/3 for `pred' type"");
}
+static void
+__Compare____tuple_0_0(MR_Word_Ref result,
+ MR_Word x, MR_Word y)
+{
+ mercury::runtime::Errors::fatal_error(
+ ""called compare/3 for `pred' type"");
+}
+
/*
** Unification procedures with the arguments boxed.
** These are just wrappers which call the unboxed version.
@@ -854,6 +871,14 @@
return 0;
}
+static int
+do_unify__tuple_0_0(MR_Box x, MR_Box y)
+{
+ mercury::runtime::Errors::fatal_error(
+ ""called unify for `tuple' type"");
+ return 0;
+}
+
/*
** Comparison procedures with the arguments boxed.
** These are just wrappers which call the unboxed version.
@@ -923,6 +948,14 @@
mercury::runtime::Errors::fatal_error(
""called compare/3 for pred type"");
}
+
+static void
+do_compare__tuple_0_0(MR_Word_Ref result, MR_Box x, MR_Box y)
+{
+ mercury::runtime::Errors::fatal_error(
+ ""called compare/3 for tuple type"");
+}
+
").
Index: runtime/mercury_il.il
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_il.il,v
retrieving revision 1.10
diff -u -r1.10 mercury_il.il
--- runtime/mercury_il.il 31 Jul 2001 10:08:01 -0000 1.10
+++ runtime/mercury_il.il 16 Aug 2001 12:45:38 -0000
@@ -115,6 +135,24 @@
class [mscorlib]System.Object)
ret
}
+
+.method public static default int32
+get_ftn_ptr_tuple_compare() {
+ ldftn void ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ do_compare__tuple_0_0(
+ class [mscorlib]System.Object[]&,
+ class [mscorlib]System.Object, class [mscorlib]System.Object)
+ ret
+}
+
+.method public static default int32
+get_ftn_ptr_tuple_unify() {
+ ldftn int32 ['mercury'] 'mercury'.'builtin__cpp_code'.'mercury_code'::
+ do_unify__tuple_0_0(
+ class [mscorlib]System.Object, class [mscorlib]System.Object)
+ ret
+}
+
.method public static default int32
get_ftn_ptr_pred_compare() {
Index: runtime/mercury_mcpp.cpp
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.cpp,v
retrieving revision 1.7
diff -u -r1.7 mercury_mcpp.cpp
--- runtime/mercury_mcpp.cpp 14 Aug 2001 10:19:02 -0000 1.7
+++ runtime/mercury_mcpp.cpp 16 Aug 2001 12:45:38 -0000
@@ -130,6 +130,7 @@
static int MR_TYPECTOR_REP_NOTAG_GROUND =27;
static int MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ =28;
static int MR_TYPECTOR_REP_EQUIV_GROUND =29;
+ static int MR_TYPECTOR_REP_TUPLE =30;
static int MR_SECTAG_NONE = 0;
static int MR_SECTAG_LOCAL = 1;
Index: runtime/mercury_mcpp.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.h,v
retrieving revision 1.10
diff -u -r1.10 mercury_mcpp.h
--- runtime/mercury_mcpp.h 8 Aug 2001 15:12:31 -0000 1.10
+++ runtime/mercury_mcpp.h 16 Aug 2001 12:45:38 -0000
@@ -153,6 +153,7 @@
#define MR_TYPECTOR_REP_NOTAG_GROUND_val 27
#define MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ_val 28
#define MR_TYPECTOR_REP_EQUIV_GROUND_val 29
+#define MR_TYPECTOR_REP_TUPLE_val 30
// XXX we should integrate this macro in with the version in
// mercury_typeinfo.h
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.72
diff -u -r1.72 mercury_type_info.h
--- runtime/mercury_type_info.h 29 Jun 2001 03:22:19 -0000 1.72
+++ runtime/mercury_type_info.h 16 Aug 2001 12:45:39 -0000
@@ -514,6 +514,9 @@
** MR_TYPE_CTOR_REP_DU_USEREQ, the exact representation depends on the tag
** value -- lookup the tag value in type_ctor_layout to find out this
** information.
+**
+** Any changes in this definition might also require changes in
+** runtime/mercury_mcpp.{h,cpp}
*/
typedef enum {
--
Tyson Dowd #
# Surreal humour isn't everyone's cup of fur.
trd at cs.mu.oz.au #
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
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