[m-rev.] for post-commit review: restructure goal_infos

Julien Fischer juliensf at csse.unimelb.edu.au
Sun Aug 5 01:03:43 AEST 2007


On Thu, 2 Aug 2007, Zoltan Somogyi wrote:

> Rearrange the fields of the goal_info structure in preparation for new
> additions by Quan.
>
> By making sure that the main hlds_goal_info type has only eight fields,
> not ten, we get a 2% speedup on our usual compiler benchmark (since it avoids
> having the Boehm allocator rounding up the cell size to 16 words).
>
> In the process of making this change, I noticed that the code to rename
> variables in goals and goal_infos had three separate bugs:
>
> - it did not rename variables in ctgc_infos in hlds_goal_infos
> - it did not rename variables in mode_constraint_infos in hlds_goal_infos
> - it did not rename variables in complicated_unifies in hlds_goal_exprs
>
> This diff fixes those bugs. To avoid unnecessary inefficiency in the fixed code
> and to make such bugs much less likely in the future, this diff also moves the
> code for renaming variables in goals and goal_infos from goal_util to
> hlds_goal.
>
> The bug fix reduces the speedup to 1.1%, but this is still a good deal.
>
> compiler/hlds_goal.m:
> 	Make the changes described above.
>
> compiler/goal_util.m:
> 	Delete the stuff moved to hlds_goal.m, as well as an old unused
> 	predicate.
>
> compiler/quantification.m:
> compiler/make_hlds_warn.m:
> 	Delay extracting the context from goal_infos until it is needed
> 	in the creation of an error message. This is useful since contexts
> 	have been moved from the main hlds_goal_info structure to the
> 	extra_goal_info substructure. In make_hlds_warn.m, this change
> 	also allows us to pass around one fewer argument (the context arguments
> 	were redundant, since we also always passed the goal_info that they
> 	came from).
>
> 	(The three other pieces of code that are responsible for most of the
> 	calls to goal_info_get_context are the parts of the type checker, mode
> 	checker and unique mode checker that conditionally update the current
> 	context in e.g. the typecheck_info. Unfortunately, this technique of
> 	delay-the-extraction cannot be applied to them.)
>
> compiler/*.m:
> 	Conform to the move of the rename predicates, mostly by deleting
> 	unnecessary module qualifications.
>

That' looks fine.

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list