[m-dev.] diff: typeinfos in non-gc grades

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Apr 13 16:57:58 AEST 2000


Clean up some typeinfo handling code that is only enabled in non-gc grades.

runtime/mercury_deep_copy.[ch]:
	Make the typeinfo arg of MR_make_long_lived MR_TypeInfo, not Word.

runtime/mercury_tabling_macros.h:
	Treat the typeinfo arg of MR_make_permanent, a macro that calls
	MR_make_long_lived, a MR_TypeInfo, not Word.

library/exception.m:
library/std_util.m:
	Treat the typeinfo arg of deep_copy as MR_TypeInfo, not Word.

	Also fix some other warnings in std_util.m.

library/private_builtin.m:
	Pass the addresses of type_ctor_infos (which function as type_infos)
	to MR_TABLE_SAVE_ANSWER.

	Expect that argument to be a typeinfo, not the name of a type_ctor_info
	to take the address of.

trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
	Treat the typeinfo arg of deep_copy as MR_TypeInfo, not Word.

Zoltan.

cvs diff: Diffing .
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/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
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/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/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/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
Index: library/exception.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/exception.m,v
retrieving revision 1.17
diff -u -b -B -r1.17 exception.m
--- library/exception.m	2000/03/31 08:59:29	1.17
+++ library/exception.m	2000/04/13 05:24:43
@@ -1397,7 +1397,7 @@
 		MR_EXCEPTION_FRAMEVARS->heap_zone->top);
 	save_transient_registers();
 	exception = deep_copy(&exception,
-		(Word *) &mercury_data_std_util__type_ctor_info_univ_0,
+		(MR_TypeInfo) &mercury_data_std_util__type_ctor_info_univ_0,
 		MR_EXCEPTION_FRAMEVARS->heap_ptr,
 		MR_EXCEPTION_FRAMEVARS->heap_zone->top);
 	restore_transient_registers();
@@ -1414,7 +1414,7 @@
 		MR_solutions_heap_zone->top);
 	save_transient_registers();
 	exception = deep_copy(&exception,
-		(Word *) &mercury_data_std_util__type_ctor_info_univ_0,
+		(MR_TypeInfo) &mercury_data_std_util__type_ctor_info_univ_0,
 		saved_solns_heap_ptr, MR_solutions_heap_zone->top);
 	restore_transient_registers();
 
Index: library/private_builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/private_builtin.m,v
retrieving revision 1.45
diff -u -b -B -r1.45 private_builtin.m
--- library/private_builtin.m	2000/04/11 07:57:16	1.45
+++ library/private_builtin.m	2000/04/13 05:24:43
@@ -1245,7 +1245,7 @@
 
 	table = (MR_TrieNode) T;
 	MR_TABLE_SAVE_ANSWER(table, Offset, I,
-		mercury_data___type_ctor_info_int_0);
+		&mercury_data___type_ctor_info_int_0);
 ").
 
 :- pragma c_code(table_save_char_ans(T::in, Offset::in, C::in),
@@ -1254,7 +1254,7 @@
 
 	table = (MR_TrieNode) T;
 	MR_TABLE_SAVE_ANSWER(table, Offset, C,
-		mercury_data___type_ctor_info_character_0);
+		&mercury_data___type_ctor_info_character_0);
 ").
 
 :- pragma c_code(table_save_string_ans(T::in, Offset::in, S::in),
@@ -1263,7 +1263,7 @@
 
 	table = (MR_TrieNode) T;
 	MR_TABLE_SAVE_ANSWER(table, Offset, (Word) S,
-		mercury_data___type_ctor_info_string_0);
+		&mercury_data___type_ctor_info_string_0);
 ").
 
 :- pragma c_code(table_save_float_ans(T::in, Offset::in, F::in),
@@ -1272,7 +1272,7 @@
 
 	table = (MR_TrieNode) T;
 	MR_TABLE_SAVE_ANSWER(table, Offset, float_to_word(F),
-		mercury_data___type_ctor_info_float_0);
+		&mercury_data___type_ctor_info_float_0);
 ").
 
 :- pragma c_code(table_save_any_ans(T::in, Offset::in, V::in),
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.187
diff -u -b -B -r1.187 std_util.m
--- library/std_util.m	2000/04/02 06:37:15	1.187
+++ library/std_util.m	2000/04/13 05:24:43
@@ -697,8 +697,8 @@
 "
 	/* save heap states */
 #ifndef CONSERVATIVE_GC
- 	HeapPtr = MR_hp;
- 	SolutionsHeapPtr = MR_sol_hp;
+ 	HeapPtr = (Word) MR_hp;
+ 	SolutionsHeapPtr = (Word) MR_sol_hp;
 #else
 	HeapPtr = SolutionsHeapPtr = 0;
 #endif
@@ -783,8 +783,8 @@
   		OldVar, NewVal, TypeInfo_for_T)				\\
   	do {								\\
 		save_transient_hp();					\\
-		NewVal = deep_copy(&OldVal, TypeInfo_for_T,		\\
-				SolutionsHeapPtr,			\\
+		NewVal = deep_copy(&OldVal, (MR_TypeInfo) TypeInfo_for_T,\\
+				(const Word *) SolutionsHeapPtr,	\\
 				MR_ENGINE(solutions_heap_zone)->top);	\\
 		restore_transient_hp();					\\
 	} while (0)
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/mercury_deep_copy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.c,v
retrieving revision 1.16
diff -u -b -B -r1.16 mercury_deep_copy.c
--- runtime/mercury_deep_copy.c	1999/12/09 04:42:26	1.16
+++ runtime/mercury_deep_copy.c	2000/04/13 05:24:43
@@ -112,8 +112,9 @@
 /*
 ** MR_make_long_lived(): see mercury_deep_copy.h for documentation.
 */
+
 Word
-MR_make_long_lived(Word term, Word *type_info, Word *lower_limit)
+MR_make_long_lived(Word term, MR_TypeInfo type_info, Word *lower_limit)
 {
 	Word result;
 
@@ -142,5 +143,5 @@
 
 	return result;
 }
-#endif	/* not CONSERVATIVE_GC */
 
+#endif	/* not CONSERVATIVE_GC */
Index: runtime/mercury_deep_copy.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.h,v
retrieving revision 1.8
diff -u -b -B -r1.8 mercury_deep_copy.h
--- runtime/mercury_deep_copy.h	2000/03/24 10:27:46	1.8
+++ runtime/mercury_deep_copy.h	2000/04/13 05:24:43
@@ -129,7 +129,7 @@
 #ifdef CONSERVATIVE_GC
   #define MR_make_long_lived(term, type_info, lower_limit) (term)
 #else
-  Word MR_make_long_lived(Word term, Word *type_info, Word *lower_limit);
+  Word MR_make_long_lived(Word term, MR_TypeInfo type_info, Word *lower_limit);
 #endif
 
 #endif /* not MERCURY_DEEP_COPY_H */
Index: runtime/mercury_tabling_macros.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling_macros.h,v
retrieving revision 1.3
diff -u -b -B -r1.3 mercury_tabling_macros.h
--- runtime/mercury_tabling_macros.h	2000/03/10 13:38:14	1.3
+++ runtime/mercury_tabling_macros.h	2000/04/13 05:24:43
@@ -367,5 +367,5 @@
 	do {								\
 		(table)->MR_answerblock[offset] =			\
 			MR_make_permanent((value),			\
-					((Word *) (Word) &type_info));	\
+					(MR_TypeInfo) (type_info));	\
 	} while(0)
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/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
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
Index: trace/mercury_trace_browse.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_browse.c,v
retrieving revision 1.10
diff -u -b -B -r1.10 mercury_trace_browse.c
--- trace/mercury_trace_browse.c	2000/03/22 09:07:08	1.10
+++ trace/mercury_trace_browse.c	2000/04/13 05:24:43
@@ -33,7 +33,7 @@
 #include <stdio.h>
 
 static	Word		MR_trace_browser_state;
-static	Word		MR_trace_browser_state_type;
+static	MR_TypeInfo	MR_trace_browser_state_type;
 
 static	void		MR_trace_browse_ensure_init(void);
 
@@ -60,7 +60,7 @@
 			MR_trace_browser_state, &MR_trace_browser_state);
 	);
 	MR_trace_browser_state = MR_make_permanent(MR_trace_browser_state,
-				(Word *) MR_trace_browser_state_type);
+				MR_trace_browser_state_type);
 }
 
 	
@@ -85,7 +85,7 @@
 			MR_trace_browser_state, &MR_trace_browser_state);
 	);
 	MR_trace_browser_state = MR_make_permanent(MR_trace_browser_state,
-				(Word *) MR_trace_browser_state_type);
+				MR_trace_browser_state_type);
 }
 
 #endif
@@ -109,22 +109,25 @@
 MR_trace_browse_ensure_init(void)
 {
 	static	bool	done = FALSE;
-	Word		typeinfo_type;
+	Word		typeinfo_type_word;
+	Word		MR_trace_browser_state_type_word;
 
 	if (! done) {
 		MR_TRACE_CALL_MERCURY(
-			ML_get_type_info_for_type_info(&typeinfo_type);
+			ML_get_type_info_for_type_info(&typeinfo_type_word);
 			ML_BROWSE_browser_state_type(
-				&MR_trace_browser_state_type);
+				&MR_trace_browser_state_type_word);
+			MR_trace_browser_state_type = (MR_TypeInfo)
+				MR_trace_browser_state_type_word;
 			ML_BROWSE_init_state(&MR_trace_browser_state);
 		);
 
-		MR_trace_browser_state_type = MR_make_permanent(
-					MR_trace_browser_state_type,
-					(Word *) typeinfo_type);
+		MR_trace_browser_state_type = (MR_TypeInfo) MR_make_permanent(
+					(Word) MR_trace_browser_state_type,
+					(MR_TypeInfo) typeinfo_type_word);
 		MR_trace_browser_state = MR_make_permanent(
 					MR_trace_browser_state,
-					(Word *) MR_trace_browser_state_type);
+					MR_trace_browser_state_type);
 		done = TRUE;
 	}
 }
Index: trace/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_external.c,v
retrieving revision 1.37
diff -u -b -B -r1.37 mercury_trace_external.c
--- trace/mercury_trace_external.c	2000/03/24 10:28:07	1.37
+++ trace/mercury_trace_external.c	2000/04/13 05:24:43
@@ -790,7 +790,7 @@
 					MR_collecting_variable = 
 					    MR_make_permanent(
 						MR_collecting_variable,
-						(Word *) 
+						(MR_TypeInfo) 
 						MR_collecting_variable_type);
 				} else {
 					MR_send_message_to_socket(
Index: trace/mercury_trace_help.c
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_trace_help.c,v
retrieving revision 1.8
diff -u -b -B -r1.8 mercury_trace_help.c
--- trace/mercury_trace_help.c	2000/03/22 09:12:29	1.8
+++ trace/mercury_trace_help.c	2000/04/13 05:24:43
@@ -34,7 +34,7 @@
 #include <stdio.h>
 
 static	Word		MR_trace_help_system;
-static	Word		MR_trace_help_system_type;
+static	MR_TypeInfo	MR_trace_help_system_type;
 static	Word		MR_trace_help_stdout;
 
 static	const char	*MR_trace_help_add_node(Word path, const char *name,
@@ -94,7 +94,7 @@
 	);
 
 	MR_trace_help_system = MR_make_permanent(MR_trace_help_system,
-				(Word *) MR_trace_help_system_type);
+				MR_trace_help_system_type);
 
 	return (error ? msg : NULL);
 }
@@ -162,23 +162,27 @@
 	static	bool	done = FALSE;
 	Word		typeinfo_type;
 	Word		output_stream_type;
+	Word		MR_trace_help_system_type_word;
 
 	if (! done) {
 		MR_TRACE_CALL_MERCURY(
 			ML_get_type_info_for_type_info(&typeinfo_type);
-			ML_HELP_help_system_type(&MR_trace_help_system_type);
+			ML_HELP_help_system_type(
+				&MR_trace_help_system_type_word);
+			MR_trace_help_system_type =
+				(MR_TypeInfo) MR_trace_help_system_type_word;
 			ML_HELP_init(&MR_trace_help_system);
 			ML_io_output_stream_type(&output_stream_type);
 			ML_io_stdout_stream(&MR_trace_help_stdout);
 		);
 
-		MR_trace_help_system_type = MR_make_permanent(
-					MR_trace_help_system_type,
-					(Word *) typeinfo_type);
+		MR_trace_help_system_type = (MR_TypeInfo) MR_make_permanent(
+					(Word) MR_trace_help_system_type,
+					(MR_TypeInfo) typeinfo_type);
 		MR_trace_help_system = MR_make_permanent(MR_trace_help_system,
-					(Word *) MR_trace_help_system_type);
+					MR_trace_help_system_type);
 		MR_trace_help_stdout = MR_make_permanent(MR_trace_help_stdout,
-					(Word *) output_stream_type);
+					(MR_TypeInfo) output_stream_type);
 
 		done = TRUE;
 	}
cvs diff: Diffing trial
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list