[m-rev.] for review: postpone the processing of reuse/alias-pragma's
Nancy Mazur
Nancy.Mazur at cs.kuleuven.ac.be
Thu Aug 22 00:07:47 AEST 2002
Hi Peter,
I'll do the suggested changes, but I have some remarks...
> > +:- pred mode_list_matches(list(mode), list(mode), module_info).
> > +:- mode mode_list_matches(in, in, in) is semidet.
> > +
> > +mode_list_matches([], [], _).
> > +mode_list_matches([Mode1 | Modes1], [Mode2 | Modes2], ModuleInfo) :-
> > + % Use mode_get_insts_semidet instead of mode_get_insts to avoid
> > + % aborting if there are undefined modes.
> > + mode_get_insts_semidet(ModuleInfo, Mode1, Inst1, Inst2),
> > + mode_get_insts_semidet(ModuleInfo, Mode2, Inst1, Inst2),
> > + mode_list_matches(Modes1, Modes2, ModuleInfo).
> > +
>
> It would be better to move this mode_list_matches predicate into
> mode_util.m and delete it from make_hlds.m.
perfect ! ;-)
> > +process_unproc_alias_pragma(UnprocAliasPragma, Module0, Module) -->
> > + { UnprocAliasPragma = unproc_alias_pragma(PredOrFunc, SymName,
> > + Modes, HeadVars, Types, Alias0) },
> > +
> > + globals__io_lookup_bool_option(very_verbose, VeryVerbose),
> > +
> > + { module_info_get_predicate_table(Module0, Preds) },
> > + { list__length(Modes, Arity) },
> > + (
> > + { predicate_table_search_pf_sym_arity_declmodes(Module0,
> > + Preds, PredOrFunc, SymName, Arity, Modes,
> > + PredId, ProcId) }
> > + ->
> > + { module_info_preds(Module0, PredTable0) },
> > + { map__lookup(PredTable0, PredId, PredInfo0) },
> > + { pred_info_procedures(PredInfo0, ProcTable0) },
> > + { map__lookup(ProcTable0, ProcId, ProcInfo0) },
> > + write_proc_progress_message("(Alias) Looking into ",
> > + PredId, ProcId, Module0),
> > +
> > + % rename the headvars:
> > + maybe_write_string(VeryVerbose, "Renaming HeadVars..."),
> > + { proc_info_headvars(ProcInfo0, ProcHeadVars) },
> > + { list__map(term__coerce_var, HeadVars, CHVars) },
> > + { map__from_corresponding_lists(CHVars, ProcHeadVars,
> > + MapHeadVars) },
> > + { pa_alias_as__rename(MapHeadVars, Alias0, Alias1) },
> > + maybe_write_string(VeryVerbose, "done.\n"),
> > +
> > + % rename the types:
> > + maybe_write_string(VeryVerbose, "Renaming Types..."),
> > + { pred_info_arg_types(PredInfo0, ArgTypes) },
> > + { pa_alias_as__rename_types(Types, ArgTypes,
> > + Alias1, Alias) },
> > + maybe_write_string(VeryVerbose, "done.\n"),
> > +
> > + % set the proc_info right
> > + { proc_info_set_possible_aliases(ProcInfo0,
> > + Alias, ProcInfo) },
> > + { map__det_update(ProcTable0, ProcId, ProcInfo,
> > + ProcTable) },
> > + { pred_info_set_procedures(PredInfo0, ProcTable,
> > + PredInfo) },
> > + { map__det_update(PredTable0, PredId, PredInfo,
> > + PredTable) },
> > + { module_info_set_preds(Module0, PredTable, Module) }
> > + ;
> > + % io__write_string("Warning: no entry found for "),
> > + % hlds_out__write_simple_call_id(PredOrFunc, SymName/Arity),
> > + % io__write_string(" with modes: "),
> > + % { varset__init(EmptyVarset) },
> > + % io__write_list(Modes, ", ", write_mode(EmptyVarset)),
> > + % io__write_string(" (alias_info).\n"),
>
> You definitely need to report an error here.
>
> Use
>
> io__set_exit_status(1),
> { module_info_incr_errors(Module0, Module) },
>
> This should ensure that the compiler finishes with an abort.
I'm not so sure here. When uncommented, I obtain a huge list of such
warnings, but they don't seem to be worrying. Is it possible that some
of the predicates/procedures are removed from the hlds if known that
they are not needed? Hmm, stupid remark from me ;-)
No, I think I know where the problem is. Given the fact that we have
our own system of transitively importing all trans_opts of
all the modules in which some of the needed types are defined, this
means that a lot of "unnecessary" pragma's are read. Pragma's which will
never be needed, because the actual procedures are never needed.
Does this make sense? I think so..
Same remark for the reuse_info..
I'll process the rest of your comments and send a diff later on...
Thanks!
Nancy
--------------------------------------------------------------------------
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