[m-rev.] for review: exception analysis of generic calls

Ian MacLarty maclarty at cs.mu.OZ.AU
Thu Aug 4 02:26:33 AEST 2005


On Mon, 25 Jul 2005, Julien Fischer wrote:

>
> For review by anyone.
>
> Estimated hours taken: 7
> Branches: main
>
> Add support for exception analysis through some generic_call sites.
> At the moment this is restricted to higher-order calls, although
> we may eventually extend it to method calls as well.
>
...
> Index: compiler/exception_analysis.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/exception_analysis.m,v
> retrieving revision 1.9
> diff -u -r1.9 exception_analysis.m
> --- compiler/exception_analysis.m	14 Apr 2005 07:47:31 -0000	1.9
> +++ compiler/exception_analysis.m	25 Jul 2005 07:59:58 -0000
> @@ -323,14 +326,76 @@
>          check_nonrecursive_call(ModuleInfo, VarTypes, CallPPId, CallArgs,
>              !Result)
>      ).
> -check_goal_for_exceptions_2(_, _, _, generic_call(_,_,_,_), !Result) :-
> -    !:Result = !.Result ^ status := may_throw(user_exception).
> -check_goal_for_exceptions_2(SCC, ModuleInfo, VarTypes, not(Goal), !Result) :-
> +check_goal_for_exceptions_2(_, ModuleInfo, VarTypes, Goal, GoalInfo,
> +        !Result) :-
> +    Goal = generic_call(Details, Args, _ArgModes, _),
> +    (
> +        Details = higher_order(Var, _, _,  _),
> +        ClosureValueMap = goal_info_get_ho_values(GoalInfo),
> +        ( ClosureValues = ClosureValueMap ^ elem(Var) ->
> +                (
> +                    get_conditional_closures(ModuleInfo, ClosureValues,
> +                        Conditional)
> +                ->
> +                    (
> +                        Conditional = []
> +                        % The values of the higher-order variable are

Should that be "The POSSIBLE values of ..."?

> +                        % all procedures that are known not to throw
> +                        % exceptions.
> @@ -380,6 +448,37 @@
>        then  true
>        else  check_goals_for_exceptions(SCC, ModuleInfo, VarTypes, Goals,
>                  !Result)
> +    ).
> +
> +%----------------------------------------------------------------------------%
> +%
> +% Further code to handle higher-order variables
> +%
> +
> +    % Given a list of procedure ids extract those whose exception status
> +    % has been set to 'conditional'.  Fails if one of the procedures in
> +    % the set has an exception status that indicate it may throw an

s/indicate/indicates/

> +    % exception, or if the exception status for a procedure has not yet
> +    % been set.
> +    %

Looks fine otherwise.

Ian.

--------------------------------------------------------------------------
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