[m-rev.] for review: remove redundant fields from type_ctor_info structures, part 2

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Jan 18 19:23:26 AEDT 2002


For anyone to review.

This is the second half of a change that removes redundant fields from
type_ctor_info structures.

configure.in:
	Require the use of a compiler that implements the first half of this
	change.

runtime/mercury_grade.h:
	Increment the grade version number to prevent linking of code of that
	doesn't understand the new type_ctor_info structure with code that
	requires it.

runtime/mercury_type_info.h:
	Delete the old versions of the type_ctor_info structure and the
	macros that operate on it.

Zoltan.


Diffing .
--- ws29/configure.in	Fri Jan 11 15:54:41 2002
+++ ws27/configure.in	Sat Jan 12 22:31:41 2002
@@ -103,7 +103,7 @@
         
 		main --> 
 			{ return_rtti_version(Version) },
-			( { Version = 5 } ->
+			( { Version = 6 } ->
 				print("Hello, world\n")
 			;
 				print("Nope.\n")
Diffing bindist
Diffing boehm_gc
Diffing boehm_gc/Mac_files
Diffing boehm_gc/cord
Diffing boehm_gc/cord/private
Diffing boehm_gc/doc
Diffing boehm_gc/include
Diffing boehm_gc/include/private
Diffing boehm_gc/tests
Diffing browser
Diffing bytecode
Diffing compiler
Diffing compiler/notes
Diffing debian
Diffing deep_profiler
Diffing deep_profiler/notes
Diffing doc
Diffing extras
Diffing extras/aditi
Diffing extras/cgi
Diffing extras/complex_numbers
Diffing extras/complex_numbers/samples
Diffing extras/complex_numbers/tests
Diffing extras/concurrency
Diffing extras/curs
Diffing extras/curs/samples
Diffing extras/curses
Diffing extras/curses/sample
Diffing extras/dynamic_linking
Diffing extras/graphics
Diffing extras/graphics/mercury_opengl
Diffing extras/graphics/mercury_tcltk
Diffing extras/graphics/samples
Diffing extras/graphics/samples/calc
Diffing extras/graphics/samples/maze
Diffing extras/graphics/samples/pent
Diffing extras/lazy_evaluation
Diffing extras/lex
Diffing extras/lex/samples
Diffing extras/logged_output
Diffing extras/moose
Diffing extras/moose/samples
Diffing extras/morphine
Diffing extras/morphine/non-regression-tests
Diffing extras/morphine/scripts
Diffing extras/morphine/source
Diffing extras/odbc
Diffing extras/posix
Diffing extras/quickcheck
Diffing extras/quickcheck/tutes
Diffing extras/references
Diffing extras/references/samples
Diffing extras/references/tests
Diffing extras/stream
Diffing extras/trailed_update
Diffing extras/trailed_update/samples
Diffing extras/trailed_update/tests
Diffing extras/xml
Diffing extras/xml/samples
Diffing java
Diffing library
Diffing profiler
Diffing robdd
Diffing runtime
--- ws29/runtime/mercury_grade.h	Fri Jan 11 15:54:51 2002
+++ ws27/runtime/mercury_grade.h	Sat Jan 12 20:31:56 2002
@@ -52,7 +52,7 @@
 ** RTTI version number.
 */
 
-#define MR_GRADE_PART_0	v4_
+#define MR_GRADE_PART_0	v5_
 
 #ifdef MR_HIGHLEVEL_CODE
 
--- ws29/runtime/mercury_type_info.h	Thu Jan 17 22:54:37 2002
+++ ws27/runtime/mercury_type_info.h	Fri Jan 18 18:20:14 2002
@@ -87,16 +87,7 @@
 */
 
 #define MR_TYPE_CTOR_INFO_CHECK_RTTI_VERSION_RANGE(typector)    \
-    ( assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__VERSION_NO) \
-    || assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__COMPACT))
-
-/*---------------------------------------------------------------------------*/
-
-#ifdef  MR_BOOTSTRAP_TYPE_CTOR_COMPACT
-  #define       MR_TypeCtorInfo_Struct  MR_NewTypeCtorInfo_Struct
-#else
-  #define       MR_TypeCtorInfo_Struct  MR_OldTypeCtorInfo_Struct
-#endif
+    assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__COMPACT)
 
 /*---------------------------------------------------------------------------*/
 
@@ -234,7 +225,7 @@
 
 #define MR_pseudo_type_info_is_ground(pseudo_type_info)             \
     ( MR_CHECK_EXPR_TYPE((pseudo_type_info), MR_PseudoTypeInfo),    \
-      (MR_TypeInfo) (pseudo_type_info) )                            \
+      (MR_TypeInfo) (pseudo_type_info) )
 
 /*
 ** Macros for retrieving things from type_infos and pseudo_type_infos.
@@ -947,36 +938,18 @@
     ** `:- type' declaration.
     */
 
-struct MR_OldTypeCtorInfo_Struct {
-    MR_Integer          MR_type_ctor_arity;
-    MR_int_least8_t     MR_type_ctor_version;
-    MR_TypeCtorRepInt   MR_type_ctor_rep_CAST_ME;
-    MR_int_least8_t     MR_type_ctor_num_ptags;         /* if DU */
-    MR_ProcAddr         MR_type_ctor_unify_pred;
-    MR_ProcAddr         MR_type_ctor_compare_pred;
-    MR_Integer          MR_type_ctor_old_rep_CAST_ME;   /* unused */
-    MR_ProcAddr         MR_unused1;     /* spare */
-    MR_ProcAddr         MR_unused2;     /* spare */
-    MR_ConstString      MR_xtype_ctor_module_name;
-    MR_ConstString      MR_xtype_ctor_name;
-    MR_Integer          MR_xtype_ctor_old_version;       /* unused */
-    MR_TypeFunctors     MR_xtype_ctor_functors;
-    MR_TypeLayout       MR_xtype_ctor_layout;
-    MR_int_least32_t    MR_xtype_ctor_num_functors;
-};
-
-struct MR_NewTypeCtorInfo_Struct {
+struct MR_TypeCtorInfo_Struct {
     MR_Integer          MR_type_ctor_arity;
     MR_int_least8_t     MR_type_ctor_version;
     MR_TypeCtorRepInt   MR_type_ctor_rep_CAST_ME;
     MR_int_least8_t     MR_type_ctor_num_ptags;         /* if DU */
     MR_ProcAddr         MR_type_ctor_unify_pred;
     MR_ProcAddr         MR_type_ctor_compare_pred;
-    MR_ConstString      MR_xtype_ctor_module_name;
-    MR_ConstString      MR_xtype_ctor_name;
-    MR_TypeFunctors     MR_xtype_ctor_functors;
-    MR_TypeLayout       MR_xtype_ctor_layout;
-    MR_int_least32_t    MR_xtype_ctor_num_functors;
+    MR_ConstString      MR_type_ctor_module_name;
+    MR_ConstString      MR_type_ctor_name;
+    MR_TypeFunctors     MR_type_ctor_functors;
+    MR_TypeLayout       MR_type_ctor_layout;
+    MR_int_least32_t    MR_type_ctor_num_functors;
 
 /*
 ** The following fields will be added later, once we can exploit them:
@@ -989,34 +962,19 @@
     ((MR_TypeCtorRep) (tci)->MR_type_ctor_rep_CAST_ME)
 
 #define MR_type_ctor_module_name(tci)                                       \
-    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
-        MR_RTTI_VERSION__COMPACT) ?                                         \
-        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_module_name):\
-        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_module_name))
+    ((tci)->MR_type_ctor_module_name)
 
 #define MR_type_ctor_name(tci)                                              \
-    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
-        MR_RTTI_VERSION__COMPACT) ?                                         \
-        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_name) :  \
-        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_name))
+    ((tci)->MR_type_ctor_name)
 
 #define MR_type_ctor_functors(tci)                                          \
-    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
-        MR_RTTI_VERSION__COMPACT) ?                                         \
-        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_functors) :\
-        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_functors))
+    ((tci)->MR_type_ctor_functors)
 
 #define MR_type_ctor_layout(tci)                                            \
-    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
-        MR_RTTI_VERSION__COMPACT) ?                                         \
-        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_layout) :\
-        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_layout))
+    ((tci)->MR_type_ctor_layout)
 
 #define MR_type_ctor_num_functors(tci)                                      \
-    ( (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_type_ctor_version == \
-        MR_RTTI_VERSION__COMPACT) ?                                         \
-        (((struct MR_NewTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_num_functors) :\
-        (((struct MR_OldTypeCtorInfo_Struct *)(tci))->MR_xtype_ctor_num_functors))
+    ((tci)->MR_type_ctor_num_functors)
 
 /*---------------------------------------------------------------------------*/
 
@@ -1045,9 +1003,7 @@
 #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_TYPE                           \
     MR_STATIC_CODE_CONST struct MR_TypeCtorInfo_Struct
 
-#ifdef MR_BOOTSTRAP_TYPE_CTOR_COMPACT
-
-  #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_BODY(m, n, a, cr, u, c)      \
+#define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_BODY(m, n, a, cr, u, c)        \
     {                                                                   \
         a,                                                              \
         MR_RTTI_VERSION__COMPACT,                                       \
@@ -1062,29 +1018,6 @@
         -1                                                              \
     }
 
-#else
-
-  #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_BODY(m, n, a, cr, u, c)      \
-    {                                                                   \
-        a,                                                              \
-        MR_RTTI_VERSION__VERSION_NO,                                    \
-        cr,                                                             \
-        -1,                                                             \
-        MR_MAYBE_STATIC_CODE(MR_ENTRY(u)),                              \
-        MR_MAYBE_STATIC_CODE(MR_ENTRY(c)),                              \
-        cr,                                                             \
-        NULL,                                                           \
-        NULL,                                                           \
-        MR_string_const(MR_STRINGIFY(m), sizeof(MR_STRINGIFY(m))-1),    \
-        MR_string_const(MR_STRINGIFY(n), sizeof(MR_STRINGIFY(n))-1),    \
-        MR_RTTI_VERSION__VERSION_NO,                                    \
-        { 0 },                                                          \
-        { 0 },                                                          \
-        -1                                                              \
-    }
-
-#endif
-
 #define MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_PRED(m, n, a, cr, u, c)        \
         MR_DEFINE_BUILTIN_TYPE_CTOR_INFO_FULL(m, m, n, a, cr, u, c)
 
@@ -1130,8 +1063,6 @@
   #define MR_special_func_type(NAME, ARITY)                             \
 	MR_PASTE2(MR_, MR_PASTE2(NAME, MR_PASTE2(Func_, ARITY)))
 
-  #ifdef MR_BOOTSTRAP_TYPE_CTOR_COMPACT
-
     #define MR_define_type_ctor_info(module, type, arity, type_rep)         \
         const struct MR_TypeCtorInfo_Struct                                 \
             MR_type_ctor_info_name(module, type, arity) =                   \
@@ -1151,33 +1082,6 @@
             -1                                                              \
         }
 
-  #else /* MR_BOOTSTRAP_TYPE_CTOR_COMPACT */
-
-    #define MR_define_type_ctor_info(module, type, arity, type_rep)         \
-        const struct MR_TypeCtorInfo_Struct                                 \
-            MR_type_ctor_info_name(module, type, arity) =                   \
-        {                                                                   \
-            arity,                                                          \
-            MR_RTTI_VERSION__VERSION_NO,                                    \
-            type_rep,                                                       \
-            -1,                                                             \
-            (MR_Box) MR_type_ctor_info_func_name(module, type, arity,       \
-                            do_unify),                                      \
-            (MR_Box) MR_type_ctor_info_func_name(module, type, arity,       \
-                            do_compare),                                    \
-            type_rep,                                                       \
-            NULL,                                                           \
-            NULL,                                                           \
-            MR_STRINGIFY(module),                                           \
-            MR_STRINGIFY(type),                                             \
-            MR_RTTI_VERSION__VERSION_NO,                                    \
-            { 0 },                                                          \
-            { 0 },                                                          \
-            -1                                                              \
-        }
-
-  #endif /* MR_BOOTSTRAP_TYPE_CTOR_COMPACT */
-
 #else /* MR_HIGHLEVEL_CODE */
 
   #define MR_builtin_type_ctor_info_name(TYPE, ARITY)			            \
Diffing runtime/GETOPT
Diffing runtime/machdeps
Diffing samples
Diffing samples/c_interface
Diffing samples/c_interface/c_calls_mercury
Diffing samples/c_interface/cplusplus_calls_mercury
Diffing samples/c_interface/mercury_calls_c
Diffing samples/c_interface/mercury_calls_cplusplus
Diffing samples/c_interface/mercury_calls_fortran
Diffing samples/c_interface/simpler_c_calls_mercury
Diffing samples/c_interface/simpler_cplusplus_calls_mercury
Diffing samples/diff
Diffing samples/muz
Diffing samples/rot13
Diffing samples/solutions
Diffing samples/tests
Diffing samples/tests/c_interface
Diffing samples/tests/c_interface/c_calls_mercury
Diffing samples/tests/c_interface/cplusplus_calls_mercury
Diffing samples/tests/c_interface/mercury_calls_c
Diffing samples/tests/c_interface/mercury_calls_cplusplus
Diffing samples/tests/c_interface/mercury_calls_fortran
Diffing samples/tests/c_interface/simpler_c_calls_mercury
Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
Diffing samples/tests/diff
Diffing samples/tests/muz
Diffing samples/tests/rot13
Diffing samples/tests/solutions
Diffing samples/tests/toplevel
Diffing scripts
Diffing tests
Diffing tests/benchmarks
Diffing tests/debugger
Diffing tests/debugger/declarative
Diffing tests/dppd
Diffing tests/general
Diffing tests/general/accumulator
Diffing tests/general/structure_reuse
Diffing tests/hard_coded
Diffing tests/hard_coded/exceptions
Diffing tests/hard_coded/purity
Diffing tests/hard_coded/sub-modules
Diffing tests/hard_coded/typeclasses
Diffing tests/invalid
Diffing tests/invalid/purity
Diffing tests/misc_tests
Diffing tests/recompilation
Diffing tests/tabling
Diffing tests/term
Diffing tests/valid
Diffing tests/warnings
Diffing tools
Diffing trace
Diffing util
--------------------------------------------------------------------------
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