[m-rev.] diff: delete obsolete cons_id

Zoltan Somogyi zs at cs.mu.OZ.AU
Fri Jun 20 21:13:57 AEST 2003


compiler/hlds_data.m:
	Delete the const_addr cons_id and the code_addr_constant tag value,
	since they have not been needed for a long time. The HLDS hasn't
	needed to handle raw code addresses since we stopped generating
	type_ctor_infos dynamically, and made them static data structures.

	The code address representations in the MLDS, LLDS and bytecode
	backends are still needed in the implementation of closures.

compiler/bytecode.m:
	Delete the code_addr_const (the equivalent of the code_addr_constant
	tag value) in the bytecode representation, since it was used only
	to implement code_addr cons_ids; closures use pred_consts instead.

compiler/*.m:
	Delete the code that dealt with the deleted function symbols as inputs
	(which in several cases threw exceptions anyway).

Zoltan.

cvs diff: Diffing .
Index: bytecode.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/bytecode.m,v
retrieving revision 1.52
diff -u -b -r1.52 bytecode.m
--- bytecode.m	15 Mar 2003 03:08:42 -0000	1.52
+++ bytecode.m	19 Jun 2003 13:03:20 -0000
@@ -89,8 +89,6 @@
 			;	float_const(float)
 			;	pred_const(byte_module_id, byte_pred_id,
 					arity, byte_is_func, byte_proc_id)
-			;	code_addr_const(byte_module_id, byte_pred_id,
-					arity, byte_proc_id)
 			;	type_ctor_info_const(byte_module_id, string,
 					int)
 			;	base_typeclass_info_const(byte_module_id,
@@ -784,12 +782,6 @@
 	output_length(Arity),
 	output_is_func(IsFunc),
 	output_proc_id(ProcId).
-output_cons_id(code_addr_const(ModuleId, PredId, Arity, ProcId)) -->
-	output_byte(5),
-	output_module_id(ModuleId),
-	output_pred_id(PredId),
-	output_length(Arity),
-	output_proc_id(ProcId).
 output_cons_id(type_ctor_info_const(ModuleId, TypeName, TypeArity)) -->
 	output_byte(6),
 	output_module_id(ModuleId),
@@ -829,12 +821,6 @@
 	debug_pred_id(PredId),
 	debug_length(Arity),
 	debug_is_func(IsFunc),
-	debug_proc_id(ProcId).
-debug_cons_id(code_addr_const(ModuleId, PredId, Arity, ProcId)) -->
-	debug_string("code_addr_const"),
-	debug_module_id(ModuleId),
-	debug_pred_id(PredId),
-	debug_length(Arity),
 	debug_proc_id(ProcId).
 debug_cons_id(type_ctor_info_const(ModuleId, TypeName, TypeArity)) -->
 	debug_string("type_ctor_info_const"),
Index: bytecode_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/bytecode_gen.m,v
retrieving revision 1.73
diff -u -b -r1.73 bytecode_gen.m
--- bytecode_gen.m	26 May 2003 08:59:49 -0000	1.73
+++ bytecode_gen.m	20 Jun 2003 10:31:22 -0000
@@ -737,12 +737,6 @@
 			sorry(this_file, "bytecode for Aditi lambda expressions")
 		)
 	;
-		ConsId = code_addr_const(PredId, ProcId),
-		predicate_id(ModuleInfo, PredId, ModuleName, PredName, Arity),
-		proc_id_to_int(ProcId, ProcInt),
-		ByteConsId = code_addr_const(ModuleName, PredName, Arity,
-			ProcInt)
-	;
 		ConsId = type_ctor_info_const(ModuleName, TypeName, TypeArity),
 		ByteConsId = type_ctor_info_const(ModuleName, TypeName,
 			TypeArity)
@@ -780,8 +774,6 @@
 	unexpected(this_file, "float_constant cons tag for non-float_constant cons id").
 bytecode_gen__map_cons_tag(pred_closure_tag(_, _, _), _) :-
 	unexpected(this_file, "pred_closure_tag cons tag for non-pred_const cons id").
-bytecode_gen__map_cons_tag(code_addr_constant(_, _), _) :-
-	unexpected(this_file, "code_addr_constant cons tag for non-address_const cons id").
 bytecode_gen__map_cons_tag(type_ctor_info_constant(_, _, _), _) :-
 	unexpected(this_file, "type_ctor_info_constant cons tag for non-type_ctor_info_constant cons id").
 bytecode_gen__map_cons_tag(base_typeclass_info_constant(_, _, _), _) :-
Index: dead_proc_elim.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dead_proc_elim.m,v
retrieving revision 1.80
diff -u -b -r1.80 dead_proc_elim.m
--- dead_proc_elim.m	26 May 2003 08:59:52 -0000	1.80
+++ dead_proc_elim.m	19 Jun 2003 12:58:16 -0000
@@ -498,9 +498,6 @@
 			ConsId = pred_const(PredId, ProcId, _),
 			Entity = proc(PredId, ProcId)
 		;
-			ConsId = code_addr_const(PredId, ProcId),
-			Entity = proc(PredId, ProcId)
-		;
 			ConsId = type_ctor_info_const(Module, TypeName, Arity),
 			Entity = base_gen_info(Module, TypeName, Arity)
 		)
Index: dependency_graph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/dependency_graph.m,v
retrieving revision 1.61
diff -u -b -r1.61 dependency_graph.m
--- dependency_graph.m	1 Jun 2003 10:04:39 -0000	1.61
+++ dependency_graph.m	19 Jun 2003 12:58:16 -0000
@@ -505,19 +505,6 @@
 	;
 		true
 	).
-dependency_graph__add_arcs_in_cons(code_addr_const(Pred, Proc), Caller,
-		!DepGraph) :-
-	(
-			% If the node isn't in the relation, then
-			% we didn't insert it because is was imported,
-			% and we don't consider it.
-		relation__search_element(!.DepGraph,
-			dependency_node(proc(Pred, Proc)), Callee)
-	->
-		relation__add(!.DepGraph, Caller, Callee, !:DepGraph)
-	;
-		true
-	).
 dependency_graph__add_arcs_in_cons(type_ctor_info_const(_, _, _),
 		_Caller, !DepGraph).
 dependency_graph__add_arcs_in_cons(base_typeclass_info_const(_, _, _, _),
Index: hlds_code_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_code_util.m,v
retrieving revision 1.5
diff -u -b -r1.5 hlds_code_util.m
--- hlds_code_util.m	5 Jun 2003 04:16:20 -0000	1.5
+++ hlds_code_util.m	19 Jun 2003 12:58:16 -0000
@@ -50,7 +50,6 @@
 cons_id_to_tag(int_const(X), _, _) = int_constant(X).
 cons_id_to_tag(float_const(X), _, _) = float_constant(X).
 cons_id_to_tag(string_const(X), _, _) = string_constant(X).
-cons_id_to_tag(code_addr_const(P,M), _, _) = code_addr_constant(P,M).
 cons_id_to_tag(pred_const(P,M,E), _, _) = pred_closure_tag(P,M,E).
 cons_id_to_tag(type_ctor_info_const(M,T,A), _, _) =
 		type_ctor_info_constant(M,T,A).
Index: hlds_data.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_data.m,v
retrieving revision 1.76
diff -u -b -r1.76 hlds_data.m
--- hlds_data.m	8 May 2003 03:39:53 -0000	1.76
+++ hlds_data.m	20 Jun 2003 10:30:39 -0000
@@ -37,17 +37,12 @@
 	;	int_const(int)
 	;	string_const(string)
 	;	float_const(float)
-	;	pred_const(pred_id, proc_id,
-			lambda_eval_method)
-	;	code_addr_const(pred_id, proc_id)
-		% No longer used. code_addr_const cons_ids
-		% were once used to construct type_infos.
-		% Note that a pred_const is for a closure
-		% whereas a code_addr_const is just an address.
+	;	pred_const(pred_id, proc_id, lambda_eval_method)
+		% Note that a pred_const represents a closure,
+		% not just a code address.
 	;	type_ctor_info_const(module_name, string, int)
 		% module name, type name, type arity
-	;	base_typeclass_info_const(module_name,
-			class_id, int, string)
+	;	base_typeclass_info_const(module_name, class_id, int, string)
 		% module name of instance declaration
 		% (not filled in so that link errors result
 		% from overlapping instances),
@@ -132,14 +127,13 @@
 	% Various predicates for accessing the cons_id type.
 
 	% Given a cons_id and a list of argument terms, convert it into a
-	% term. Fails if the cons_id is a pred_const, code_addr_const or
-	% type_ctor_info_const.
+	% term. Fails if the cons_id is a pred_const, or type_ctor_info_const.
 
 :- pred cons_id_and_args_to_term(cons_id, list(term(T)), term(T)).
 :- mode cons_id_and_args_to_term(in, in, out) is semidet.
 
-	% Get the arity of a cons_id, aborting on pred_const, code_addr_const
-	% and type_ctor_info_const.
+	% Get the arity of a cons_id, aborting on pred_const and
+	% type_ctor_info_const.
 
 :- pred cons_id_arity(cons_id, arity).
 :- mode cons_id_arity(in, out) is det.
@@ -201,8 +195,6 @@
 cons_id_arity(float_const(_), 0).
 cons_id_arity(pred_const(_, _, _), _) :-
 	error("cons_id_arity: can't get arity of pred_const").
-cons_id_arity(code_addr_const(_, _), _) :-
-	error("cons_id_arity: can't get arity of code_addr_const").
 cons_id_arity(type_ctor_info_const(_, _, _), _) :-
 	error("cons_id_arity: can't get arity of type_ctor_info_const").
 cons_id_arity(base_typeclass_info_const(_, _, _, _), _) :-
@@ -219,7 +211,6 @@
 cons_id_maybe_arity(string_const(_), yes(0)).
 cons_id_maybe_arity(float_const(_), yes(0)).
 cons_id_maybe_arity(pred_const(_, _, _), no) .
-cons_id_maybe_arity(code_addr_const(_, _), no).
 cons_id_maybe_arity(type_ctor_info_const(_, _, _), no) .
 cons_id_maybe_arity(base_typeclass_info_const(_, _, _, _), no).
 cons_id_maybe_arity(tabling_pointer_const(_, _), no).
@@ -382,11 +373,6 @@
 			% hold the number of args and the address of
 			% the procedure respectively.
 			% The remaining words hold the arguments.
-	;	code_addr_constant(pred_id, proc_id)
-			% Procedure address constants
-			% (used for constructing type_infos).
-			% The word just contains the address of the
-			% specified procedure.
 	;	type_ctor_info_constant(module_name, string, arity)
 			% This is how we refer to type_ctor_info structures
 			% represented as global data. The args are
@@ -512,7 +498,6 @@
 get_primary_tag(float_constant(_)) = no.
 get_primary_tag(int_constant(_)) = no.
 get_primary_tag(pred_closure_tag(_, _, _)) = no.
-get_primary_tag(code_addr_constant(_, _)) = no.
 get_primary_tag(type_ctor_info_constant(_, _, _)) = no.
 get_primary_tag(base_typeclass_info_constant(_, _, _)) = no.
 get_primary_tag(tabling_pointer_constant(_, _)) = no.
@@ -532,7 +517,6 @@
 get_secondary_tag(float_constant(_)) = no.
 get_secondary_tag(int_constant(_)) = no.
 get_secondary_tag(pred_closure_tag(_, _, _)) = no.
-get_secondary_tag(code_addr_constant(_, _)) = no.
 get_secondary_tag(type_ctor_info_constant(_, _, _)) = no.
 get_secondary_tag(base_typeclass_info_constant(_, _, _)) = no.
 get_secondary_tag(tabling_pointer_constant(_, _)) = no.
Index: hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.311
diff -u -b -r1.311 hlds_out.m
--- hlds_out.m	13 Jun 2003 10:38:26 -0000	1.311
+++ hlds_out.m	19 Jun 2003 12:58:16 -0000
@@ -328,7 +328,6 @@
 
 hlds_out__cons_id_to_string(float_const(_), "<float>").
 hlds_out__cons_id_to_string(pred_const(_, _, _), "<pred>").
-hlds_out__cons_id_to_string(code_addr_const(_, _), "<code_addr>").
 hlds_out__cons_id_to_string(type_ctor_info_const(_, _, _), "<type_ctor_info>").
 hlds_out__cons_id_to_string(base_typeclass_info_const(_, _, _, _),
 	"<base_typeclass_info>").
@@ -348,8 +347,6 @@
 	io__write_float(Float).
 hlds_out__write_cons_id(pred_const(_PredId, _ProcId, _)) -->
 	io__write_string("<pred>").
-hlds_out__write_cons_id(code_addr_const(_PredId, _ProcId)) -->
-	io__write_string("<code_addr>").
 hlds_out__write_cons_id(type_ctor_info_const(_, _, _)) -->
 	io__write_string("<type_ctor_info>").
 hlds_out__write_cons_id(base_typeclass_info_const(_, _, _, _)) -->
@@ -2461,11 +2458,6 @@
 			cons(qualified(PredModule, PredName),
 				list__length(ArgVars)),
 			ArgVars, VarSet, ModuleInfo, AppendVarnums)
-	;
-		{ ConsId = code_addr_const(PredId, ProcId) },
-		io__write_string("code_addr_const("),
-		hlds_out__write_pred_proc_id(ModuleInfo, PredId, ProcId),
-		io__write_string(")")
 	;
 		{ ConsId = type_ctor_info_const(Module, Name, Arity) },
 		io__write_string("type_ctor_info("""),
Index: mercury_to_mercury.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mercury_to_mercury.m,v
retrieving revision 1.229
diff -u -b -r1.229 mercury_to_mercury.m
--- mercury_to_mercury.m	26 May 2003 09:00:00 -0000	1.229
+++ mercury_to_mercury.m	19 Jun 2003 12:58:17 -0000
@@ -1581,17 +1581,6 @@
 	add_string(", "),
 	add_lambda_eval_method(EvalMethod),
 	add_string(")>").
-mercury_format_cons_id(code_addr_const(PredId, ProcId), _) -->
-	% XXX Sufficient, but probably should print this out in
-	%     name/arity form.
-
-	{ pred_id_to_int(PredId, PredInt) },
-	{ proc_id_to_int(ProcId, ProcInt) },
-	add_string("<code_addr_const("),
-	add_int(PredInt),
-	add_string(", "),
-	add_int(ProcInt),
-	add_string(")>").
 mercury_format_cons_id(type_ctor_info_const(Module, Type, Arity), _) -->
 	{ prog_out__sym_name_to_string(Module, ModuleString) },
 	{ string__int_to_string(Arity, ArityString) },
Index: ml_unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/ml_unify_gen.m,v
retrieving revision 1.65
diff -u -b -r1.65 ml_unify_gen.m
--- ml_unify_gen.m	9 May 2003 00:45:05 -0000	1.65
+++ ml_unify_gen.m	20 Jun 2003 10:31:16 -0000
@@ -449,9 +449,6 @@
 ml_gen_constant(table_io_decl_tag(_), _, _) -->
 	{ error("ml_gen_constant: table_io_decl_tag not yet supported") }.
 
-ml_gen_constant(code_addr_constant(PredId, ProcId), _, ProcAddrRval) -->
-	ml_gen_proc_addr_rval(PredId, ProcId, ProcAddrRval).
-
 ml_gen_constant(reserved_address(ReservedAddr), VarType, Rval) -->
 	=(Info),
 	{ ml_gen_info_get_module_info(Info, ModuleInfo) },
@@ -1329,9 +1326,6 @@
 		{ Tag = pred_closure_tag(_, _, _) },
 		{ MLDS_Statements = [] }
 	;
-		{ Tag = code_addr_constant(_, _) },
-		{ MLDS_Statements = [] }
-	;
 		{ Tag = type_ctor_info_constant(_, _, _) },
 		{ MLDS_Statements = [] }
 	;
@@ -1444,9 +1438,6 @@
 		Tag = pred_closure_tag(_, _, _),
 		error("ml_tag_offset_and_argnum")
 	;
-		Tag = code_addr_constant(_, _),
-		error("ml_tag_offset_and_argnum")
-	;
 		Tag = type_ctor_info_constant(_, _, _),
 		error("ml_tag_offset_and_argnum")
 	;
@@ -1778,9 +1769,6 @@
 	% This should never happen, since the error will be detected
 	% during mode checking.
 	error("Attempted higher-order unification").
-ml_gen_tag_test_rval(code_addr_constant(_, _), _, _, _Rval) = _TestRval :-
-	% This should never happen
-	error("Attempted code_addr unification").
 ml_gen_tag_test_rval(type_ctor_info_constant(_, _, _), _, _, _) = _ :-
 	% This should never happen
 	error("Attempted type_ctor_info unification").
Index: prog_rep.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_rep.m,v
retrieving revision 1.18
diff -u -b -r1.18 prog_rep.m
--- prog_rep.m	30 May 2003 07:41:21 -0000	1.18
+++ prog_rep.m	19 Jun 2003 12:58:17 -0000
@@ -101,8 +101,6 @@
 	string__append_list(["""", String, """"], Rep).
 prog_rep__represent_cons_id(pred_const(_, _, _), Rep) :-
 	Rep = "$pred_const".
-prog_rep__represent_cons_id(code_addr_const(_, _), Rep) :-
-	Rep = "$code_addr_const".
 prog_rep__represent_cons_id(type_ctor_info_const(_, _, _), Rep) :-
 	Rep = "$type_ctor_info_const".
 prog_rep__represent_cons_id(base_typeclass_info_const(_, _, _, _), Rep) :-
Index: rl_exprn.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rl_exprn.m,v
retrieving revision 1.31
diff -u -b -r1.31 rl_exprn.m
--- rl_exprn.m	27 May 2003 05:57:18 -0000	1.31
+++ rl_exprn.m	19 Jun 2003 12:58:17 -0000
@@ -507,9 +507,6 @@
 	}.
 rl_exprn__set_term_arg_cons_id_code(pred_const(_, _, _), _, _, _, _, _, _) -->
 	{ error("rl_exprn__set_term_arg_cons_id_code") }.
-rl_exprn__set_term_arg_cons_id_code(code_addr_const(_, _),
-		_, _, _, _, _, _) -->
-	{ error("rl_exprn__set_term_arg_cons_id_code") }.
 rl_exprn__set_term_arg_cons_id_code(type_ctor_info_const(_, _, _),
 		_, _, _, _, _, _) -->
 	{ error("rl_exprn__set_term_arg_cons_id_code") }.
@@ -1153,9 +1150,6 @@
 	; 
 		{ ConsId = pred_const(_, _, _) },
 		{ error("rl_exprn__unify: unsupported cons_id - pred_const") }
-	; 
-		{ ConsId = code_addr_const(_, _) },
-		{ error("rl_exprn__unify: unsupported cons_id - code_addr_const") }
 	; 
 		{ ConsId = type_ctor_info_const(_, _, _) },
 		% XXX for now we ignore these and hope it doesn't matter.
Index: stratify.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/stratify.m,v
retrieving revision 1.29
diff -u -b -r1.29 stratify.m
--- stratify.m	15 Mar 2003 03:09:10 -0000	1.29
+++ stratify.m	19 Jun 2003 12:58:17 -0000
@@ -785,13 +785,7 @@
 		% been transformed to lambda goals. see above
 		Unification = construct(_Var2, ConsId, _, _, _, _, _)
 	->
-		(
-			(
-				ConsId = pred_const(PredId, ProcId, _)
-			;
-				ConsId = code_addr_const(PredId, ProcId)
-			)
-		->
+		( ConsId = pred_const(PredId, ProcId, _) ->
 			set__insert(HasAT0, proc(PredId, ProcId), HasAT)
 		;
 			HasAT = HasAT0
@@ -886,13 +880,7 @@
 		% been transformed to lambda goals see above
 		Unification = construct(_Var2, ConsId, _, _, _, _, _)
 	->
-		(
-			(
-				ConsId = pred_const(PredId, ProcId, _)
-			;
-				ConsId = code_addr_const(PredId, ProcId)
-			)
-		->
+		( ConsId = pred_const(PredId, ProcId, _) ->
 			Calls =  [proc(PredId, ProcId) | Calls0]
 		;
 			Calls = Calls0
Index: switch_util.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/switch_util.m,v
retrieving revision 1.12
diff -u -b -r1.12 switch_util.m
--- switch_util.m	26 May 2003 09:00:10 -0000	1.12
+++ switch_util.m	20 Jun 2003 10:32:09 -0000
@@ -294,7 +294,6 @@
 	N = N0 + list__length(RAs).
 	% The following tags should all never occur in switches.
 switch_util__switch_priority(pred_closure_tag(_, _, _), 6).
-switch_util__switch_priority(code_addr_constant(_, _), 6).
 switch_util__switch_priority(type_ctor_info_constant(_, _, _), 6).
 switch_util__switch_priority(base_typeclass_info_constant(_, _, _), 6).
 switch_util__switch_priority(tabling_pointer_constant(_, _), 6).
Index: unify_gen.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/unify_gen.m,v
retrieving revision 1.129
diff -u -b -r1.129 unify_gen.m
--- unify_gen.m	26 May 2003 09:00:12 -0000	1.129
+++ unify_gen.m	20 Jun 2003 10:31:57 -0000
@@ -255,10 +255,6 @@
 	% This should never happen, since the error will be detected
 	% during mode checking.
 	error("Attempted higher-order unification").
-unify_gen__generate_tag_test_rval_2(code_addr_constant(_, _), _Rval,
-		_TestRval) :-
-	% This should never happen
-	error("Attempted code_addr unification").
 unify_gen__generate_tag_test_rval_2(type_ctor_info_constant(_, _, _), _, _) :-
 	% This should never happen
 	error("Attempted type_ctor_info unification").
@@ -449,16 +445,6 @@
 	),
 	{ DataAddr = layout_addr(table_io_decl(RttiProcLabel)) },
 	code_info__assign_const_to_var(Var, const(data_addr_const(DataAddr))).
-unify_gen__generate_construction_2(code_addr_constant(PredId, ProcId),
-		Var, Args, _Modes, _, _, empty) -->
-	( { Args = [] } ->
-		[]
-	;
-		{ error("unify_gen: address constant has args") }
-	),
-	code_info__get_module_info(ModuleInfo),
-	code_info__make_entry_label(ModuleInfo, PredId, ProcId, no, CodeAddr),
-	code_info__assign_const_to_var(Var, const(code_addr_const(CodeAddr))).
 unify_gen__generate_construction_2(reserved_address(RA),
 		Var, Args, _Modes, _, _, empty) -->
 	( { Args = [] } ->
@@ -815,9 +801,6 @@
 		{ Code = empty }
 	;
 		{ Tag = pred_closure_tag(_, _, _) },
-		{ Code = empty }
-	;
-		{ Tag = code_addr_constant(_, _) },
 		{ Code = empty }
 	;
 		{ Tag = type_ctor_info_constant(_, _, _) },
cvs diff: Diffing notes
--------------------------------------------------------------------------
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