Type names in type info change

Oliver Hutchison ohutch at cs.mu.oz.au
Tue Feb 18 12:11:40 AEDT 1997


BTyson,

        Could you please review my changes?

Oliver

Estimated hours taken: 0.3

Added code to save type names in the base type info.
Fixed few small bugs.

compiler/base_type_info.m :
        Added code to place the type name/arity at the end of base type
        info's.

compiler/polymorphism.m :
        Documented change to base type info structure.

library/mercury_builtin.m :
        Changed hand coded type_info's to conform to new structure.

library/std_util.m :
        Fixed small documentation bug in expand.

runtime/deep_copy.c :
        Fixed typo in deep_copy.

runtime/type_info.h :
        Added hash define for type name offset in type info.

        
Index: compiler/base_type_info.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/base_type_info.m,v
retrieving revision 1.6
diff -u -r1.6 base_type_info.m
--- base_type_info.m	1997/02/14 05:53:54	1.6
+++ base_type_info.m	1997/02/18 00:53:44
@@ -145,7 +145,10 @@
 	->
 		base_type_info__construct_layout(ModuleInfo, TypeName,
 			TypeArity, LayoutArg),
-		list__append(PredAddrArgs, [LayoutArg], FinalArgs)
+		string__format("%s/%i", [s(TypeName), i(TypeArity)], 
+			FullTypeName),
+		NameArg = yes(const(string_const(FullTypeName))),
+		list__append(PredAddrArgs, [LayoutArg, NameArg], FinalArgs)
 	;
 		FinalArgs = PredAddrArgs
 	),
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.95
diff -u -r1.95 polymorphism.m
--- polymorphism.m	1997/02/17 01:26:55	1.95
+++ polymorphism.m	1997/02/18 00:54:04
@@ -41,6 +41,9 @@
 %	word 2		<index/2 predicate for type>
 %	word 3		<compare/3 predicate for type>
 %	word 4		<base_type_layout for type>
+%	word 5		<string name of type>
+%			e.g. "int/0" for 'int', "list/1" for 'list(T),
+%			"map/2" for 'map(K,V)'
 %
 %	or if using type_to_term predicates:
 %
cvs diff: Diffing compiler/notes
cvs diff: Diffing doc
cvs diff: Diffing library
Index: library/mercury_builtin.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/mercury_builtin.m,v
retrieving revision 1.65
diff -u -r1.65 mercury_builtin.m
--- mercury_builtin.m	1997/02/14 05:54:25	1.65
+++ mercury_builtin.m	1997/02/18 01:00:31
@@ -530,6 +530,7 @@
 #endif
 #ifdef USE_TYPE_LAYOUT
 	const Word *f7;
+	const Word *f8;
 #endif
 } mercury_data___base_type_info_int_0 = {
 	((Integer) 0),
@@ -541,7 +542,8 @@
 	MR_MAYBE_STATIC_CODE(ENTRY(mercury__builtin_type_to_term_int_2_0)),
 #endif
 #ifdef  USE_TYPE_LAYOUT
-	(const Word *) & mercury_data___base_type_layout_int_0
+	(const Word *) & mercury_data___base_type_layout_int_0,
+	(const Word *) string_const(""int/0"", 5)
 #endif
 };
 
@@ -563,6 +565,7 @@
 #endif
 #ifdef USE_TYPE_LAYOUT
 	const Word *f7;
+	const Word *f8;
 #endif
 } mercury_data___base_type_info_character_0 = {
 	((Integer) 0),
@@ -576,7 +579,8 @@
 		ENTRY(mercury__builtin_type_to_term_character_2_0)),
 #endif
 #ifdef  USE_TYPE_LAYOUT
-	(const Word *) & mercury_data___base_type_layout_character_0
+	(const Word *) & mercury_data___base_type_layout_character_0,
+	(const Word *) string_const(""char/0"", 6)
 #endif
 };
 
@@ -597,6 +601,7 @@
 #endif
 #ifdef USE_TYPE_LAYOUT
 	const Word *f7;
+	const Word *f8;
 #endif
 } mercury_data___base_type_info_string_0 = {
 	((Integer) 0),
@@ -608,7 +613,8 @@
 	MR_MAYBE_STATIC_CODE(ENTRY(mercury__builtin_type_to_term_string_2_0))
 #endif
 #ifdef  USE_TYPE_LAYOUT
-	(const Word *) & mercury_data___base_type_layout_string_0
+	(const Word *) & mercury_data___base_type_layout_string_0,
+	(const Word *) string_const(""string/0"", 8)
 #endif
 };
 
@@ -629,6 +635,7 @@
 #endif
 #ifdef USE_TYPE_LAYOUT
 	const Word *f7;
+	const Word *f8;
 #endif
 } mercury_data___base_type_info_float_0 = {
 	((Integer) 0),
@@ -640,7 +647,8 @@
 	MR_MAYBE_STATIC_CODE(ENTRY(mercury__builtin_type_to_term_float_2_0))
 #endif
 #ifdef  USE_TYPE_LAYOUT
-	(const Word *) & mercury_data___base_type_layout_float_0
+	(const Word *) & mercury_data___base_type_layout_float_0,
+	(const Word *) string_const(""float/0"", 7)
 #endif
 };
 
@@ -661,6 +669,7 @@
 #endif
 #ifdef USE_TYPE_LAYOUT
 	const Word *f7;
+	const Word *f8;
 #endif
 } mercury_data___base_type_info_pred_0 = {
 	((Integer) 0),
@@ -672,7 +681,8 @@
 	MR_MAYBE_STATIC_CODE(ENTRY(mercury__builtin_type_to_term_pred_2_0))
 #endif
 #ifdef  USE_TYPE_LAYOUT
-	(const Word *) & mercury_data___base_type_layout_pred_0
+	(const Word *) & mercury_data___base_type_layout_pred_0,
+	(const Word *) string_const(""pred/?"", 6)
 #endif
 };
 
Index: library/std_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/std_util.m,v
retrieving revision 1.70
diff -u -r1.70 std_util.m
--- std_util.m	1997/02/13 16:41:15	1.70
+++ std_util.m	1997/02/18 00:54:38
@@ -905,7 +905,7 @@
 **	call save_transient_registers(), and afterwards, call
 **	restore_transient_registers().
 **
-** 	If writing a C function that calls deep_copy, make sure you
+** 	If writing a C function that calls expand, make sure you
 ** 	document that around your function, save_transient_registers()
 ** 	restore_transient_registers() need to be used.
 */
Index: runtime/deep_copy.c
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/deep_copy.c,v
retrieving revision 1.7
diff -u -r1.7 deep_copy.c
--- deep_copy.c	1997/02/17 01:02:11	1.7
+++ deep_copy.c	1997/02/17 01:23:07
@@ -231,7 +231,7 @@
             break;
         }
 
-        case_TYPELAYOUT_EQUIV_TAG:
+        case TYPELAYOUT_EQUIV_TAG:
             /* note: we treat no_tag types just like equivalences */
 
             if ((Word) entry_value < TYPELAYOUT_MAX_VARINT) {
Index: runtime/type_info.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/type_info.h,v
retrieving revision 1.18
diff -u -r1.18 type_info.h
--- type_info.h	1997/02/18 00:28:16	1.18
+++ type_info.h	1997/02/18 00:59:03
@@ -73,9 +73,11 @@
 #ifdef USE_TYPE_TO_TERM
 	#define OFFSET_FOR_ARG_TYPE_INFOS 6 
 	#define OFFSET_FOR_BASE_TYPE_LAYOUT 6 
+	#define OFFSET_FOR_TYPE_NAME 7
 #else
 	#define OFFSET_FOR_ARG_TYPE_INFOS 4
 	#define OFFSET_FOR_BASE_TYPE_LAYOUT 4
+	#define OFFSET_FOR_TYPE_NAME 5
 #endif
 
 /*




More information about the developers mailing list