[m-rev.] Re: for review: procedure representations for the deep profiler

Paul Bone pbone at csse.unimelb.edu.au
Tue Sep 11 12:36:04 AEST 2007


I've begun reviewing this.  This is my frist review, so perhaps there  
should be a second opinion?

All the changes below (a subset of what Zoltan sent), are fine by me.


On 11/09/2007, at 11:47 AM, Zoltan Somogyi wrote:

> cvs diff: Diffing .
> Index: Mmakefile
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/Mmakefile,v
> retrieving revision 1.123
> diff -u -b -r1.123 Mmakefile
> --- Mmakefile	15 Jun 2007 13:38:43 -0000	1.123
> +++ Mmakefile	29 Aug 2007 13:50:43 -0000
> @@ -148,21 +148,12 @@
>  dep_deep_profiler:
>  endif
>
> -deep_profiler/$(deps_subdir)mdprof_cgi.dep: \
> -		library/$(deps_subdir)$(STD_LIB_NAME).dep
> -	+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_cgi.depend
> -
> -deep_profiler/$(deps_subdir)mdprof_test.dep: \
> -		library/$(deps_subdir)$(STD_LIB_NAME).dep
> -	+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_test.depend
> -
> -deep_profiler/$(deps_subdir)mdprof_dump.dep: \
> -		library/$(deps_subdir)$(STD_LIB_NAME).dep
> -	+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_dump.depend
> -
> +deep_profiler/$(deps_subdir)mdprof_cgi.dep \
> +deep_profiler/$(deps_subdir)mdprof_test.dep \
> +deep_profiler/$(deps_subdir)mdprof_dump.dep \
>  deep_profiler/$(deps_subdir)mdprof_feedback.dep: \
>  		library/$(deps_subdir)$(STD_LIB_NAME).dep
> -	+cd deep_profiler && $(SUBDIR_MMAKE) mdprof_feedback.depend
> +	+cd deep_profiler && $(SUBDIR_MMAKE) depend
>
>  # depend_library MUST be done before depend_compiler and  
> depend_profiler
>
> Index: configure.in
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
> retrieving revision 1.499
> diff -u -b -r1.499 configure.in
> --- configure.in	13 Aug 2007 01:10:39 -0000	1.499
> +++ configure.in	8 Sep 2007 01:39:56 -0000
> @@ -275,7 +275,20 @@
>
>  		:- pred return_rtti_version(int::out) is det.
>
> -		:- pragma foreign_decl("C", local, "").
> +		:- pragma foreign_decl("C", local, "
> +		typedef enum {
> +			enum1, enum2
> +		} Enum;
> +		").
> +
> +		:- type c_enum
> +			--->	c_enum_1
> +			;	c_enum_2.
> +
> +		:- pragma foreign_enum("C", c_enum/0, [[
> +			c_enum_1 - "enum1",
> +			c_enum_2 - "enum2"
> +		]]).
>
>  		:- type x ---> x.
>  		:- pragma foreign_type("C", x, "MR_Integer",
> @@ -324,6 +337,7 @@
>  			--compound-compare-builtins-2007-07-09 \
>  			--erlang-native-code \
>  			--no-no-det-warning-compound-compare-2007-07-17 \
> +			--foreign-enum-switch-fix \
>  			</dev/null >&AC_FD_CC 2>&1 &&
>  		test "`./conftest 2>&1 | tr -d '\015'`" = "Hello, world" &&
>  		# Test for the --record-term-sizes-as-words option.
> cvs diff: Diffing analysis
> cvs diff: Diffing bindist
> cvs diff: Diffing boehm_gc
> cvs diff: Diffing boehm_gc/Mac_files
> cvs diff: Diffing boehm_gc/cord
> cvs diff: Diffing boehm_gc/cord/private
> cvs diff: Diffing boehm_gc/doc
> cvs diff: Diffing boehm_gc/include
> cvs diff: Diffing boehm_gc/include/private
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/doc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ 
> gcc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ 
> hpc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ 
> ibmc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ 
> icc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ 
> msftc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/src/atomic_ops/sysdeps/ 
> sunc
> cvs diff: Diffing boehm_gc/libatomic_ops-1.2/tests
> cvs diff: Diffing boehm_gc/tests
> cvs diff: Diffing boehm_gc/windows-untested
> cvs diff: Diffing boehm_gc/windows-untested/vc60
> cvs diff: Diffing boehm_gc/windows-untested/vc70
> cvs diff: Diffing boehm_gc/windows-untested/vc71
> cvs diff: Diffing browser
> Index: browser/declarative_execution.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/browser/ 
> declarative_execution.m,v
> retrieving revision 1.60
> diff -u -b -r1.60 declarative_execution.m
> --- browser/declarative_execution.m	31 Jul 2007 05:48:17 -0000	1.60
> +++ browser/declarative_execution.m	6 Sep 2007 11:02:27 -0000
> @@ -297,8 +297,8 @@
>  :- pred get_pred_attributes(proc_label::in, module_name::out,  
> string::out,
>      int::out, pred_or_func::out) is det.
>
> -:- pred call_node_maybe_proc_rep(trace_node(R)::in(trace_node_call),
> -    maybe(proc_rep)::out) is det.
> +:- pred call_node_maybe_proc_defn_rep(trace_node(R)::in 
> (trace_node_call),
> +    maybe(proc_defn_rep)::out) is det.
>
>   
> %--------------------------------------------------------------------- 
> --------%
>
> @@ -490,21 +490,27 @@
>
>   
> %--------------------------------------------------------------------- 
> --------%
>
> -:- pragma promise_pure(call_node_maybe_proc_rep/2).
> -
> -call_node_maybe_proc_rep(CallNode, MaybeProcRep) :-
> +call_node_maybe_proc_defn_rep(CallNode, MaybeProcDefnRep) :-
>      Label = CallNode ^ call_label,
>      ( call_node_bytecode_layout(Label, ProcLayout) ->
> -        ( semipure have_cached_proc_rep(ProcLayout, ProcRep) ->
> -            MaybeProcRep = yes(ProcRep)
> +        promise_pure (
> +            ( semipure have_cached_proc_defn_rep(ProcLayout,  
> ProcDefnRep) ->
> +                MaybeProcDefnRep = yes(ProcDefnRep)
> +            ;
> +                ByteCodeBytes = proc_bytecode_bytes(ProcLayout),
> +                (
> +                    trace_read_proc_defn_rep(ByteCodeBytes, Label,  
> ProcDefnRep)
> +                ->
> +                    impure cache_proc_defn_rep(ProcLayout,  
> ProcDefnRep),
> +                    MaybeProcDefnRep = yes(ProcDefnRep)
>          ;
> -            lookup_proc_bytecode(ProcLayout, ByteCode),
> -            read_proc_rep(ByteCode, Label, ProcRep),
> -            impure cache_proc_rep(ProcLayout, ProcRep),
> -            MaybeProcRep = yes(ProcRep)
> +                    throw(internal_error 
> ("call_node_maybe_proc_defn_rep",
> +                        "cannot interpret proc bytecode"))
> +                )
> +            )
>          )
>      ;
> -        MaybeProcRep = no
> +        MaybeProcDefnRep = no
>      ).
>
>  :- pred call_node_bytecode_layout(label_layout::in, proc_layout::out)
> @@ -532,61 +538,44 @@
>      }
>  ").
>
> -:- pred lookup_proc_bytecode(proc_layout::in, bytecode::out) is det.
> -
> -    % Default version for non-C backends.
> -lookup_proc_bytecode(_, dummy_bytecode).
> -
> -:- pragma foreign_proc("C",
> -    lookup_proc_bytecode(ProcLayout::in, ByteCode::out),
> -    [will_not_call_mercury, thread_safe, promise_pure],
> -"
> -    ByteCode = ProcLayout->MR_sle_body_bytes;
> -#ifdef MR_DEBUG_PROC_REP
> -    printf(""lookup_proc_bytecode: %p %p\\n"", ProcLayout, ByteCode);
> -#endif
> -").
> -
> -:- semipure pred have_cached_proc_rep(proc_layout::in, proc_rep::out)
> +:- semipure pred have_cached_proc_defn_rep(proc_layout::in,  
> proc_defn_rep::out)
>      is semidet.
>
>      % Default version for non-C backends.
> -have_cached_proc_rep(_, _) :-
> +have_cached_proc_defn_rep(_, _) :-
>      semidet_fail.
>
>  :- pragma foreign_proc("C",
> -    have_cached_proc_rep(ProcLayout::in, ProcRep::out),
> +    have_cached_proc_defn_rep(ProcLayout::in, ProcDefnRep::out),
>      [will_not_call_mercury, thread_safe, promise_semipure],
>  "
> -    ProcRep = MR_lookup_proc_rep(ProcLayout);
> -    if (ProcRep != 0) {
> +    ProcDefnRep = MR_lookup_proc_defn_rep(ProcLayout);
> +    if (ProcDefnRep != 0) {
>  #ifdef MR_DEBUG_PROC_REP
> -        printf(""have_cached_proc_rep: %p success\\n"",
> -            ProcLayout);
> +        printf(""have_cached_proc_defn_rep: %p success\\n"",  
> ProcLayout);
>  #endif
>          SUCCESS_INDICATOR = MR_TRUE;
>      } else {
>  #ifdef MR_DEBUG_PROC_REP
> -        printf(""have_cached_proc_rep: %p failure\\n"",
> -            ProcLayout);
> +        printf(""have_cached_proc_defn_rep: %p failure\\n"",  
> ProcLayout);
>  #endif
>          SUCCESS_INDICATOR = MR_FALSE;
>      }
>  ").
>
> -:- impure pred cache_proc_rep(proc_layout::in, proc_rep::in) is det.
> +:- impure pred cache_proc_defn_rep(proc_layout::in,  
> proc_defn_rep::in) is det.
>
>      % Default version for non-C backends.
> -cache_proc_rep(_, _).
> +cache_proc_defn_rep(_, _).
>
>  :- pragma foreign_proc("C",
> -    cache_proc_rep(ProcLayout::in, ProcRep::in),
> +    cache_proc_defn_rep(ProcLayout::in, ProcDefnRep::in),
>      [will_not_call_mercury, thread_safe],
>  "
>  #ifdef MR_DEBUG_PROC_REP
> -    printf(""cache_proc_rep: %p %x\\n"", ProcLayout, ProcRep);
> +    printf(""cache_proc_defn_rep: %p %x\\n"", ProcLayout,  
> ProcDefnRep);
>  #endif
> -    MR_insert_proc_rep(ProcLayout, ProcRep);
> +    MR_insert_proc_defn_rep(ProcLayout, ProcDefnRep);
>  ").
>
>   
> %--------------------------------------------------------------------- 
> --------%
> Index: browser/declarative_tree.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/browser/ 
> declarative_tree.m,v
> retrieving revision 1.50
> diff -u -b -r1.50 declarative_tree.m
> --- browser/declarative_tree.m	19 Jan 2007 07:03:58 -0000	1.50
> +++ browser/declarative_tree.m	10 Sep 2007 14:29:34 -0000
> @@ -715,33 +715,28 @@
>
>  :- type dependency_chain_start(R)
>      --->    chain_start(
> +                % The argument number of the selected position in  
> the full list
> +                % of arguments, including the compiler-generated  
> ones.
>                  start_loc(R),
> -                        % The argument number of the selected
> -                        % position in the full list of
> -                        % arguments, including the
> -                        % compiler-generated ones.
>
> +                % The total number of arguments including the  
> compiler
> +                % generated ones.
>                  int,
> -                        % The total number of arguments
> -                        % including the compiler generated
> -                        % ones.
>
>                  int,
> -                R,      % The id of the node preceding the exit
> -                        % node, if start_loc is cur_goal
> -                        % and the id of the node preceding the
> -                        % call node if start_loc is
> -                        % parent_goal.
>
> -                maybe(goal_path),
> -                        % No if start_loc is cur_goal;
> -                        % and yes wrapped around the goal path
> -                        % of the call in the parent procedure
> +                % The id of the node preceding the exit node if  
> start_loc
> +                % is cur_goal, and the id of the node preceding  
> the call node
>                          % if start_loc is parent_goal.
> +                R,
> +
> +                % No if start_loc is cur_goal; and yes wrapped  
> around the
> +                % goal path of the call in the parent procedure if  
> start_loc
> +                % is parent_goal.
> +                maybe(goal_path),
>
> -                maybe(proc_rep)
> -                        % The body of the procedure indicated
> -                        % by start_loc.
> +                % The body of the procedure indicated by start_loc.
> +                maybe(proc_defn_rep)
>              )
>
>      ;       require_explicit_subtree.
> @@ -791,21 +786,21 @@
>      find_chain_start(Store, Ref, ArgPos, TermPath, ChainStart),
>      (
>          ChainStart = chain_start(StartLoc, ArgNum, TotalArgs, NodeId,
> -            StartPath, MaybeProcRep),
> +            StartPath, MaybeProcDefnRep),
>          Mode = start_loc_to_subterm_mode(StartLoc),
>          (
> -            MaybeProcRep = no,
> +            MaybeProcDefnRep = no,
>              Origin = origin_not_found
>          ;
> -            MaybeProcRep = yes(ProcRep),
> +            MaybeProcDefnRep = yes(ProcDefnRep),
>              (
> -                trace_dependency_special_case(Store, ProcRep, Ref,
> +                trace_dependency_special_case(Store, ProcDefnRep,  
> Ref,
>                      StartLoc, ArgNum, TermPath, NodeId, Origin0)
>              ->
>                  Origin = Origin0
>              ;
> -                trace_dependency_in_proc_rep(Store, TermPath,  
> StartLoc, ArgNum,
> -                    TotalArgs, NodeId, StartPath, ProcRep, Origin)
> +                trace_dependency_in_proc_defn_rep(Store, TermPath,  
> StartLoc,
> +                    ArgNum, TotalArgs, NodeId, StartPath,  
> ProcDefnRep, Origin)
>              )
>          )
>      ;
> @@ -819,16 +814,16 @@
>      % by the usual subterm dependency tracking algorithm. At the  
> moment
>      % it handles tracking of subterms through catch_impl.
>      %
> -:- pred trace_dependency_special_case(S::in, proc_rep::in, R::in,
> +:- pred trace_dependency_special_case(S::in, proc_defn_rep::in,  
> R::in,
>      start_loc(R)::in, int::in, term_path::in, R::in,
>      subterm_origin(edt_node(R))::out) is semidet <= annotated_trace 
> (S, R).
>
> -trace_dependency_special_case(Store, ProcRep, Ref, StartLoc,  
> ArgNum, TermPath,
> -        NodeId, Origin) :-
> +trace_dependency_special_case(Store, ProcDefnRep, Ref, StartLoc,
> +        ArgNum, TermPath, NodeId, Origin) :-
>      % Catch_impl's body is a single call to builtin_catch.  
> Builtin_catch
>      % doesn't generate any events, so we need to handle catch_impl  
> specially.
>
> -    proc_rep_is_catch_impl(ProcRep),
> +    proc_defn_rep_is_catch_impl(ProcDefnRep),
>      (
>          StartLoc = parent_goal(_, _),
>          % The subterm being tracked is an input to builtin_catch  
> so we know
> @@ -862,12 +857,13 @@
>          )
>      ).
>
> -:- pred trace_dependency_in_proc_rep(S::in, term_path::in,  
> start_loc(R)::in,
> -    int::in, int::in, R::in, maybe(goal_path)::in, proc_rep::in,
> -    subterm_origin(edt_node(R))::out) is det <= annotated_trace(S,  
> R).
> +:- pred trace_dependency_in_proc_defn_rep(S::in, term_path::in,
> +    start_loc(R)::in, int::in, int::in, R::in, maybe(goal_path)::in,
> +    proc_defn_rep::in, subterm_origin(edt_node(R))::out) is det
> +    <= annotated_trace(S, R).
>
> -trace_dependency_in_proc_rep(Store, TermPath, StartLoc, ArgNum,
> -        TotalArgs, NodeId, StartPath, ProcRep, Origin) :-
> +trace_dependency_in_proc_defn_rep(Store, TermPath, StartLoc, ArgNum,
> +        TotalArgs, NodeId, StartPath, ProcDefnRep, Origin) :-
>      det_trace_node_from_id(Store, NodeId, Node),
>      materialize_contour(Store, NodeId, Node, [], Contour0),
>      (
> @@ -877,7 +873,7 @@
>          StartLoc = cur_goal,
>          Contour = Contour0
>      ),
> -    ProcRep = proc_rep(HeadVars, GoalRep),
> +    ProcDefnRep = proc_defn_rep(HeadVars, GoalRep),
>      is_traced_grade(AllTraced),
>      MaybePrims = make_primitive_list(Store, [goal_and_path 
> (GoalRep, [])],
>          Contour, StartPath, ArgNum, TotalArgs, HeadVars,  
> AllTraced, []),
> @@ -899,22 +895,24 @@
>              MaybeClosure = no,
>              AdjustedTermPath = TermPath
>          ),
> -        traverse_primitives(Primitives, Var, AdjustedTermPath,  
> Store, ProcRep,
> -            Origin)
> +        traverse_primitives(Primitives, Var, AdjustedTermPath, Store,
> +            ProcDefnRep, Origin)
>      ;
>          MaybePrims = no,
>          Origin = origin_not_found
>      ).
>
> -    % proc_rep_is_catch_impl(ProcRep) is true if ProcRep is a  
> representation
> -    % of exception.catch_impl (the converse is true assuming
> -    % exception.builtin_catch is only called from  
> exception.catch_impl).
> +    % proc_defn_rep_is_catch_impl(ProcDefnRep) is true if ProcDefnRep
> +    % is a representation of exception.catch_impl (the converse is  
> true
> +    % assuming exception.builtin_catch is only called from
> +    % exception.catch_impl).
>      %
> -:- pred proc_rep_is_catch_impl(proc_rep::in) is semidet.
> +:- pred proc_defn_rep_is_catch_impl(proc_defn_rep::in) is semidet.
>
> -proc_rep_is_catch_impl(ProcRep) :-
> -    ProcRep = proc_rep([A, B, C, D], atomic_goal_rep(_,  
> "exception.m", _,
> -        [D], plain_call_rep("exception", "builtin_catch", [A, B,  
> C, D]))).
> +proc_defn_rep_is_catch_impl(ProcDefnRep) :-
> +    ProcDefnRep = proc_defn_rep([A, B, C, D],
> +        atomic_goal_rep(_, "exception.m", _, [D],
> +            plain_call_rep("exception", "builtin_catch", [A, B, C,  
> D]))).
>
>  :- pred find_chain_start(S::in, R::in, arg_pos::in, term_path::in,
>      dependency_chain_start(R)::out) is det <= annotated_trace(S, R).
> @@ -954,9 +952,9 @@
>          Node = node_excp(_, CallId, _, _, _, _, _),
>          call_node_from_id(Store, CallId, CallNode),
>          CallAtom = get_trace_call_atom(CallNode),
> -        %
> +
>          % XXX We don't yet handle tracking of the exception value.
> -        %
> +
>          ( trace_atom_subterm_is_ground(CallAtom, ArgPos, TermPath) ->
>              find_chain_start_inside(Store, CallId, CallNode,
>                  ArgPos, ChainStart)
> @@ -980,7 +978,7 @@
>      TotalArgs = length(CallAtom ^ atom_args),
>      StartId = CallPrecId,
>      StartPath = yes(CallPath),
> -    parent_proc_rep(Store, CallId, StartRep),
> +    parent_proc_defn_rep(Store, CallId, StartRep),
>      ChainStart = chain_start(StartLoc, ArgNum, TotalArgs, StartId,
>          StartPath, StartRep).
>
> @@ -995,20 +993,20 @@
>      TotalArgs = length(ExitAtom ^ atom_args),
>      StartId = ExitNode ^ exit_preceding,
>      StartPath = no,
> -    call_node_maybe_proc_rep(CallNode, StartRep),
> +    call_node_maybe_proc_defn_rep(CallNode, StartRep),
>      ChainStart = chain_start(StartLoc, ArgNum, TotalArgs, StartId,
>          StartPath, StartRep).
>
> -:- pred parent_proc_rep(S::in, R::in, maybe(proc_rep)::out)
> +:- pred parent_proc_defn_rep(S::in, R::in, maybe(proc_defn_rep)::out)
>      is det <= annotated_trace(S, R).
>
> -parent_proc_rep(Store, CallId, ProcRep) :-
> +parent_proc_defn_rep(Store, CallId, ProcDefnRep) :-
>      call_node_from_id(Store, CallId, Call),
>      CallPrecId = Call ^ call_preceding,
>      ( step_left_to_call(Store, CallPrecId, ParentCallNode) ->
> -        call_node_maybe_proc_rep(ParentCallNode, ProcRep)
> +        call_node_maybe_proc_defn_rep(ParentCallNode, ProcDefnRep)
>      ;
> -        ProcRep = no
> +        ProcDefnRep = no
>      ).
>
>      % Finds the call node of the parent of the given node.  Fails if
> @@ -1257,7 +1255,7 @@
>                  "mismatch on disj"))
>          )
>      ;
> -        Goal = switch_rep(Arms),
> +        Goal = switch_rep(_SwitchVar, Cases),
>          (
>              Contour = [_ - ContourHeadNode | ContourTail],
>              ContourHeadNode = node_switch(_, Label),
> @@ -1266,7 +1264,8 @@
>              list.append(Path, PathTail, ArmPath),
>              PathTail = [step_switch(N, _)]
>          ->
> -            list.index1_det(Arms, N, Arm),
> +            list.index1_det(Cases, N, Case),
> +            Case = case_rep(_ConsId, _ConsIdArity, Arm),
>              ArmAndPath = goal_and_path(Arm, ArmPath),
>              MaybePrims = make_primitive_list(Store, [ArmAndPath |  
> GoalPaths],
>                  ContourTail, MaybeEnd, ArgNum, TotalArgs,  
> HeadVars, AllTraced,
> @@ -1526,14 +1525,15 @@
>      ).
>
>  :- pred traverse_primitives(list(annotated_primitive(R))::in,
> -    var_rep::in, term_path::in, S::in, proc_rep::in,
> +    var_rep::in, term_path::in, S::in, proc_defn_rep::in,
>      subterm_origin(edt_node(R))::out) is det <= annotated_trace(S,  
> R).
>
> -traverse_primitives([], Var0, TermPath0, _, ProcRep, Origin) :-
> -    ProcRep = proc_rep(HeadVars, _),
> +traverse_primitives([], Var0, TermPath0, _, ProcDefnRep, Origin) :-
> +    ProcDefnRep = proc_defn_rep(HeadVars, _),
>      ArgPos = find_arg_pos(HeadVars, Var0),
>      Origin = origin_input(ArgPos, TermPath0).
> -traverse_primitives([Prim | Prims], Var0, TermPath0, Store,  
> ProcRep, Origin) :-
> +traverse_primitives([Prim | Prims], Var0, TermPath0, Store,  
> ProcDefnRep,
> +        Origin) :-
>      Prim = primitive(File, Line, BoundVars, AtomicGoal, _GoalPath,
>          MaybeNodeId),
>      (
> @@ -1545,23 +1545,25 @@
>              ;
>                  TermPath0 = [TermPathStep0 | TermPath],
>                  list.index1_det(FieldVars, TermPathStep0, Var),
> -                traverse_primitives(Prims, Var, TermPath, Store,  
> ProcRep,
> +                traverse_primitives(Prims, Var, TermPath, Store,  
> ProcDefnRep,
>                      Origin)
>              )
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = unify_deconstruct_rep(CellVar, _Cons,  
> FieldVars),
>          ( list.member(Var0, BoundVars) ->
>              ( list.nth_member_search(FieldVars, Var0, Pos) ->
>                  traverse_primitives(Prims, CellVar, [Pos |  
> TermPath0],
> -                    Store, ProcRep, Origin)
> +                    Store, ProcDefnRep, Origin)
>              ;
>                  throw(internal_error("traverse_primitives", "bad  
> deconstruct"))
>              )
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = partial_deconstruct_rep(_, _, MaybeFieldVars),
> @@ -1574,17 +1576,18 @@
>                  MaybeVar = yes(Var),
>                  % This partial deconstruction bound the  
> TermPathStep0'th
>                  % argument of Var0.
> -                traverse_primitives(Prims, Var, TermPath, Store,  
> ProcRep,
> +                traverse_primitives(Prims, Var, TermPath, Store,  
> ProcDefnRep,
>                      Origin)
>              ;
>                  MaybeVar = no,
>                  % This partial deconstruction did not bind the  
> TermPathStep0'th
>                  % argument, so continue looking for the  
> unification which did.
> -                traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep,
> +                traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
>                      Origin)
>              )
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = partial_construct_rep(_, _, MaybeFieldVars),
> @@ -1601,8 +1604,8 @@
>                      MaybeVar = yes(Var),
>                      % The partial construction bound the  
> TermPathStep0'th
>                      % argument of Var0.
> -                    traverse_primitives(Prims, Var, TermPath,  
> Store, ProcRep,
> -                        Origin)
> +                    traverse_primitives(Prims, Var, TermPath, Store,
> +                        ProcDefnRep, Origin)
>                  ;
>                      MaybeVar = no,
>                      % We got to the construction which bound the  
> outermost
> @@ -1614,7 +1617,8 @@
>                  )
>              )
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = unify_assign_rep(ToVar, FromVar),
> @@ -1622,10 +1626,11 @@
>          ( list.member(Var0, BoundVars) ->
>              decl_require(unify(Var0, ToVar), "traverse_primitives",
>                  "bad assign"),
> -            traverse_primitives(Prims, FromVar, TermPath0, Store,  
> ProcRep,
> +            traverse_primitives(Prims, FromVar, TermPath0, Store,  
> ProcDefnRep,
>                  Origin)
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = cast_rep(ToVar, FromVar),
> @@ -1633,58 +1638,63 @@
>          ( list.member(Var0, BoundVars) ->
>              decl_require(unify(Var0, ToVar), "traverse_primitives",
>                  "bad unsafe_cast"),
> -            traverse_primitives(Prims, FromVar, TermPath0, Store,  
> ProcRep,
> +            traverse_primitives(Prims, FromVar, TermPath0, Store,  
> ProcDefnRep,
>                  Origin)
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = pragma_foreign_code_rep(_Args),
>          ( list.member(Var0, BoundVars) ->
>              Origin = origin_primitive_op(File, Line,  
> primop_foreign_proc)
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = unify_simple_test_rep(_LVar, _RVar),
>          ( list.member(Var0, BoundVars) ->
>              throw(internal_error("traverse_primitives", "bad test"))
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = higher_order_call_rep(_, Args),
>          traverse_call(BoundVars, File, Line, Args, MaybeNodeId,  
> Prims,
> -            Var0, TermPath0, Store, ProcRep, Origin)
> +            Var0, TermPath0, Store, ProcDefnRep, Origin)
>      ;
>          AtomicGoal = method_call_rep(_, _, Args),
>          traverse_call(BoundVars, File, Line, Args, MaybeNodeId,  
> Prims,
> -            Var0, TermPath0, Store, ProcRep, Origin)
> +            Var0, TermPath0, Store, ProcDefnRep, Origin)
>      ;
>          AtomicGoal = plain_call_rep(Module, Name, Args),
>          (
>              list.member(Var0, BoundVars),
>              plain_call_is_special_case(Module, Name, Args, NewVar)
>          ->
> -            traverse_primitives(Prims, NewVar, TermPath0, Store,  
> ProcRep,
> +            traverse_primitives(Prims, NewVar, TermPath0, Store,  
> ProcDefnRep,
>                  Origin)
>          ;
>              traverse_call(BoundVars, File, Line, Args, MaybeNodeId,
> -                Prims, Var0, TermPath0, Store, ProcRep, Origin)
> +                Prims, Var0, TermPath0, Store, ProcDefnRep, Origin)
>          )
>      ;
>          AtomicGoal = builtin_call_rep(_, _, _),
>          ( list.member(Var0, BoundVars) ->
>              Origin = origin_primitive_op(File, Line,  
> primop_builtin_call)
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ;
>          AtomicGoal = event_call_rep(_, _),
>          ( list.member(Var0, BoundVars) ->
>              throw(internal_error("traverse_primitives", "bad event"))
>          ;
> -            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcRep, Origin)
> +            traverse_primitives(Prims, Var0, TermPath0, Store,  
> ProcDefnRep,
> +                Origin)
>          )
>      ).
>
> @@ -1713,11 +1723,11 @@
>
>  :- pred traverse_call(list(var_rep)::in, string::in, int::in,
>      list(var_rep)::in, maybe(R)::in, list(annotated_primitive 
> (R))::in,
> -    var_rep::in, term_path::in, S::in, proc_rep::in,
> +    var_rep::in, term_path::in, S::in, proc_defn_rep::in,
>      subterm_origin(edt_node(R))::out) is det <= annotated_trace(S,  
> R).
>
>  traverse_call(BoundVars, File, Line, Args, MaybeNodeId,
> -        Prims, Var, TermPath, Store, ProcRep, Origin) :-
> +        Prims, Var, TermPath, Store, ProcDefnRep, Origin) :-
>      ( list.member(Var, BoundVars) ->
>          Pos = find_arg_pos(Args, Var),
>          (
> @@ -1728,7 +1738,7 @@
>              Origin = origin_primitive_op(File, Line,  
> primop_untraced_call)
>          )
>      ;
> -        traverse_primitives(Prims, Var, TermPath, Store, ProcRep,  
> Origin)
> +        traverse_primitives(Prims, Var, TermPath, Store,  
> ProcDefnRep, Origin)
>      ).
>
>   
> %--------------------------------------------------------------------- 
> --------%
> cvs diff: Diffing bytecode
> cvs diff: Diffing compiler

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20070911/b9f8d6db/attachment.sig>


More information about the reviews mailing list