[m-dev.] for review: arg names for compiler-generated procedures

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Sep 29 16:31:20 AEST 1999


By anyone.

compiler/unify_proc.m:
	Give the usual names to the variables representing the args of
	compiler-generated procedures. If they remain unnamed, then
	execution tracing will ignore them, which means that one cannot
	print out the values of the arguments of compiler-generated procedures.

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/unify_proc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/unify_proc.m,v
retrieving revision 1.77
diff -u -b -r1.77 unify_proc.m
--- unify_proc.m	1999/06/30 17:12:45	1.77
+++ unify_proc.m	1999/09/29 06:09:55
@@ -469,8 +469,8 @@
 	special_pred_info(SpecialPredId, HeadVarType,
 		_PredName, ArgTypes, _Modes, _Det),
 	unify_proc__info_init(ModuleInfo, VarTypeInfo0),
-	unify_proc__make_fresh_vars_from_types(ArgTypes, Args,
-				VarTypeInfo0, VarTypeInfo1),
+	unify_proc__make_fresh_named_vars_from_types(ArgTypes, "HeadVar__", 1,
+		Args, VarTypeInfo0, VarTypeInfo1),
 	( SpecialPredsOpt = yes ->
 		( SpecialPredId = unify, Args = [H1, H2] ->
 			unify_proc__generate_unify_clauses(TypeBody, H1, H2,
@@ -1056,6 +1056,20 @@
 
 %-----------------------------------------------------------------------------%
 
+:- pred unify_proc__make_fresh_named_vars_from_types(list(type), string, int,
+	list(prog_var), unify_proc_info, unify_proc_info).
+:- mode unify_proc__make_fresh_named_vars_from_types(in, in, in, out, in, out)
+	is det.
+
+unify_proc__make_fresh_named_vars_from_types([], _, _, []) --> [].
+unify_proc__make_fresh_named_vars_from_types([Type | Types], BaseName, Num,
+		[Var | Vars]) -->
+	{ string__int_to_string(Num, NumStr) },
+	{ string__append(BaseName, NumStr, Name) },
+	unify_proc__info_new_named_var(Type, Name, Var),
+	unify_proc__make_fresh_named_vars_from_types(Types, BaseName, Num + 1,
+		Vars).
+
 :- pred unify_proc__make_fresh_vars_from_types(list(type), list(prog_var),
 			unify_proc_info, unify_proc_info).
 :- mode unify_proc__make_fresh_vars_from_types(in, out, in, out) is det.
@@ -1149,6 +1163,10 @@
 		unify_proc_info, unify_proc_info).
 :- mode unify_proc__info_new_var(in, out, in, out) is det.
 
+:- pred unify_proc__info_new_named_var(type, string, prog_var,
+		unify_proc_info, unify_proc_info).
+:- mode unify_proc__info_new_named_var(in, in, out, in, out) is det.
+
 :- pred unify_proc__info_extract(unify_proc_info, prog_varset,
 		map(prog_var, type)).
 :- mode unify_proc__info_extract(in, out, out) is det.
@@ -1193,6 +1211,12 @@
 		unify_proc_info(VarSet0, Types0, ModuleInfo),
 		unify_proc_info(VarSet, Types, ModuleInfo)) :-
 	varset__new_var(VarSet0, Var, VarSet),
+	map__det_insert(Types0, Var, Type, Types).
+
+unify_proc__info_new_named_var(Type, Name, Var,
+		unify_proc_info(VarSet0, Types0, ModuleInfo),
+		unify_proc_info(VarSet, Types, ModuleInfo)) :-
+	varset__new_named_var(VarSet0, Name, Var, VarSet),
 	map__det_insert(Types0, Var, Type, Types).
 
 unify_proc__info_extract(unify_proc_info(VarSet, Types, _ModuleInfo),
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/dynamic_linking
cvs diff: Diffing extras/exceptions
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/odbc
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 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