[m-rev.] diff: document the ssdb transformation

Peter Ross pro at missioncriticalit.com
Thu Oct 4 11:05:28 AEST 2007


Hi,


===================================================================


Estimated hours taken: 2
Branches: main

compiler/ssdebug.m:
	Document the transformation that this module *should* do.


Index: compiler/ssdebug.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ssdebug.m,v
retrieving revision 1.2
diff -u -r1.2 ssdebug.m
--- compiler/ssdebug.m	4 Oct 2007 01:03:46 -0000	1.2
+++ compiler/ssdebug.m	4 Oct 2007 01:04:28 -0000
@@ -12,6 +12,119 @@
 % The ssdebug module does a source to source tranformation on each procedure
 % which allows the procedure to be debugged.
 %
+% Here is the transformation (note currently we don't do all of this)
+% 
+% original:
+% 
+%    p(...) :-
+%        <original body>
+% 
+% model_det transformed:
+% 
+%    p(...) :-
+%        promise_<original_purity> (
+%            CallVarDescs = [ ... ],
+%            impure call_port(ProcId, CallVarDescs),
+%            <original body>,    % renaming outputs
+%            ExitVarDescs = [ ... | CallVarDescs ],
+%            impure exit_port(ProcId, ExitVarDescs, DoRetry),
+%            (
+%                DoRetry = do_retry,
+%                p(...)
+%            ;
+%                DoRetry = do_not_retry,
+%                % bind outputs
+%            )
+%        ).
+% 
+% model_semi transformed:
+% 
+%    p(...) :-
+%        promise_<original_purity> (
+%            CallVarDescs = [ ... ],
+%            (
+%                impure call_port(ProcId, CallVarDescs),
+%                <original body>    % renaming outputs
+%            ->
+%                ExitVarDescs = [ ... | CallVarDescs ],
+%                impure exit_port(ProcId, ExitVarDescs, DoRetryA),
+%                (
+%                    DoRetryA = do_retry,
+%                    p(...)
+%                ;
+%                    DoRetryA = do_not_retry,
+%                    % bind outputs
+%                )
+%            ;
+%                impure fail_port(ProcId, CallVarDescs, DoRetryB),
+%                (
+%                    DoRetryB = do_retry,
+%                    p(...)
+%                ;
+%                    DoRetryB = do_not_retry,
+%                    fail
+%                )
+%            )
+%        ).
+% 
+% model_non transformed:
+% 
+%    p(...) :-
+%        promise_<original_purity> (
+%            (
+%                CallVarDescs = [ ... ],
+%                impure call_port(ProcId, CallVarDescs),
+%                <original body>,    % renaming outputs
+%                ExitVarDescs = [ ... | CallVarDescs ],
+%                (
+%                    impure exit_port(ProcId, ExitVarDescs, DoRetryA),
+%                    (
+%                        DoRetryA = do_retry,
+%                        p(...)
+%                        % Will give same result as long as p is pure or
+%                        % semipure.  Retry of impure procedures should probably
+%                        % be disallowed anyway.
+%                    ;
+%                        DoRetryB = do_not_retry,
+%                        % bind outputs
+%                    )
+%                ;
+%                    % preserve_backtrack_into,
+%                    impure redo_port(ProcId, ExitVarDescs),
+%                    fail
+%                )
+%            ;
+%                % preserve_backtrack_into
+%                impure fail_port(ProcId, CallVarDescs, DoRetryB),
+%                (
+%                    DoRetryB = do_retry,
+%                    p(...)
+%                ;
+%                    DoRetryB = do_not_retry,
+%                    fail
+%                )
+%            )
+%        ).
+% 
+% where CallVarDescs, ExitVarDescs are lists of var_value
+% 
+%    :- type var_value
+%        --->    unbound_head_var(var_name, pos)
+%        ;       some [T] bound_head_var(var_name, pos, T)
+%        ;       some [T] bound_other_var(var_name, T).
+% 
+%    :- type var_name == string.
+% 
+%    :- type pos == int.
+% 
+% Output head variables may appear twice in a variable description list --
+% initially unbound, then overridden by a bound_head_var functor.  Then the
+% ExitVarDescs can add output variable bindings to the CallVarDescs list, instead
+% of building new lists.  The pos fields give the argument numbers of head
+% variables.
+%
+% The ProcId is of type ssdb.ssdb_proc_id.
+%
 %-----------------------------------------------------------------------------%
 %-----------------------------------------------------------------------------%
 :- module transform_hlds.ssdebug.

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list