[m-rev.] for review: try_and_insert

Zoltan Somogyi zs at unimelb.edu.au
Thu Mar 29 19:33:05 AEDT 2012


On 29-Mar-2012, Zoltan Somogyi <zs at unimelb.edu.au> wrote:
> compiler/inst_match.m:
> 	Instead of first testing whether an inst exists in a set
> 	and then inserting it if does not, use a single predicate
> 	that does both the membership test and the insertion (if
> 	the membership test failed) in one pass.
> 
> 	This speeds up compilation of one version of the rcpsp_cpx
> 	stress test by about 9%, with negligible effect on tools/speedtest.

I actually cleaned up inst_match.m before making this change, intending
to commit the cleanup before posting the above diff, but it seems I forgot.
So here is a log message for this file that includes a description of the
cleanup.

compiler/inst_match.m:
	Instead of first testing whether an inst exists in a set
	and then inserting it if does not, use a single predicate
	that does both the membership test and the insertion (if
	the membership test failed) in one pass.

	This speeds up compilation of one version of the rcpsp_cpx
	stress test by about 9%, with negligible effect on tools/speedtest.

	Some cleanups that should have been committed before this diff follow.

	Change the structure of many of the predicates in this module from
	containing multiple clauses, to a single clause with an explicit
	disjunction, which (where relevant) now gets a require_comple_switch
	wrapper. In several cases, this change has shown that we were
	missing code for handling some kinds of insts. For example, some
	predicates handled free/0 but not free/1, even though there was
	no reason for the difference. This diff fixes such oversights
	in places where the right action seems obvious to me, and adds
	XXXs in places where I see no obvious fix.

	Rename several predicates and function symbols to avoid ambiguities.

	Add some XXXs on potential problems.

Zoltan.
--------------------------------------------------------------------------
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