[m-rev.] for review: rely on type_ctor_info flags

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Mar 17 17:43:33 AEDT 2003


Start using the flags in type_ctor_infos to improve effificiency.

runtime/*.c:
	Replace uses of the old, expensive macros for testing whether a
	type_ctor is variable arity or of some kind of discriminated union
	type with uses of the macros that do the same job by testing
	type_ctor_info flags.

runtime/mercury_type_info.h:
	Delete the old, expensive macros.

	Set the minimum RTTI version number to the one that implements
	their newer versions.

runtime/mercury_grade.h:
	Increment the version compatibility number accordingly.

configure.in:
	Require the RTTI system to have flags.

compiler/c_util.m:
	Don't emit the macro that used to cause type_ctor_infos to have
	flags; the version of mercury_type_info.h that doesn't need the flag
	has been installed on all our machines.

Zoltan.

cvs diff: Diffing .
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.356
diff -u -b -r1.356 configure.in
--- configure.in	1 Mar 2003 06:34:45 -0000	1.356
+++ configure.in	16 Mar 2003 09:49:44 -0000
@@ -171,7 +171,7 @@
 		main(!IO) :-
 			return_rtti_version(Version),
 			(
-				Version >= 6,
+				Version >= 8,
 				ac(2) ^ elem(3, 5) = 17
 			->
 				io.print("Hello, world\n", !IO)
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/c_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/c_util.m,v
retrieving revision 1.15
diff -u -b -r1.15 c_util.m
--- compiler/c_util.m	16 Mar 2003 08:01:26 -0000	1.15
+++ compiler/c_util.m	16 Mar 2003 09:44:44 -0000
@@ -407,8 +407,6 @@
 		"**\n",
 		"** END_OF_C_GRADE_INFO\n",
 		"*/\n",
-		"\n",
-		"#define MR_TYPE_CTOR_INFO_HAS_FLAG 1\n",
 		"\n"
 	]).
 
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/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
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_deep_copy_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy_body.h,v
retrieving revision 1.58
diff -u -b -r1.58 mercury_deep_copy_body.h
--- runtime/mercury_deep_copy_body.h	10 Feb 2003 17:12:02 -0000	1.58
+++ runtime/mercury_deep_copy_body.h	16 Mar 2003 09:38:12 -0000
@@ -709,9 +709,7 @@
             return (MR_TypeInfo) type_ctor_info;
         }
 
-        if (MR_type_ctor_rep_is_variable_arity(
-            MR_type_ctor_rep(type_ctor_info)))
-        {
+        if (MR_type_ctor_has_variable_arity(type_ctor_info)) {
             arity = MR_TYPEINFO_GET_VAR_ARITY_ARITY(type_info);
             type_info_args =
                 MR_TYPEINFO_GET_VAR_ARITY_ARG_VECTOR(type_info);
@@ -727,10 +725,12 @@
             MR_fill_in_fixed_arity_type_info(new_type_info_arena,
                 type_ctor_info, new_type_info_args);
         }
+
         for (i = 1; i <= arity; i++) {
             new_type_info_args[i] = copy_type_info(type_info_args[i],
                 lower_limit, upper_limit);
         }
+
         leave_forwarding_pointer((MR_Word) type_info,
             TYPEINFO_FORWARDING_PTR_OFFSET, (MR_Word) new_type_info_arena);
         return (MR_TypeInfo) new_type_info_arena;
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.46
diff -u -b -r1.46 mercury_grade.h
--- runtime/mercury_grade.h	14 Feb 2003 09:58:41 -0000	1.46
+++ runtime/mercury_grade.h	16 Mar 2003 09:44:26 -0000
@@ -54,11 +54,7 @@
 ** RTTI version number.
 */
 
-#ifdef MR_HIGHLEVEL_CODE
-  #define MR_GRADE_PART_0	v10_
-#else
-  #define MR_GRADE_PART_0	v9_
-#endif
+#define MR_GRADE_PART_0	v11_
 
 #ifdef MR_HIGHLEVEL_CODE
 
Index: runtime/mercury_make_type_info_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_make_type_info_body.h,v
retrieving revision 1.10
diff -u -b -r1.10 mercury_make_type_info_body.h
--- runtime/mercury_make_type_info_body.h	13 Mar 2003 01:47:05 -0000	1.10
+++ runtime/mercury_make_type_info_body.h	16 Mar 2003 09:38:41 -0000
@@ -79,9 +79,7 @@
 		return (MR_TypeInfo) type_info_arena;
 	}
 
-	if (MR_type_ctor_rep_is_variable_arity(
-		MR_type_ctor_rep(type_ctor_info)))
-	{
+	if (MR_type_ctor_has_variable_arity(type_ctor_info)) {
 		arity = MR_PSEUDO_TYPEINFO_GET_VAR_ARITY_ARITY(
 			pseudo_type_info);
 		start_region_size = 2;
Index: runtime/mercury_ml_expand_body.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ml_expand_body.h,v
retrieving revision 1.24
diff -u -b -r1.24 mercury_ml_expand_body.h
--- runtime/mercury_ml_expand_body.h	10 Feb 2003 17:03:57 -0000	1.24
+++ runtime/mercury_ml_expand_body.h	16 Mar 2003 09:38:59 -0000
@@ -933,9 +933,7 @@
                     MR_TYPEINFO_GET_TYPE_CTOR_INFO(data_type_info);
                 handle_functor_name(MR_type_ctor_name(data_type_ctor_info));
 
-                if (MR_type_ctor_rep_is_variable_arity(
-                    MR_type_ctor_rep(data_type_ctor_info)))
-                {
+                if (MR_type_ctor_has_variable_arity(data_type_ctor_info)) {
                     num_args =
                         MR_TYPEINFO_GET_VAR_ARITY_ARITY(data_type_info);
                     arg_type_infos = (MR_Word *)
@@ -945,6 +943,7 @@
                     arg_type_infos = (MR_Word *)
                         MR_TYPEINFO_GET_FIXED_ARITY_ARG_VECTOR(data_type_info);
                 }
+
                 expand_info->arity = num_args;
                 /* switch from 1-based to 0-based array indexing */
                 arg_type_infos++;
Index: runtime/mercury_tabling.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.c,v
retrieving revision 1.55
diff -u -b -r1.55 mercury_tabling.c
--- runtime/mercury_tabling.c	10 Feb 2003 17:12:02 -0000	1.55
+++ runtime/mercury_tabling.c	16 Mar 2003 09:39:12 -0000
@@ -797,7 +797,7 @@
     ** sense. This is OK, because in that case it will never be used.
     */
 
-    if (MR_type_ctor_rep_is_variable_arity(MR_type_ctor_rep(type_ctor_info))) {
+    if (MR_type_ctor_has_variable_arity(type_ctor_info)) {
         arity = MR_TYPEINFO_GET_VAR_ARITY_ARITY(type_info);
         arg_vector = MR_TYPEINFO_GET_VAR_ARITY_ARG_VECTOR(type_info);
         node = MR_int_hash_lookup_or_add(node, arity);
Index: runtime/mercury_type_desc.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_desc.c,v
retrieving revision 1.4
diff -u -b -r1.4 mercury_type_desc.c
--- runtime/mercury_type_desc.c	12 Apr 2002 01:24:24 -0000	1.4
+++ runtime/mercury_type_desc.c	16 Mar 2003 09:39:27 -0000
@@ -68,9 +68,7 @@
 	type_ctor_desc = MR_make_type_ctor_desc(type_info, type_ctor_info);
 	*type_ctor_desc_ptr = type_ctor_desc;
 
-	if (MR_type_ctor_rep_is_variable_arity(
-		MR_type_ctor_rep(type_ctor_info)))
-	{
+	if (MR_type_ctor_has_variable_arity(type_ctor_info)) {
 		arity = MR_TYPECTOR_DESC_GET_VA_ARITY(type_ctor_desc);
 		*arg_type_info_list_ptr = MR_type_params_vector_to_list(arity,
 			MR_TYPEINFO_GET_VAR_ARITY_ARG_VECTOR(type_info));
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.55
diff -u -b -r1.55 mercury_type_info.c
--- runtime/mercury_type_info.c	13 Mar 2003 01:47:05 -0000	1.55
+++ runtime/mercury_type_info.c	16 Mar 2003 09:39:46 -0000
@@ -179,7 +179,7 @@
 	** the arities before we can check the argument types.
 	*/
 
-	if (MR_type_ctor_rep_is_variable_arity(MR_type_ctor_rep(tci1))) {
+	if (MR_type_ctor_has_variable_arity(tci1)) {
 		num_arg_types_1 = MR_TYPEINFO_GET_VAR_ARITY_ARITY(ti1);
 		num_arg_types_2 = MR_TYPEINFO_GET_VAR_ARITY_ARITY(ti2);
 
@@ -264,7 +264,7 @@
 	** the arities before we can check the argument types.
 	*/
 
-	if (MR_type_ctor_rep_is_variable_arity(MR_type_ctor_rep(tci1))) {
+	if (MR_type_ctor_has_variable_arity(tci1)) {
 		num_arg_types_1 = MR_TYPEINFO_GET_VAR_ARITY_ARITY(ti1);
 		num_arg_types_2 = MR_TYPEINFO_GET_VAR_ARITY_ARITY(ti2);
 
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.100
diff -u -b -r1.100 mercury_type_info.h
--- runtime/mercury_type_info.h	13 Mar 2003 01:47:05 -0000	1.100
+++ runtime/mercury_type_info.h	16 Mar 2003 09:41:43 -0000
@@ -94,8 +94,7 @@
 */
 
 #define MR_TYPE_CTOR_INFO_CHECK_RTTI_VERSION_RANGE(typector)    \
-    assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__REP \
-        || typector->MR_type_ctor_version == MR_RTTI_VERSION__FLAG)
+    assert(typector->MR_type_ctor_version == MR_RTTI_VERSION__FLAG)
 
 /*---------------------------------------------------------------------------*/
 
@@ -646,29 +645,6 @@
     "BASETYPECLASSINFO",                        \
     "FOREIGN",                                  \
     "UNKNOWN"
-
-#define MR_type_ctor_rep_is_basically_du(rep)               \
-    (  ((rep) == MR_TYPECTOR_REP_ENUM)                      \
-    || ((rep) == MR_TYPECTOR_REP_ENUM_USEREQ)               \
-    || ((rep) == MR_TYPECTOR_REP_DU)                        \
-    || ((rep) == MR_TYPECTOR_REP_DU_USEREQ)                 \
-    || ((rep) == MR_TYPECTOR_REP_NOTAG)                     \
-    || ((rep) == MR_TYPECTOR_REP_NOTAG_USEREQ)              \
-    || ((rep) == MR_TYPECTOR_REP_NOTAG_GROUND)              \
-    || ((rep) == MR_TYPECTOR_REP_NOTAG_GROUND_USEREQ)       \
-    || ((rep) == MR_TYPECTOR_REP_RESERVED_ADDR)             \
-    || ((rep) == MR_TYPECTOR_REP_RESERVED_ADDR_USEREQ))
-
-/*
-** Returns MR_TRUE if the type_ctor_info is used to represent
-** multiple types of different arities. The arity is stored
-** as the first element of the argument type-info vector.
-** This is true for higher-order types and tuple types.
-*/
-#define MR_type_ctor_rep_is_variable_arity(rep)             \
-    (  ((rep) == MR_TYPECTOR_REP_PRED)                      \
-    || ((rep) == MR_TYPECTOR_REP_FUNC)                      \
-    || ((rep) == MR_TYPECTOR_REP_TUPLE))
 
 /*---------------------------------------------------------------------------*/
 
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