[m-rev.] for post-commit review: fix failure of hard_coded/trace_goal_opt
jfischer at opturion.com
Fri Oct 1 13:27:40 AEST 2021
On Thu, 30 Sep 2021, Zoltan Somogyi wrote:
> Fix output of trace goals in .opt.
> Do not output io() and state() components in trace goals
> when generating output that is intended to be parsed as Mercury code
> (as opposed to when generating HLDS dumps), since in the goal
> in the scope will already have had applied to it the transformations
> needed to implement those components.
> This fixes the failure of tests/hard_coded/trace_goal_opt.
> diff --git a/compiler/hlds_out_goal.m b/compiler/hlds_out_goal.m
> index 856a560ea..bdb0d73ad 100644
> --- a/compiler/hlds_out_goal.m
> +++ b/compiler/hlds_out_goal.m
> @@ -2181,6 +2181,57 @@ write_goal_scope(!.Info, Stream, ModuleInfo, VarSet, TypeQual, VarNamePrint,
> MaybeRunTime = no
> + Lang = get_output_lang(!.Info ^ hoi_merc_out_info),
> + (
> + Lang = output_mercury,
> + % After we have read in trace goals as expressions,
> + % goal_expr_to_goal.m, in the process of converting
> + % those goal_exprs to HLDS goals, wraps the goal
> + % in the scope with code to get and set the I/O state
> + % and/or any mutables mentioned by the scope.
> + %
> + % Therefore when generate Mercury code, we don't write
> + % these parts of the trace goal out. If we did, then
> + % two problems would arise.
Looking at what the compiler is generating for trace_goal_opt_2.opt now,
:- pragma inline(pred((trace_goal_opt_2.require_lt)/2)).
trace_goal_opt_2.require_lt(V_3, V_4) :-
compile_time((flag("abc")) or (flag("\"xyz\"") and grade(debug))),
% quantified vars 
Is the comment reading "quantified vars " really supposed to be present
in the .opt file?
The diff is fine otherwise.
More information about the reviews