[m-dev.] for review: make the vartypes field of imported proc_infos useable

David Glen JEFFERY dgj at cs.mu.OZ.AU
Thu Sep 24 19:21:04 AEST 1998


On 24-Sep-1998, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> This is for DJ to review, and Vanessa to use.
> 
> Make the vartypes field of imported proc_infos useable.
> 
> compiler/hlds_pred.m:
> 	Add to proc_info_init an extra argument that specifies the types
> 	of the head variables, and use this to initialize the proc_info's
> 	vartypes field, instead of an empty map. For procedures defined
> 	in the current module, this makes no difference, since the field is
> 	set in mode checking (of all places) anyway. For imported procedures,
> 	it actually makes the vartypes field useable by e.g. the new
> 	termination analysis algorithm. Previously, for such procedures
> 	the field contained a bogus map containing only the variables
> 	introduced by polymorphism.
> 
> compiler/make_hlds.m:
> 	Supply the extra argument to proc_info_init.
>
> Index: compiler/hlds_pred.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/hlds_pred.m,v
> retrieving revision 1.52
> diff -u -u -r1.52 hlds_pred.m
> --- hlds_pred.m	1998/09/10 06:51:16	1.52
> +++ hlds_pred.m	1998/09/23 08:26:52
> @@ -932,10 +932,10 @@
>  
>  :- interface.
>  
> -:- pred proc_info_init(arity, list(mode), maybe(list(mode)),
> +:- pred proc_info_init(arity, list(type), list(mode), maybe(list(mode)),
>  	maybe(list(is_live)), maybe(determinism), term__context, 
>  	args_method, proc_info).
> -:- mode proc_info_init(in, in, in, in, in, in, in, out) is det.
> +:- mode proc_info_init(in, in, in, in, in, in, in, in, out) is det.
>  
>  :- pred proc_info_set(maybe(determinism), varset, map(var, type), list(var),
>  	list(mode), maybe(list(is_live)), hlds_goal, term__context,
> @@ -1185,17 +1185,18 @@
>  	% This is what `det_analysis.m' wants. det_analysis.m
>  	% will later provide the correct inferred determinism for it.
>  
> -proc_info_init(Arity, Modes, DeclaredModes, MaybeArgLives,
> +proc_info_init(Arity, Types, Modes, DeclaredModes, MaybeArgLives,
>  		MaybeDet, MContext, ArgsMethod, NewProc) :-
> -	map__init(BodyTypes),
> -	goal_info_init(GoalInfo),
>  	varset__init(BodyVarSet0),
>  	make_n_fresh_vars("HeadVar__", Arity, BodyVarSet0,
>  		HeadVars, BodyVarSet),
> +	assoc_list__from_corresponding_lists(HeadVars, Types, HeadTypes),
> +	map__from_assoc_list(HeadTypes, BodyTypes),

You should just use map__from_corresponding_lists.

Feel free to commit once you've fixed that.


dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
PhD student,                    |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list