[m-rev.] for review: ordering the items in interface files

Julien Fischer juliensf at cs.mu.OZ.AU
Sun Mar 20 15:34:09 AEDT 2005



On Sun, 20 Mar 2005, Zoltan Somogyi wrote:

> For review by Julien.
>
I take it that this is for the main branch only?

> compiler/modules.m:
> 	Put lists of items into an approximation of a standard order
> 	when generating interface files. This should reduce the number
> 	of times modules are unnecessarily recompiled because of a change
> 	in a module that *reorders* its exported items without *changing*
> 	the set of exported items.
>

...

> @@ -7364,6 +7366,158 @@
>              (pred((ThisItem - _)::in) is semidet :-
>                  ThisItem \= pragma(foreign_import_module(_, _))
>              ), !Items)
> +    ).
> +
> +%-----------------------------------------------------------------------------%
> +
> +    % Put the given list of items into a sort of standard order. The idea is
> +    % that just reordering the contents of e.g. an interface section without
> +    % changing the set of exported entities should not cause a change in the
> +    % interface files. The "sort of" is because we are not doing as good a job
> +    % as we could. Unfortunately, doing significantly better is quite hard
> +    % with the current representation of the module is just a list of items
s/with/when/

...

> +
> +    % The kinds of items for which reorderable succeeds can be arbitrarily
> +    % reordered with respect to each other and with respect to other chunkable
> +    % items in all kinds of interface files (.int, .int2, .int3, .int0, .opt
> +    % and .trans_opt).
> +    %

I don't think that using this with .opt and .trans_opt file is going to
be particulary useful.  They have different structure to the other sorts
of interface file - for example, they contain the clauses of the
procedures that can be inlined (.opt files do at any rate, we don't
support transitive intermodule inlining).  In any case optimization
interfaces (of both sorts) are generated from the HLDS directly, rather
than the list of items so the problems that this diff addresses aren't really
present.

...

> +:- pred compare_by_symname(item_and_context::in, item_and_context::in,
> +    comparison_result::out) is det.
> +
> +compare_by_symname(ItemAndContextA, ItemAndContextB, Result) :-
> +    (
> +        symname_ordered(ItemAndContextA, SymNameA),
> +        symname_ordered(ItemAndContextB, SymNameB)
> +    ->
> +        compare(Result, SymNameA, SymNameB)
> +    ;
> +        error("compare_by_symname: symname not found")

Call unexpected/2 there.

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