[m-rev.] for review: Fix bug with direct-arg ctors and intermodule optimisation.
Peter Wang
novalazy at gmail.com
Mon Jan 12 12:21:59 AEDT 2026
On Sat, 10 Jan 2026 10:30:57 +1100 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
>
> On Fri, 9 Jan 2026 17:25:57 +1100, Peter Wang <novalazy at gmail.com> wrote:
>
> > If the compiler decides that a du type should use the direct-arg
> > representation for some of its constructors, it must include information
> > about that into the .opt file of the module defining the type, in the
> > form of `where direct_arg is' clauses, which will be used by modules
> > opt-importing that module and that type. That information was not being
> > included for du types defined in the *interface* section of a module.
> >
> > Also fix a related issue that was uncovered: a word_aligned_pointer
> > assertion on a foreign_type definition would have no effect if there is
> > a corresponding no-tag du type definition for the same type constructor.
> > --- a/tests/hard_coded/Mmakefile
> > +++ b/tests/hard_coded/Mmakefile
> > @@ -111,6 +111,7 @@ ORDINARY_PROGS = \
> > det_in_semidet_cntxt \
> > digraph_tc \
> > dir_fold \
> > + direct_arg_opt_imported \
> > direct_arg_partial_inst_1 \
> > direct_arg_partial_inst_2 \
> > direct_arg_tags_1 \
>
> The new test case should be in a different list from ORDINARY_PROGS,
> because the foreign code of some predicates exists only for C.
> Please add it to C_ONLY_PROGS instead.
>
The test case contains Mercury clauses for other target langugages.
I've left it in ORDINARY_PROGS.
> I would put the definitions of new_object and get_magic next to
> each other. I would also try to find a better name than "object"
> for the data structure, though I can see that finding a better name
> is not easy :-(
I've renamed it to test_object and TestObject, and followed your other
suggestions. Thanks.
Peter
More information about the reviews
mailing list