[m-rev.] for review: new machinery in make.dependencies.m

Peter Wang novalazy at gmail.com
Mon Oct 2 17:51:34 AEDT 2023


On Sat, 30 Sep 2023 02:57:39 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> For review by anyone. I am particularly seeking feedback
> on whether you guys think the few test cases for which the
> old/new comparison in the diff detected changes are
> indicative of a problem with this diff, or not. (I have looked
> at it and couldn't decide, maybe you have some ideas
> I have overlooked. The failure reports for two of the
> test cases are attached; the others are similar.)
> 
> I am also depending on you guys to test out this diff
> on real code, since you work with code bases using mmc --make,
> which I don't do. I would also like to know whether you want to
> do such tryouts before this diff is committed, or after.

The diff looks okay.

I tested it briefly on a few projects without encountering any aborts.
I only tested the C backends.

> FAILED TEST valid_make_int/bug506 in grade csharp
...
> Making Mercury/int3s/bug506.int3
> Making Mercury/int3s/bug506_helper_1.int3

See below.

> Uncaught Mercury exception:
> Software Error: predicate `make.dependencies.eqv_states'/10: Unexpected: 
> eqv_state(int012)
...
> dep status mismatch
> version A:
> dep_target(target_file(unqualified("bug506"), module_target_int1))
>     deps_status_being_built
> dep_target(target_file(unqualified("bug506"), module_target_int2))
>     deps_status_being_built
> dep_target(target_file(unqualified("bug506"), module_target_int3))
>     deps_status_up_to_date
> version B:
> dep_target(target_file(unqualified("bug506"), module_target_int1))
>     deps_status_being_built
> dep_target(target_file(unqualified("bug506"), module_target_int2))
>     deps_status_being_built
> dep_target(target_file(unqualified("bug506"), module_target_int3))
>     deps_status_up_to_date
> dep_target(target_file(unqualified("bug506_helper_1"), module_target_int3))
>     deps_status_up_to_date
> error file modules mismatch
> version A:
> unqualified("bug506")
> version B:
> unqualified("bug506")
> unqualified("bug506_helper_1")

I tried to debug these mismatches for a bit.

I found that swapping the order of the FindDeps call (old mechanism)
and the find_dep_specs call (new mechanism)
in find_target_dependencies_of_module, before eqv_states("int012", ...),
changes which version gets the additional entry for bug506_helper_1.

    dep status mismatch
    version A:
    dep_target(target_file(unqualified("bug506"), module_target_int1))
	deps_status_being_built
    dep_target(target_file(unqualified("bug506"), module_target_int2))
	deps_status_being_built
    dep_target(target_file(unqualified("bug506"), module_target_int3))
	deps_status_up_to_date
    dep_target(target_file(unqualified("bug506_helper_1"), module_target_int3))
	deps_status_up_to_date
    version B:
    dep_target(target_file(unqualified("bug506"), module_target_int1))
	deps_status_being_built
    dep_target(target_file(unqualified("bug506"), module_target_int2))
	deps_status_being_built
    dep_target(target_file(unqualified("bug506"), module_target_int3))
	deps_status_up_to_date
    error file modules mismatch
    version A:
    unqualified("bug506")
    unqualified("bug506_helper_1")
    version B:
    unqualified("bug506")

I think whichever call is made first has the side-effect of making the
bug506_helper_1.int3 file, affecting the results of the second call.

Peter


More information about the reviews mailing list