diff: remove support for --type-info-method

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Jan 21 17:06:38 AEDT 1998


Hi,

Anyone have any objections to this?

compiler/options.m:
compiler/handle_options.m:
compiler/globals.m:
compiler/polymorphism.m:
runtime/mercury_type_info.h:
	Remove the last vestiges of support for type_info representations
	other than "shared-one-or-two-cell".

cvs diff  compiler/globals.m compiler/handle_options.m compiler/options.m compiler/polymorphism.m runtime/mercury_type_info.h
Index: compiler/globals.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.25
diff -u -r1.25 globals.m
--- globals.m	1998/01/13 09:59:50	1.25
+++ globals.m	1998/01/20 12:46:06
@@ -35,11 +35,6 @@
 	--->	simple
 	;	compact.
 
-	% Once upon a time, there were more type_info options than this.
-
-:- type type_info_method
-	--->	shared_one_or_two_cell.
-
 :- type prolog_dialect
 	--->	default
 	;	nu
@@ -57,8 +52,6 @@
 
 :- pred convert_args_method(string::in, args_method::out) is semidet.
 
-:- pred convert_type_info_method(string::in, type_info_method::out) is semidet.
-
 :- pred convert_prolog_dialect(string::in, prolog_dialect::out) is semidet.
 
 :- pred convert_termination_norm(string::in, termination_norm::out) is semidet.
@@ -68,15 +61,13 @@
 	% Access predicates for the `globals' structure.
 
 :- pred globals__init(option_table::di, gc_method::di, tags_method::di,
-	args_method::di, type_info_method::di, prolog_dialect::di, 
+	args_method::di, prolog_dialect::di, 
 	termination_norm::di, globals::uo) is det.
 
 :- pred globals__get_options(globals::in, option_table::out) is det.
 :- pred globals__get_gc_method(globals::in, gc_method::out) is det.
 :- pred globals__get_tags_method(globals::in, tags_method::out) is det.
 :- pred globals__get_args_method(globals::in, args_method::out) is det.
-:- pred globals__get_type_info_method(globals::in, type_info_method::out)
-	is det.
 :- pred globals__get_prolog_dialect(globals::in, prolog_dialect::out) is det.
 :- pred globals__get_termination_norm(globals::in, termination_norm::out) 
 	is det.
@@ -89,8 +80,6 @@
 	is det.
 :- pred globals__set_args_method(globals::in, args_method::in, globals::out)
 	is det.
-:- pred globals__set_type_info_method(globals::in, type_info_method::in,
-	globals::out) is det.
 :- pred globals__set_prolog_dialect(globals::in, prolog_dialect::in,
 	globals::out) is det.
 :- pred globals__set_termination_norm(globals::in, termination_norm::in,
@@ -123,8 +112,8 @@
 	% io__state using io__set_globals and io__get_globals.
 
 :- pred globals__io_init(option_table::di, gc_method::in, tags_method::in,
-	args_method::in, type_info_method::in, prolog_dialect::in,
-	termination_norm::in, io__state::di, io__state::uo) is det.
+	args_method::in, prolog_dialect::in, termination_norm::in,
+	io__state::di, io__state::uo) is det.
 
 :- pred globals__io_get_gc_method(gc_method::out,
 	io__state::di, io__state::uo) is det.
@@ -135,9 +124,6 @@
 :- pred globals__io_get_args_method(args_method::out,
 	io__state::di, io__state::uo) is det.
 
-:- pred globals__io_get_type_info_method(type_info_method::out,
-	io__state::di, io__state::uo) is det.
-
 :- pred globals__io_get_prolog_dialect(prolog_dialect::out,
 	io__state::di, io__state::uo) is det.
 
@@ -190,9 +176,6 @@
 convert_args_method("simple", simple).
 convert_args_method("compact", compact).
 
-convert_type_info_method("shared-one-or-two-cell", shared_one_or_two_cell).
-convert_type_info_method("default", shared_one_or_two_cell).
-
 convert_prolog_dialect("default", default).
 convert_prolog_dialect("nu", nu).
 convert_prolog_dialect("NU", nu).
@@ -220,41 +203,36 @@
 			gc_method,
 			tags_method,
 			args_method,
-			type_info_method,
 			prolog_dialect,
 			termination_norm
 		).
 
 globals__init(Options, GC_Method, TagsMethod, ArgsMethod,
-		TypeInfoMethod, PrologDialect, TerminationNorm, 
+		PrologDialect, TerminationNorm, 
 	globals(Options, GC_Method, TagsMethod, ArgsMethod,
-		TypeInfoMethod, PrologDialect, TerminationNorm)).
+		PrologDialect, TerminationNorm)).
 
-globals__get_options(globals(Options, _, _, _, _, _, _), Options).
-globals__get_gc_method(globals(_, GC_Method, _, _, _, _, _), GC_Method).
-globals__get_tags_method(globals(_, _, TagsMethod, _, _, _, _), TagsMethod).
-globals__get_args_method(globals(_, _, _, ArgsMethod, _, _, _), ArgsMethod).
-globals__get_type_info_method(globals(_, _, _, _, TypeInfoMethod, _, _),
-	TypeInfoMethod).
-globals__get_prolog_dialect(globals(_, _, _, _, _, PrologDialect, _),
+globals__get_options(globals(Options, _, _, _, _, _), Options).
+globals__get_gc_method(globals(_, GC_Method, _, _, _, _), GC_Method).
+globals__get_tags_method(globals(_, _, TagsMethod, _, _, _), TagsMethod).
+globals__get_args_method(globals(_, _, _, ArgsMethod, _, _), ArgsMethod).
+globals__get_prolog_dialect(globals(_, _, _, _, PrologDialect, _),
 	PrologDialect).
-globals__get_termination_norm(globals(_, _, _, _, _, _, TerminationNorm),
+globals__get_termination_norm(globals(_, _, _, _, _, TerminationNorm),
 	TerminationNorm).
 
-globals__set_options(globals(_, B, C, D, E, F, G), Options,
-	globals(Options, B, C, D, E, F, G)).
-globals__set_gc_method(globals(A, _, C, D, E, F, G), GC_Method,
-	globals(A, GC_Method, C, D, E, F, G)).
-globals__set_tags_method(globals(A, B, _, D, E, F, G), TagsMethod,
-	globals(A, B, TagsMethod, D, E, F, G)).
-globals__set_args_method(globals(A, B, C, _, E, F, G), ArgsMethod,
-	globals(A, B, C, ArgsMethod, E, F, G)).
-globals__set_type_info_method(globals(A, B, C, D, _, F, G), TypeInfoMethod,
-	globals(A, B, C, D, TypeInfoMethod, F, G)).
-globals__set_prolog_dialect(globals(A, B, C, D, E, _, G), PrologDialect,
-	globals(A, B, C, D, E, PrologDialect, G)).
-globals__set_termination_norm(globals(A, B, C, D, E, F, _), TerminationNorm,
-	globals(A, B, C, D, E, F, TerminationNorm)).
+globals__set_options(globals(_, B, C, D, E, F), Options,
+	globals(Options, B, C, D, E, F)).
+globals__set_gc_method(globals(A, _, C, D, E, F), GC_Method,
+	globals(A, GC_Method, C, D, E, F)).
+globals__set_tags_method(globals(A, B, _, D, E, F), TagsMethod,
+	globals(A, B, TagsMethod, D, E, F)).
+globals__set_args_method(globals(A, B, C, _, E, F), ArgsMethod,
+	globals(A, B, C, ArgsMethod, E, F)).
+globals__set_prolog_dialect(globals(A, B, C, D, _, F), PrologDialect,
+	globals(A, B, C, D, PrologDialect, F)).
+globals__set_termination_norm(globals(A, B, C, D, E, _), TerminationNorm,
+	globals(A, B, C, D, E, TerminationNorm)).
 
 globals__lookup_option(Globals, Option, OptionData) :-
 	globals__get_options(Globals, OptionTable),
@@ -313,15 +291,14 @@
 %-----------------------------------------------------------------------------%
 
 globals__io_init(Options, GC_Method, TagsMethod, ArgsMethod,
-		TypeInfoMethod, PrologDialect, TerminationNorm) -->
+		PrologDialect, TerminationNorm) -->
 	{ copy(GC_Method, GC_Method1) },
 	{ copy(TagsMethod, TagsMethod1) },
 	{ copy(ArgsMethod, ArgsMethod1) },
-	{ copy(TypeInfoMethod, TypeInfoMethod1) },
 	{ copy(PrologDialect, PrologDialect1) },
 	{ copy(TerminationNorm, TerminationNorm1) },
 	{ globals__init(Options, GC_Method1, TagsMethod1, ArgsMethod1,
-		TypeInfoMethod1, PrologDialect1, TerminationNorm1, Globals) },
+		PrologDialect1, TerminationNorm1, Globals) },
 	globals__io_set_globals(Globals).
 
 globals__io_get_gc_method(GC_Method) -->
@@ -335,10 +312,6 @@
 globals__io_get_args_method(ArgsMethod) -->
 	globals__io_get_globals(Globals),
 	{ globals__get_args_method(Globals, ArgsMethod) }.
-
-globals__io_get_type_info_method(TypeInfoMethod) -->
-	globals__io_get_globals(Globals),
-	{ globals__get_type_info_method(Globals, TypeInfoMethod) }.
 
 globals__io_get_prolog_dialect(PrologDIalect) -->
 	globals__io_get_globals(Globals),
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.39
diff -u -r1.39 handle_options.m
--- handle_options.m	1998/01/07 05:39:51	1.39
+++ handle_options.m	1998/01/20 12:44:54
@@ -125,13 +125,6 @@
                         { ArgsMethod0 = string(ArgsMethodStr) },
                         { convert_args_method(ArgsMethodStr, ArgsMethod) }
                     ->
-                        { map__lookup(OptionTable, type_info,
-                            TypeInfoMethod0) },
-                        (
-                            { TypeInfoMethod0 = string(TypeInfoMethodStr) },
-                            { convert_type_info_method(TypeInfoMethodStr,
-                                TypeInfoMethod) }
-                        ->
                             { map__lookup(OptionTable, prolog_dialect,
                                 PrologDialect0) },
                             (
@@ -156,8 +149,7 @@
 				    ->
 				    	postprocess_options_2(OptionTable,
 				    	    GC_Method, TagsMethod, ArgsMethod,
-				    	    TypeInfoMethod, PrologDialect,
-					    TermNorm),
+				    	    PrologDialect, TermNorm),
 				        { Error = no }
 				    ;
 				    	{ Error = yes("Invalid argument to option `--termination-norm'\n\t(must be `simple', `total' or  `num-data-elems').") }
@@ -168,9 +160,6 @@
                             ;
                                 { Error = yes("Invalid prolog-dialect option (must be `sicstus', `nu', or `default')") }
                             )
-                        ;
-                            { Error = yes("Invalid type-info option (must be `shared-one-or-two-cell' or `default')") }
-                        )
                     ;
                         { Error = yes("Invalid args option (must be `simple' or `compact')") }
                     )
@@ -182,12 +171,12 @@
             ).
 
 :- pred postprocess_options_2(option_table, gc_method, tags_method, 
-	args_method, type_info_method, prolog_dialect, termination_norm,
+	args_method, prolog_dialect, termination_norm,
 	io__state, io__state).
-:- mode postprocess_options_2(in, in, in, in, in, in, in, di, uo) is det.
+:- mode postprocess_options_2(in, in, in, in, in, in, di, uo) is det.
 
 postprocess_options_2(OptionTable, GC_Method, TagsMethod, ArgsMethod,
-		TypeInfoMethod, PrologDialect, TermNorm) -->
+		PrologDialect, TermNorm) -->
 	% work around for NU-Prolog problems
 	( { map__search(OptionTable, heap_space, int(HeapSpace)) }
 	->
@@ -198,7 +187,7 @@
 
 	{ unsafe_promise_unique(OptionTable, OptionTable1) }, % XXX
 	globals__io_init(OptionTable1, GC_Method, TagsMethod, ArgsMethod,
-		TypeInfoMethod, PrologDialect, TermNorm),
+		PrologDialect, TermNorm),
 
 	% --gc conservative implies --no-reclaim-heap-*
 	( { GC_Method = conservative } ->
Index: compiler/options.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.218
diff -u -r1.218 options.m
--- options.m	1998/01/06 23:51:01	1.218
+++ options.m	1998/01/20 11:55:55
@@ -138,7 +138,6 @@
 				% `--tags high' and doesn't specify
 				% `--num-tag-bits'.
 		;	args
-		;	type_info
 		;	type_layout
 				% XXX stack_layout is a development only 
 				% option. It will eventually be replaced
@@ -398,7 +397,6 @@
 					% above default with a value determined
 					% at configuration time
 	args			-	string("compact"),
-	type_info		-	string("default"),
 	type_layout		-	bool(yes),
 	stack_layout		-	bool(no),
 	highlevel_c		-	bool(no),
@@ -692,8 +690,6 @@
 long_option("conf-low-tag-bits",	conf_low_tag_bits).
 long_option("args",			args).
 long_option("arg-convention",		args).
-long_option("type-info",		type_info).
-long_option("type-info-convention",	type_info).
 long_option("type-layout",		type_layout).
 long_option("stack-layout",		type_layout).
 long_option("highlevel-C",		highlevel_c).
@@ -1471,16 +1467,6 @@
 	io__write_string("\t\tregister r<n>. The compact convention generally leads to\n"),
 	io__write_string("\t\tmore efficient code. Use of the simple convention requires the\n"),
 	io__write_string("\t\tC code to be compiled with -UCOMPACT_ARGS.\n"),
-
-		% Until other type-info options are added, we don't
-		% really need this option.
-%	io__write_string("\t--type-info {default, shared-one-or-two-cell}\n"),
-%	io__write_string("\t--type-info-convention {default, shared-one-or-two-cell}\n"),
-%	io__write_string("\t(This option is not for general use.)\n"),
-%	io__write_string("\t\tUse the specified format for the automatically generated\n"),
-%	io__write_string("\t\ttype_info structures. Only one option, shared-one-or-two-cell,\n"),
-%	io__write_string("\t\tis presently available.\n"),
-
 
 	io__write_string("\t--no-type-layout\n"),
 	io__write_string("\t(This option is not for general use.)\n"),
Index: compiler/polymorphism.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/polymorphism.m,v
retrieving revision 1.122
diff -u -r1.122 polymorphism.m
--- polymorphism.m	1998/01/13 10:13:18	1.122
+++ polymorphism.m	1998/01/20 12:48:09
@@ -46,7 +46,7 @@
 %			"map" for `map(K,V)'
 %	word 7		<string name of module>
 %
-% The other cell is the new type_info structure, laid out like this:
+% The other cell is the type_info structure, laid out like this:
 %
 %	word 0		<pointer to the base_type_info structure>
 %	word 1+		<the type_infos for the type params, at least one>
@@ -55,7 +55,7 @@
 %
 %-----------------------------------------------------------------------------%
 %
-% Optimization of common case for one-or-two cells:
+% Optimization of common case (zero arity types):
 %
 % The type_info structure itself is redundant if the type has no type
 % parameters (i.e. its arity is zero). Therefore if the arity is zero,
@@ -81,25 +81,20 @@
 %
 %-----------------------------------------------------------------------------%
 %
-% Sharing one-or-two-cell structures:
+% Sharing base_type_info structures:
 %
 % For compilation models that can put code addresses in static ground terms,
 % we can arrange to create one copy of the base_type_info structure statically,
 % avoiding the need to create other copies at runtime. For compilation models
-% that cannot put code addresses in static ground terms, we have several
-% options:
+% that cannot put code addresses in static ground terms, there are a couple
+% of things we could do:
 %
-% 	1. use a one or two cell representation, but allocate all cells 
-% 	   at runtime.
-%	2. use another representation, allocating all cells at
-%	   runtime.
-%	3. use a shared static base_type_info, but initialize its code
+% 	1. allocate all cells at runtime.
+%	2. use a shared static base_type_info, but initialize its code
 %	   addresses during startup (that is, during the module
 %	   initialization code).
 %
-% Presently, shared-one-or-two cells are the default, with grades that
-% cannot use static code addresses using option 3.  Support for older
-% type_info representations has been dropped. 
+% Currently we use option 2.
 %
 %-----------------------------------------------------------------------------%
 %
@@ -295,7 +290,7 @@
 
 :- implementation.
 
-:- import_module hlds_pred, hlds_goal, hlds_data, llds, (lambda), globals.
+:- import_module hlds_pred, hlds_goal, hlds_data, llds, (lambda).
 :- import_module prog_data, type_util, mode_util, quantification, instmap.
 :- import_module code_util, unify_proc, special_pred, prog_util, make_hlds.
 :- import_module (inst), hlds_out, base_typeclass_info.
@@ -1570,19 +1565,13 @@
 
 	Info1 = poly_info(VarSet1, VarTypes1, C, D, E, F, G, ModuleInfo),
 
-	module_info_globals(ModuleInfo, Globals),
-	globals__get_type_info_method(Globals, TypeInfoMethod),
-	(
-		TypeInfoMethod = shared_one_or_two_cell,
-
-		polymorphism__init_const_base_type_info_var(Type,
-			TypeId, ModuleInfo, VarSet1, VarTypes1, 
-			BaseVar, BaseGoal, VarSet2, VarTypes2),
-		polymorphism__maybe_init_second_cell(ArgTypeInfoVars,
-			ArgTypeInfoGoals, Type, IsHigherOrder,
-			BaseVar, VarSet2, VarTypes2, [BaseGoal],
-			Var, VarSet, VarTypes, ExtraGoals)
-	),
+	polymorphism__init_const_base_type_info_var(Type,
+		TypeId, ModuleInfo, VarSet1, VarTypes1, 
+		BaseVar, BaseGoal, VarSet2, VarTypes2),
+	polymorphism__maybe_init_second_cell(ArgTypeInfoVars,
+		ArgTypeInfoGoals, Type, IsHigherOrder,
+		BaseVar, VarSet2, VarTypes2, [BaseGoal],
+		Var, VarSet, VarTypes, ExtraGoals),
 
 	Info = poly_info(VarSet, VarTypes, C, D, E, F, G, ModuleInfo).
 
Index: runtime/mercury_type_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.h,v
retrieving revision 1.3
diff -u -r1.3 mercury_type_info.h
--- mercury_type_info.h	1997/12/19 03:10:47	1.3
+++ mercury_type_info.h	1998/01/20 14:12:48
@@ -20,17 +20,6 @@
 /*---------------------------------------------------------------------------*/
 
 /*
-** Decide which type_info representation we will use.
-**
-** At present, only SHARED_ONE_OR_TWO_CELL_TYPE_INFO is available.
-**
-*/
-
-#define		SHARED_ONE_OR_TWO_CELL_TYPE_INFO
-
-/*---------------------------------------------------------------------------*/
-
-/*
 ** Define offsets of fields in the base_type_info or type_info structure.
 ** See polymorphism.m for explanation of these offsets and how the
 ** type_info and base_type_info structures are laid out.
@@ -38,8 +27,7 @@
 ** ANY CHANGES HERE MUST BE MATCHED BY CORRESPONDING CHANGES
 ** TO THE DOCUMENTATION IN compiler/polymorphism.m.
 **
-** The one_or_two_cell type_info representation
-** *depends* on OFFSET_FOR_COUNT being 0.
+** The current type_info representation *depends* on OFFSET_FOR_COUNT being 0.
 */
 
 #define OFFSET_FOR_COUNT 0
@@ -59,11 +47,9 @@
 
 /*
 ** Where the predicate arity and args are stored in the type_info.
-** For one-or-two-cell, they are stored in the type_info (*not* the
-** base_type_info).
+** They are stored in the type_info (*not* the base_type_info).
 ** This is brought about by higher-order predicates all using the
 ** same base_type_info - pred/0.
-** For one-cell, the arity is at the same offset as the count.
 */
 
 #define TYPEINFO_OFFSET_FOR_PRED_ARITY 1
@@ -142,13 +128,10 @@
 **
 ** All code using type_layout structures should check to see if
 ** USE_TYPE_LAYOUT is defined, and give a fatal error otherwise.
-** For USE_TYPE_LAYOUT to be defined, we need to be using
-** shared one-or-two cell type_infos (since the type_layouts refer
-** to base_type_layouts). USE_TYPE_LAYOUT can be explicitly turned
-** off with NO_TYPE_LAYOUT.
+** USE_TYPE_LAYOUT can be explicitly turned off with NO_TYPE_LAYOUT.
 **
 */
-#if defined(SHARED_ONE_OR_TWO_CELL_TYPE_INFO) && !defined(NO_TYPE_LAYOUT)
+#if !defined(NO_TYPE_LAYOUT)
 	#define USE_TYPE_LAYOUT
 #else
 	#undef USE_TYPE_LAYOUT
@@ -770,7 +753,6 @@
 
 #endif
 
-/*---------------------------------------------------------------------------*/
 
 /*
 ** definitions for accessing the representation of the
-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list