[m-users.] Automatic GC selection for grades

Adrian Ho ml+prog-mercury at 03s.net
Fri Mar 6 14:56:42 AEDT 2020


Hi!

I'm currently updating the Homebrew (macOS) formula for Mercury, and was
puzzled when I tested the Java grade as documented in README.Java, but
got this error:

$ cd samples
$ mmc --make --java hello
mercury_compile:
Use of Boehm GC is incompatible with target language Java.

It took a while to realize that I had to do:

$ mmc --make --java --gc automatic hello

instead. However, the mmc help text:

        --gc {none, boehm, hgc, accurate, automatic}
        --garbage-collection {none, boehm, hgc, accurate, automatic}
                                        (`java', `csharp', and `erlang'
                                                grades use `--gc automatic',
                                        `.gc' grades use `--gc boehm',
                                        `.hgc' grades use `--gc hgc',
                                        other grades use `--gc none'.)
                Specify which method of garbage collection to use
                (default: boehm).
                `boehm' is Hans Boehm et al's conservative collector.
                `hgc' is our own conservative collector;
                `accurate' is our own type-accurate copying GC;
                it requires `--high-level-code'.
                `automatic' means the target language provides it.
                This is the case for the C#, Java and Erlang back-ends,
                which always use the garbage collector of the underlying
                implementation.

suggests that there's only one reasonable GC method for most grades, so
why is the default a fixed "boehm", instead of the choice appropriate to
the requested grade?

Best Regards,
Adrian



More information about the users mailing list