[m-dev.] for review: hand defined types

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Feb 8 12:22:32 AEDT 2000


For review by Tyson or Fergus.

Remove almost all references to type_id_is_hand_defined, because it makes
bootstrapping hard. Instead, consider that a type is hand defined if it is
abstract even in the module that defines it, or if it appears on a short
list of types which have hand-defined RTTI even though they have (incorrect)
Mercury definitions as well. The list contains private_builtin's type_info,
type_ctor_info, typeclass_info and base_typeclass_info.

The one remaining use of type_id_is_hand_defined should be fixed by Fergus
later.

compiler/base_type_info.m:
compiler/base_type_layout.m:
compiler/make_hlds.m:
	Remove references to type_id_is_hand_defined.

compiler/type_util.m:
	Add a predicate type_id_has_hand_defined_rtti that should eventually
	replace type_id_is_hand_defined.

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
Index: compiler/base_type_info.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/base_type_info.m,v
retrieving revision 1.31
diff -u -b -r1.31 base_type_info.m
--- compiler/base_type_info.m	2000/01/19 09:45:03	1.31
+++ compiler/base_type_info.m	2000/02/07 07:12:21
@@ -71,9 +71,11 @@
 		SymName = qualified(TypeModuleName, TypeName),
 		( 
 			TypeModuleName = ModuleName,
-			\+ type_id_is_hand_defined(TypeId)
-		->
 			map__lookup(TypeTable, TypeId, TypeDefn),
+			hlds_data__get_type_defn_body(TypeDefn, TypeBody),
+			TypeBody \= abstract_type,
+			\+ type_id_has_hand_defined_rtti(TypeId)
+		->
 			hlds_data__get_type_defn_status(TypeDefn, Status),
 			special_pred_list(Specials),
 			module_info_globals(ModuleInfo, Globals),
Index: compiler/base_type_layout.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/base_type_layout.m,v
retrieving revision 1.53
diff -u -b -r1.53 base_type_layout.m
--- compiler/base_type_layout.m	2000/01/19 09:45:04	1.53
+++ compiler/base_type_layout.m	2000/02/07 07:12:39
@@ -262,9 +262,11 @@
 		SymName = qualified(TypeModuleName, TypeName),
 		( 
 			TypeModuleName = ModuleName,
-			\+ type_id_is_hand_defined(TypeId)
-		->
 			map__lookup(TypeTable, TypeId, TypeDefn),
+			hlds_data__get_type_defn_body(TypeDefn, TypeBody),
+			TypeBody \= abstract_type,
+			\+ type_id_has_hand_defined_rtti(TypeId)
+		->
 			hlds_data__get_type_defn_status(TypeDefn, Status),
 
 			Info = base_gen_layout(TypeId, ModuleName, TypeName,
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.322
diff -u -b -r1.322 make_hlds.m
--- compiler/make_hlds.m	2000/01/25 04:09:47	1.322
+++ compiler/make_hlds.m	2000/02/07 08:00:07
@@ -1800,7 +1800,7 @@
 			;
 				{ Body = uu_type(_) }
 			;
-				{ type_id_is_hand_defined(TypeId) }
+				{ type_id_has_hand_defined_rtti(TypeId) }
 			)
 		->
 			{ special_pred_list(SpecialPredIds) },
Index: compiler/type_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/type_util.m,v
retrieving revision 1.77
diff -u -b -r1.77 type_util.m
--- compiler/type_util.m	2000/02/04 06:54:55	1.77
+++ compiler/type_util.m	2000/02/08 00:57:00
@@ -66,10 +66,19 @@
 :- pred type_util__remove_aditi_state(list(type), list(T), list(T)).
 :- mode type_util__remove_aditi_state(in, in, out) is det.
 
-	% A test for types that are defined by hand (not including
-	% the builtin types).  Don't generate type_ctor_*
-	% for these types.
+	% A test for types that are defined in Mercury, but whose definitions
+	% are `lies', i.e. they are not sufficiently accurate for RTTI
+	% structures describing the types. Since the RTTI will be hand defined,
+	% the compiler shouldn't generate RTTI for these types.
 
+:- pred type_id_has_hand_defined_rtti(type_id).
+:- mode type_id_has_hand_defined_rtti(in) is semidet.
+
+	% A test for types that are defined by hand, not including
+	% the builtin types.  Don't generate type_ctor_* for these types.
+	%
+	% WARNING: This predicate is obsolete.
+
 :- pred type_id_is_hand_defined(type_id).
 :- mode type_id_is_hand_defined(in) is semidet.
 
@@ -366,6 +375,15 @@
 	BuiltinType \= user_type.
 
 type_util__var(term__variable(Var), Var).
+
+type_id_has_hand_defined_rtti(qualified(PB, "type_info") - 1) :-
+	mercury_private_builtin_module(PB).
+type_id_has_hand_defined_rtti(qualified(PB, "type_ctor_info") - 1) :-
+	mercury_private_builtin_module(PB).
+type_id_has_hand_defined_rtti(qualified(PB, "typeclass_info") - 1) :-
+	mercury_private_builtin_module(PB).
+type_id_has_hand_defined_rtti(qualified(PB, "base_typeclass_info") - 1) :-
+	mercury_private_builtin_module(PB).
 
 type_id_is_hand_defined(qualified(unqualified("builtin"), "c_pointer") - 0).
 type_id_is_hand_defined(qualified(unqualified("std_util"), "univ") - 0).
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/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
cvs diff: Diffing profiler
cvs diff: Diffing runtime
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 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
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