[m-rev.] for review: two new type_ctor_reps

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue May 13 17:15:39 AEST 2003


For review by Fergus.

Zoltan.

Delete the univ type_ctor_rep, since we haven't used it in a long time,
and add two new type_ctor_reps: one for subgoals, so that they won't have
to be treated specially when deconstructed, and one for a future type,
stable_c_pointer, which is the same as c_pointer except that it guarantees
that the entire data structure it points to, directly and indirectly is
read only, which means that its values can be tabled. The intention is
to use stable_c_pointers to represent robdds.

runtime/mercury_type_info.h:
	Make the change above.

runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_deep_copy_body.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_tabling.c:
runtime/mercury_unify_compare_body.h:
	Handle the two new type_ctor_reps, and delete the code handling univs.

compiler/mlds_to_gcc.m:
java/runtime/TypeCtorRep.java:
library/private_builtin.m:
runtime/mercury_mcpp.h:
runtime/mercury_mcpp.cpp:
	Update the list of type_ctor_reps, including fixing some old errors
	in some files.

library/rtti_implementation.m:
	Update the list of type_ctor_reps, and modify the routines that
	interpret the RTTI accordingly.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
Index: compiler/mlds_to_gcc.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_gcc.m,v
retrieving revision 1.85
diff -u -b -r1.85 mlds_to_gcc.m
--- compiler/mlds_to_gcc.m	9 May 2003 00:45:07 -0000	1.85
+++ compiler/mlds_to_gcc.m	13 May 2003 06:16:37 -0000
@@ -2256,13 +2256,13 @@
 rtti_enum_const("MR_TYPECTOR_REP_NOTAG", 4).
 rtti_enum_const("MR_TYPECTOR_REP_NOTAG_USEREQ", 5).
 rtti_enum_const("MR_TYPECTOR_REP_EQUIV", 6).
-rtti_enum_const("MR_TYPECTOR_REP_EQUIV_VAR", 7).
+rtti_enum_const("MR_TYPECTOR_REP_FUNC", 7).
 rtti_enum_const("MR_TYPECTOR_REP_INT", 8).
 rtti_enum_const("MR_TYPECTOR_REP_CHAR", 9).
 rtti_enum_const("MR_TYPECTOR_REP_FLOAT", 10).
 rtti_enum_const("MR_TYPECTOR_REP_STRING", 11).
 rtti_enum_const("MR_TYPECTOR_REP_PRED", 12).
-rtti_enum_const("MR_TYPECTOR_REP_UNIV", 13).
+rtti_enum_const("MR_TYPECTOR_REP_SUBGOAL", 13).
 rtti_enum_const("MR_TYPECTOR_REP_VOID", 14).
 rtti_enum_const("MR_TYPECTOR_REP_C_POINTER", 15).
 rtti_enum_const("MR_TYPECTOR_REP_TYPEINFO", 16).
@@ -2288,7 +2288,8 @@
 rtti_enum_const("MR_TYPECTOR_REP_TYPECTORDESC", 36).
 rtti_enum_const("MR_TYPECTOR_REP_FOREIGN", 37).
 rtti_enum_const("MR_TYPECTOR_REP_REFERENCE", 38).
-rtti_enum_const("MR_TYPECTOR_REP_UNKNOWN", 39).
+rtti_enum_const("MR_TYPECTOR_REP_STABLE_C_POINTER", 39).
+rtti_enum_const("MR_TYPECTOR_REP_UNKNOWN", 40).
 rtti_enum_const("MR_SECTAG_NONE", 0).
 rtti_enum_const("MR_SECTAG_LOCAL", 1).
 rtti_enum_const("MR_SECTAG_REMOTE", 2).
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
Index: java/runtime/TypeCtorRep.java
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/java/runtime/TypeCtorRep.java,v
retrieving revision 1.3
diff -u -b -r1.3 TypeCtorRep.java
--- java/runtime/TypeCtorRep.java	1 Aug 2002 11:51:26 -0000	1.3
+++ java/runtime/TypeCtorRep.java	13 May 2003 06:19:22 -0000
@@ -24,7 +24,7 @@
 	public static final int MR_TYPECTOR_REP_STRING = 11;
 	public static final int MR_TYPECTOR_REP_PRED = 12;
 	public static final int MR_TYPECTOR_REP_UNIV = 13;
-	public static final int MR_TYPECTOR_REP_VOID = 14;
+	public static final int MR_TYPECTOR_REP_SUBGOAL = 14;
 	public static final int MR_TYPECTOR_REP_C_POINTER = 15;
 	public static final int MR_TYPECTOR_REP_TYPEINFO = 16;
 	public static final int MR_TYPECTOR_REP_TYPECLASSINFO = 17;
@@ -48,7 +48,9 @@
 	public static final int MR_TYPECTOR_REP_TYPEDESC = 35;
 	public static final int MR_TYPECTOR_REP_TYPECTORDESC = 36;
 	public static final int MR_TYPECTOR_REP_FOREIGN = 37;
-	public static final int MR_TYPECTOR_REP_UNKNOWN = 38;
+	public static final int MR_TYPECTOR_REP_REFERENCE = 38;
+	public static final int MR_TYPECTOR_REP_STABLE_C_POINTER = 39;
+	public static final int MR_TYPECTOR_REP_UNKNOWN = 40;
 	
 	// Instance variable for TypeCtorRep objects.
 	
cvs diff: Diffing library
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.117
diff -u -b -r1.117 private_builtin.m
--- library/private_builtin.m	9 May 2003 09:10:36 -0000	1.117
+++ library/private_builtin.m	13 May 2003 06:20:37 -0000
@@ -422,7 +422,7 @@
 static int MR_TYPECTOR_REP_FLOAT		=10;
 static int MR_TYPECTOR_REP_STRING		=11;
 static int MR_TYPECTOR_REP_PRED		    	=12;
-static int MR_TYPECTOR_REP_UNIV		    	=13;
+static int MR_TYPECTOR_REP_SUBGOAL	    	=13;
 static int MR_TYPECTOR_REP_VOID		    	=14;
 static int MR_TYPECTOR_REP_C_POINTER		=15;
 static int MR_TYPECTOR_REP_TYPEINFO		=16;
@@ -448,7 +448,8 @@
 static int MR_TYPECTOR_REP_TYPECTORDESC		=36;
 static int MR_TYPECTOR_REP_FOREIGN		=37;
 static int MR_TYPECTOR_REP_REFERENCE		=38;
-static int MR_TYPECTOR_REP_UNKNOWN		=39;
+static int MR_TYPECTOR_REP_STABLE_C_POINTER	=39;
+static int MR_TYPECTOR_REP_UNKNOWN		=40;
 
 static int MR_SECTAG_NONE				= 0;
 static int MR_SECTAG_LOCAL				= 1;
Index: library/rtti_implementation.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.42
diff -u -b -r1.42 rtti_implementation.m
--- library/rtti_implementation.m	26 Feb 2003 07:43:51 -0000	1.42
+++ library/rtti_implementation.m	13 May 2003 06:46:46 -0000
@@ -107,7 +107,7 @@
 	;	float
 	;	string
 	;	(pred)
-	;	univ
+	;	subgoal
 	;	void
 	;	c_pointer
 	;	typeinfo
@@ -132,6 +132,8 @@
 	;	type_desc
 	;	type_ctor_desc
 	;	foreign
+	;	reference
+	;	stable_c_pointer
 	;	unknown.
 
 	% We keep all the other types abstract.
@@ -176,8 +178,8 @@
 		NumFunctors = 1
 	; TypeCtorRep = tuple,
 		NumFunctors = 1
-	; TypeCtorRep = univ,
-		NumFunctors = 1
+	; TypeCtorRep = subgoal,
+		NumFunctors = -1
 
 	; TypeCtorRep = equiv_ground,
 		error("rtti_implementation num_functors for equiv types")
@@ -200,6 +202,8 @@
 		NumFunctors = -1
 	; TypeCtorRep = c_pointer,
 		NumFunctors = -1
+	; TypeCtorRep = stable_c_pointer,
+		NumFunctors = -1
 	; TypeCtorRep = typeinfo,
 		NumFunctors = -1
 	; TypeCtorRep = type_ctor_info,
@@ -232,6 +236,8 @@
 		NumFunctors = -1
 	; TypeCtorRep = foreign,
 		NumFunctors = -1
+	; TypeCtorRep = reference,
+		NumFunctors = -1
 
 	; TypeCtorRep = unknown,
 		error("num_functors: unknown type_ctor_rep")
@@ -274,8 +280,8 @@
 				FunctorNumber, FunctorName, Arity,
 				TypeInfoList, Names)
 
-	; TypeCtorRep = univ,
-		error("get_functor: univ type_ctor_rep")
+	; TypeCtorRep = subgoal,
+		fail
 
 	; TypeCtorRep = enum,
 		get_functor_enum(TypeCtorRep, TypeCtorInfo,
@@ -336,6 +342,8 @@
 		fail
 	; TypeCtorRep = c_pointer,
 		fail
+	; TypeCtorRep = stable_c_pointer,
+		fail
 	; TypeCtorRep = typeinfo,
 		fail
 	; TypeCtorRep = type_ctor_info,
@@ -368,6 +376,8 @@
 		fail
 	; TypeCtorRep = foreign,
 		fail
+	; TypeCtorRep = reference,
+		fail
 
 	; TypeCtorRep = unknown,
 		error("get_functor: unknown type_ctor_rep")
@@ -1103,8 +1113,9 @@
 				Next = Index + 1
 			), TypeArgs, Arguments, 0, _)
 	;
-		TypeCtorRep = univ,
-		Functor = "some_univ", 
+		% XXX noncanonical term
+		TypeCtorRep = subgoal,
+		Functor = "<<subgoal>>", 
 		Arity = 0,
 		Arguments = []
 	;
@@ -1120,6 +1131,12 @@
 		Arguments = []
 	;
 		% XXX noncanonical term
+		TypeCtorRep = stable_c_pointer,
+		Functor = "<<stable_c_pointer>>", 
+		Arity = 0,
+		Arguments = []
+	;
+		% XXX noncanonical term
 		TypeCtorRep = typeinfo,
 		Functor = "some_typeinfo", 
 		Arity = 0,
@@ -1227,6 +1244,12 @@
 	;
 		TypeCtorRep = foreign,
 		Functor = "<<foreign>>", 
+		Arity = 0,
+		Arguments = []
+	;
+		% XXX noncanonical term
+		TypeCtorRep = reference,
+		Functor = "<<reference>>", 
 		Arity = 0,
 		Arguments = []
 	;
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_construct.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_construct.c,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_construct.c
--- runtime/mercury_construct.c	13 May 2003 06:09:00 -0000	1.10
+++ runtime/mercury_construct.c	13 May 2003 06:26:59 -0000
@@ -146,8 +146,10 @@
     case MR_TYPECTOR_REP_STRING:
     case MR_TYPECTOR_REP_FUNC:
     case MR_TYPECTOR_REP_PRED:
+    case MR_TYPECTOR_REP_SUBGOAL:
     case MR_TYPECTOR_REP_VOID:
     case MR_TYPECTOR_REP_C_POINTER:
+    case MR_TYPECTOR_REP_STABLE_C_POINTER:
     case MR_TYPECTOR_REP_TYPEINFO:
     case MR_TYPECTOR_REP_TYPECTORINFO:
     case MR_TYPECTOR_REP_TYPEDESC:
@@ -167,9 +169,6 @@
     case MR_TYPECTOR_REP_REFERENCE:
         return MR_FALSE;
 
-    case MR_TYPECTOR_REP_UNIV:
-        MR_fatal_error("MR_get_functor_info: bad type_ctor_rep");
-
     case MR_TYPECTOR_REP_UNKNOWN:
         MR_fatal_error("MR_get_functor_info: unknown type_ctor_rep");
     }
@@ -307,8 +306,10 @@
         case MR_TYPECTOR_REP_STRING:
         case MR_TYPECTOR_REP_FUNC:
         case MR_TYPECTOR_REP_PRED:
+        case MR_TYPECTOR_REP_SUBGOAL:
         case MR_TYPECTOR_REP_VOID:
         case MR_TYPECTOR_REP_C_POINTER:
+        case MR_TYPECTOR_REP_STABLE_C_POINTER:
         case MR_TYPECTOR_REP_TYPEINFO:
         case MR_TYPECTOR_REP_TYPECTORINFO:
         case MR_TYPECTOR_REP_TYPEDESC:
@@ -327,9 +328,6 @@
         case MR_TYPECTOR_REP_FOREIGN:
         case MR_TYPECTOR_REP_REFERENCE:
             return -1;
-
-        case MR_TYPECTOR_REP_UNIV:
-            MR_fatal_error("MR_get_num_functors: bad type_ctor_rep");
 
         case MR_TYPECTOR_REP_UNKNOWN:
             MR_fatal_error("MR_get_num_functors: unknown type_ctor_rep");
Index: runtime/mercury_deconstruct.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deconstruct.c,v
retrieving revision 1.14
diff -u -b -r1.14 mercury_deconstruct.c
--- runtime/mercury_deconstruct.c	13 May 2003 06:09:01 -0000	1.14
+++ runtime/mercury_deconstruct.c	13 May 2003 06:27:33 -0000
@@ -273,8 +273,10 @@
         case MR_TYPECTOR_REP_STRING:
         case MR_TYPECTOR_REP_FUNC:
         case MR_TYPECTOR_REP_PRED:
+        case MR_TYPECTOR_REP_SUBGOAL:
         case MR_TYPECTOR_REP_VOID:
         case MR_TYPECTOR_REP_C_POINTER:
+        case MR_TYPECTOR_REP_STABLE_C_POINTER:
         case MR_TYPECTOR_REP_TYPEINFO:
         case MR_TYPECTOR_REP_TYPECTORINFO:
         case MR_TYPECTOR_REP_TYPEDESC:
@@ -295,9 +297,6 @@
         case MR_TYPECTOR_REP_FOREIGN:
         case MR_TYPECTOR_REP_UNKNOWN:
             return MR_FALSE;
-
-        case MR_TYPECTOR_REP_UNIV:
-            MR_fatal_error("MR_named_arg_num: bad type_ctor_rep");
     }
 
     MR_fatal_error("MR_named_arg_num: unexpected fallthrough");
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.60
diff -u -b -r1.60 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h	13 May 2003 06:09:01 -0000	1.60
+++ runtime/mercury_deep_copy_body.h	13 May 2003 06:28:59 -0000
@@ -498,6 +498,9 @@
         }
         return new_data;
 
+    case MR_TYPECTOR_REP_SUBGOAL:
+        MR_fatal_error("Cannot copy a subgoal type");
+
     case MR_TYPECTOR_REP_VOID:
         MR_fatal_error("Cannot copy a void type");
 
@@ -556,6 +559,7 @@
         /* base_typeclass_infos are always pointers to static data */
         return data;
 
+    case MR_TYPECTOR_REP_STABLE_C_POINTER: /* fallthru */
     case MR_TYPECTOR_REP_C_POINTER:
         {
             MR_Word *data_value;
@@ -625,9 +629,6 @@
 
     case MR_TYPECTOR_REP_FOREIGN:
         MR_fatal_error("Cannot copy foreign types");
-
-    case MR_TYPECTOR_REP_UNIV:
-        MR_fatal_error(MR_STRINGIFY(copy) ": bad type_ctor_rep");
 
     case MR_TYPECTOR_REP_UNKNOWN: /* fallthru */
         MR_fatal_error("Unknown layout type in deep copy");
Index: runtime/mercury_mcpp.cpp
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_mcpp.cpp,v
retrieving revision 1.18
diff -u -b -r1.18 mercury_mcpp.cpp
--- runtime/mercury_mcpp.cpp	3 Mar 2003 14:33:28 -0000	1.18
+++ runtime/mercury_mcpp.cpp	13 May 2003 06:22:41 -0000
@@ -118,9 +118,7 @@
     static int MR_TYPECTOR_REP_FLOAT			=10;
     static int MR_TYPECTOR_REP_STRING			=11;
     static int MR_TYPECTOR_REP_PRED		    	=12;
-	// MR_TYPECTOR_REP_UNIV is unused - it is retained
-	// only for backwards compatability.
-    static int MR_TYPECTOR_REP_UNIV		    	=13;
+    static int MR_TYPECTOR_REP_SUBGOAL		    	=13;
     static int MR_TYPECTOR_REP_VOID		    	=14;
     static int MR_TYPECTOR_REP_C_POINTER		=15;
     static int MR_TYPECTOR_REP_TYPEINFO			=16;
@@ -146,7 +144,8 @@
     static int MR_TYPECTOR_REP_TYPECTORDESC	        =36;
     static int MR_TYPECTOR_REP_FOREIGN			=37;
     static int MR_TYPECTOR_REP_REFERENCE		=38;
-    static int MR_TYPECTOR_REP_UNKNOWN		        =39;
+    static int MR_TYPECTOR_REP_STABLE_C_POINTER	        =39;
+    static int MR_TYPECTOR_REP_UNKNOWN		        =40;
 
     static int MR_SECTAG_NONE				= 0;
     static int MR_SECTAG_LOCAL				= 1;
Index: runtime/mercury_mcpp.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_mcpp.h,v
retrieving revision 1.28
diff -u -b -r1.28 mercury_mcpp.h
--- runtime/mercury_mcpp.h	13 Mar 2003 01:47:05 -0000	1.28
+++ runtime/mercury_mcpp.h	13 May 2003 06:21:57 -0000
@@ -151,9 +151,7 @@
 #define MR_TYPECTOR_REP_FLOAT_val			10
 #define MR_TYPECTOR_REP_STRING_val			11
 #define MR_TYPECTOR_REP_PRED_val			12
-	// MR_TYPECTOR_REP_UNIV_val is unused - it is retained
-	// only for backwards compatability.
-#define MR_TYPECTOR_REP_UNIV_val			13
+#define MR_TYPECTOR_REP_SUBGOAL_val			13
 #define MR_TYPECTOR_REP_VOID_val			14
 #define MR_TYPECTOR_REP_C_POINTER_val			15
 #define MR_TYPECTOR_REP_TYPEINFO_val			16
@@ -179,7 +177,8 @@
 #define MR_TYPECTOR_REP_TYPECTORDESC_val		36
 #define MR_TYPECTOR_REP_FOREIGN_val			37
 #define MR_TYPECTOR_REP_REFERENCE_val			38
-#define MR_TYPECTOR_REP_UNKNOWN_val			39
+#define MR_TYPECTOR_REP_STABLE_C_POINTER_val		39
+#define MR_TYPECTOR_REP_UNKNOWN_val			40
 
 // XXX we should integrate this macro in with the version in 
 // mercury_typeinfo.h
Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.27
diff -u -b -r1.27 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h	13 May 2003 06:09:02 -0000	1.27
+++ runtime/mercury_ml_expand_body.h	13 May 2003 06:40:32 -0000
@@ -872,21 +872,19 @@
 #endif  /* EXPAND_ONE_ARG */
             return;
 
-        case MR_TYPECTOR_REP_UNIV: {
-            MR_Word data_word;
-
-            MR_TypeInfo univ_type_info;
-            MR_Word univ_data;
-                /*
-                 * Univ is a two word structure, containing
-                 * type_info and data.
-                 */
-            data_word = *data_word_ptr;
-            MR_unravel_univ(data_word, univ_type_info, univ_data);
-            EXPAND_FUNCTION_NAME(univ_type_info, &univ_data, noncanon,
-                EXTRA_ARGS expand_info);
-            return;
+        case MR_TYPECTOR_REP_SUBGOAL:
+#if MR_USE_MINIMAL_MODEL
+            if (noncanon == MR_NONCANON_CC) {
+                handle_functor_name(MR_subgoal_addr_name(
+                    (MR_SubgoalPtr) *data_word_ptr));
+            } else {
+                handle_functor_name("<<subgoal>>");
         }
+#else
+            handle_functor_name("<<subgoal>>");
+#endif
+            handle_zero_arity_args();
+            return;
 
         case MR_TYPECTOR_REP_VOID:
             /*
@@ -908,6 +906,18 @@
             handle_zero_arity_args();
             return;
 
+        case MR_TYPECTOR_REP_STABLE_C_POINTER:
+            if (noncanon == MR_NONCANON_ABORT) {
+                /* XXX should throw an exception */
+                MR_fatal_error(MR_STRINGIFY(EXPAND_FUNCTION_NAME)
+                    ": attempt to deconstruct noncanonical term");
+                return;
+            }
+
+            handle_functor_name("<<stable_c_pointer>>");
+            handle_zero_arity_args();
+            return;
+
         case MR_TYPECTOR_REP_TYPEINFO:
         case MR_TYPECTOR_REP_TYPEDESC:
             {
@@ -1152,20 +1162,7 @@
             return;
 
         case MR_TYPECTOR_REP_FOREIGN:
-#ifdef  MR_USE_MINIMAL_MODEL
-            if (MR_streq(type_ctor_info->MR_type_ctor_name, "ml_subgoal") &&
-                MR_streq(type_ctor_info->MR_type_ctor_module_name,
-                    "table_builtin") &&
-                (noncanon == MR_NONCANON_CC))
-            {
-                handle_functor_name(MR_subgoal_addr_name(
-                    (MR_SubgoalPtr) *data_word_ptr));
-            } else {
                 handle_functor_name("<<foreign>>");
-            }
-#else
-            handle_functor_name("<<foreign>>");
-#endif
             handle_zero_arity_args();
             return;
 
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.58
diff -u -b -r1.58 mercury_tabling.c
--- runtime/mercury_tabling.c	13 May 2003 06:09:02 -0000	1.58
+++ runtime/mercury_tabling.c	13 May 2003 06:35:48 -0000
@@ -1127,12 +1127,23 @@
                 return table;
             }
 
+        case MR_TYPECTOR_REP_SUBGOAL:
+            MR_fatal_error("Cannot table a subgoal");
+
         case MR_TYPECTOR_REP_VOID:
             MR_fatal_error("Cannot table a void type");
 
         case MR_TYPECTOR_REP_C_POINTER:
             MR_fatal_error("Attempt to table a C_POINTER");
 
+        case MR_TYPECTOR_REP_STABLE_C_POINTER:
+            /*
+            ** This works because a stable C pointer guarantees that the
+            ** data structures pointed to, indirectly as well as directly,
+            ** will remain stable until the program exits.
+            */
+            MR_DEBUG_TABLE_INT(table, data);
+
         case MR_TYPECTOR_REP_TYPEINFO:
         case MR_TYPECTOR_REP_TYPEDESC:
             MR_DEBUG_TABLE_TYPEINFO(table, (MR_TypeInfo) data);
@@ -1203,9 +1214,6 @@
 
         case MR_TYPECTOR_REP_REFERENCE:
             MR_fatal_error("Attempt to table a value of a reference type");
-
-        case MR_TYPECTOR_REP_UNIV:
-            MR_fatal_error("MR_table_any: bad type_ctor_rep");
 
         case MR_TYPECTOR_REP_UNKNOWN: /* fallthru */
             MR_fatal_error("Unknown layout tag in table_any");
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.103
diff -u -b -r1.103 mercury_type_info.h
--- runtime/mercury_type_info.h	13 May 2003 06:09:03 -0000	1.103
+++ runtime/mercury_type_info.h	13 May 2003 06:23:00 -0000
@@ -555,7 +555,7 @@
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_FLOAT),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_STRING),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_PRED),
-    MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_UNIV),
+    MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_SUBGOAL),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_VOID),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_C_POINTER),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_TYPEINFO),
@@ -581,6 +581,7 @@
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_TYPECTORDESC),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_FOREIGN),
     MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_REFERENCE),
+    MR_DEFINE_BUILTIN_ENUM_CONST(MR_TYPECTOR_REP_STABLE_C_POINTER),
     /*
     ** MR_TYPECTOR_REP_UNKNOWN should remain the last alternative;
     ** MR_TYPE_CTOR_STATS depends on this.
@@ -621,7 +622,7 @@
     "FLOAT",                                    \
     "STRING",                                   \
     "PRED",                                     \
-    "UNIV",                                     \
+    "SUBGOAL",                                  \
     "VOID",                                     \
     "C_POINTER",                                \
     "TYPEINFO",                                 \
@@ -644,6 +645,8 @@
     "TYPECTORINFO",                             \
     "BASETYPECLASSINFO",                        \
     "FOREIGN",                                  \
+    "REFERENCE",                                \
+    "STABLE_C_POINTER",                         \
     "UNKNOWN"
 
 /*---------------------------------------------------------------------------*/
Index: runtime/mercury_unify_compare_body.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_unify_compare_body.h,v
retrieving revision 1.31
diff -u -b -r1.31 mercury_unify_compare_body.h
--- runtime/mercury_unify_compare_body.h	13 May 2003 06:09:03 -0000	1.31
+++ runtime/mercury_unify_compare_body.h	13 May 2003 06:39:38 -0000
@@ -550,6 +550,14 @@
 #endif
             }
 
+            /*
+            ** We use the c_pointer statistics for stable_c_pointer
+            ** until the stable_c_pointer type is actually added,
+            ** which will be *after* the builtin types' handwritten
+            ** unify and compare preds are replaced by automatically
+            ** generated code.
+            */
+        case MR_TYPECTOR_REP_STABLE_C_POINTER: /* fallthru */
         case MR_TYPECTOR_REP_C_POINTER:
 #ifdef  select_compare_code
             if ((void *) x == (void *) y) {
@@ -682,9 +690,8 @@
         case MR_TYPECTOR_REP_BASETYPECLASSINFO:
             MR_fatal_error(attempt_msg "base_typeclass_infos");
 
-        case MR_TYPECTOR_REP_UNIV:
-            /* univ is now implemented as a user-defined type */
-            MR_fatal_error(attempt_msg "univ");
+        case MR_TYPECTOR_REP_SUBGOAL:
+            MR_fatal_error(attempt_msg "subgoal");
 
         case MR_TYPECTOR_REP_HP:
             MR_fatal_error(attempt_msg "hp");
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
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