[m-rev.] for review: store var_tables in proc_infos

Peter Wang novalazy at gmail.com
Thu Aug 18 15:13:48 AEST 2022


On Thu, 18 Aug 2022 10:53:31 +1000 "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> This fixes Mantis bug #562. For review by anyone.
> 
> Zoltan.

> Store var_tables in proc_infos.
> 

Add something like:

    Also fixes the performance regression reported in Mantis bug #562.

> diff --git a/compiler/inlining.m b/compiler/inlining.m
> index da806c4b2..498596889 100644
> --- a/compiler/inlining.m
> +++ b/compiler/inlining.m
> @@ -1055,7 +1056,8 @@ do_inline_call(ModuleInfo, ExternalTypeParams, ArgVars, PredInfo, ProcInfo,
>          ExternalTypeParams, CalleeExistQVars, TypeSubn),
>  
>      % Update types in the callee.
> -    apply_rec_subst_to_var_table(TypeSubn, CalleeVarTable1, CalleeVarTable),
> +    apply_rec_subst_to_var_table(is_type_a_dummy(ModuleInfo),TypeSubn,
> +        CalleeVarTable1, CalleeVarTable),

Missing a space.

> diff --git a/compiler/post_typecheck.m b/compiler/post_typecheck.m
> index e1f3e0be9..e2a4ab2e2 100644
> --- a/compiler/post_typecheck.m
> +++ b/compiler/post_typecheck.m
> @@ -150,6 +150,14 @@ post_typecheck_finish_preds(!ModuleInfo, NumBadErrors,
>  post_typecheck_do_finish_pred(ModuleInfo, ValidPredIdSet, PredId, !PredInfo,
>          !NumBadErrors, !AlwaysSpecs, !NoTypeErrorSpecs) :-
>      ( if set_tree234.contains(ValidPredIdSet, PredId) then
> +        % Regardless of the path we take when processing a valid predicate,
> +        % We need to ensure that we fill in the vte_is_dummy field in all

"we" (lowercase)

> +        % the entries in the predicate's var_table with valid information,
> +        % to replace the placeholder values put there earlier.
> +        %
> +        % In the then-part of this if-then-else, that is done by
> +        % setup_var_table_in_clauses_for_imported_pred. In the else-part,
> +        % it is done by find_unresolved_types_fill_in_is_dummy_in_pred.
>          ( if
>              ( pred_info_is_imported(!.PredInfo)
>              ; pred_info_is_pseudo_imported(!.PredInfo)

> @@ -426,22 +434,30 @@ describe_constrained_goal(ModuleInfo, Goal) = Pieces :-
>      % other than those that occur in the types of head variables, and that
>      % there are no unsatisfied type class constraints.
>      %
> -:- pred find_unresolved_types_in_pred(module_info::in, pred_id::in,
> -    pred_info::in, pred_info::out,
> +    % Also, fill in the vte_is_dummy field in all the entries in predicate's
> +    % var_table. We do this by flattening the old var table to VarsEntries0,
> +    % filling in those slots VarsEntries0 to yield RevVarsEntries, and then
> +    % constructing the updated var table from RevVarsEntries.

those slots "in" VarsEntries0

That looks fine, thanks.

Peter


More information about the reviews mailing list