[m-dev.] bug with typeclass methods and .opt files
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Feb 10 20:23:56 AEDT 2004
On 10-Feb-2004, Julien Fischer <juliensf at students.cs.mu.OZ.AU> wrote:
>
> I have run across the following problem with intermodule optimization.
> When building the library with `--intermod-unused-args' enabled the
> compiler aborts while compiling tree234.m with the following:
>
> ops.opt:047: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:048: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:049: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:050: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:051: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:052: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:053: Internal compiler error: unknown predicate in `pragma unused_args'.
> ops.opt:054: Internal compiler error: unknown predicate in `pragma unused_args'.
>
> The relevant lines of ops.opt are:
>
> :- pragma unused_args(predicate, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__lookup_infix_op_5'), 5, 0, [1]).
> :- pragma unused_args(predicate, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__lookup_operator_term_4'), 4, 0, [1]).
> :- pragma unused_args(predicate, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__lookup_prefix_op_4'), 4, 0, [1]).
> :- pragma unused_args(predicate, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__lookup_binary_prefix_op_5'), 5, 0, [1]).
> :- pragma unused_args(predicate, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__lookup_postfix_op_4'), 4, 0, [1]).
> :- pragma unused_args(predicate, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__lookup_op_2'), 2, 0, [1]).
> :- pragma unused_args(function, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__max_priority_1'), 2, 0, [1]).
> :- pragma unused_args(function, (ops.'ClassMethod_for_ops__op_table____ops__mercury_op_table__arity0______ops__arg_priority_1'), 2, 0, [1]).
>
> The immediate problem is caused by the introduced predicate for the class
> method not being present in the importing module's predicate table.
> Should pragmas concerning these introduced predicates be in the .opt
> files anyway? I was under the impression that they were generated afresh
> for each module.
>
> The termination analyser seems to have the same problem only it has
> been cunningly avoided by commenting out the code on
> lines 1630-1636 of compiler/make_hlds.m. This results in it ignoring
> pragma termination_infos for predicates that are not already in the
> predicate table at the point the termination_info pragmas are read in.
>
> Commenting out the equivalent code for the unused argument analysis
> (compiler/make_hlds.m lines 1094 - 1097) fixes the problem but I
> assume this is not a particularly good solution.
I agree. It would be better to not write out such directives in the
first place rather than reading them in and ignoring them.
> Is the compiler
>
> (a) incorrect in writing out pragmas concerning the class methods
> (b) incorrectly reading them in
> or (c) something else?
At least to start with, I would vote for (a).
In the long term it might be nice to have some solution for
unused argument optimization of class methods, but the current
code obviously doesn't achieve that.
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list