[m-rev.] diff: ambiguities in deep_profiler

Zoltan Somogyi zs at csse.unimelb.edu.au
Fri Sep 29 16:14:54 AEST 2006


deep_profiler/*.m:
	Rename some function symbols to avoid ambiguities.

Zoltan.

cvs diff: Diffing .
Index: callgraph.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/callgraph.m,v
retrieving revision 1.8
diff -u -b -r1.8 callgraph.m
--- callgraph.m	9 Mar 2006 04:56:39 -0000	1.8
+++ callgraph.m	27 Sep 2006 04:41:51 -0000
@@ -103,10 +103,10 @@
 
 add_call_site_arcs(InitDeep, FromPDI, CallSiteSlot, !Graph) :-
     (
-        CallSiteSlot = normal(CSDPtr),
+        CallSiteSlot = slot_normal(CSDPtr),
         add_csd_arcs(InitDeep, FromPDI, CSDPtr, !Graph)
     ;
-        CallSiteSlot = multi(_, CSDPtrArray),
+        CallSiteSlot = slot_multi(_, CSDPtrArray),
         array.to_list(CSDPtrArray, CSDPtrs),
         list.foldl(add_csd_arcs(InitDeep, FromPDI), CSDPtrs, !Graph)
     ).
Index: canonical.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/canonical.m,v
retrieving revision 1.10
diff -u -b -r1.10 canonical.m
--- canonical.m	29 Mar 2006 08:07:40 -0000	1.10
+++ canonical.m	27 Sep 2006 04:43:06 -0000
@@ -183,7 +183,7 @@
         array.lookup(PSSites, SlotNum, CSSPtr),
         lookup_call_site_statics(InitDeep ^ init_call_site_statics,
             CSSPtr, CSS),
-        ( CSS ^ css_kind = normal_call(_, _) ->
+        ( CSS ^ css_kind = normal_call_and_callee(_, _) ->
             lookup_normal_sites(PDSites, SlotNum, CSDPtrs)
         ;
             lookup_multi_sites(PDSites, SlotNum, CSDPtrLists),
@@ -273,15 +273,15 @@
     ( SlotNum >= 0 ->
         array.lookup(PrimeSiteArray0, SlotNum, PrimeSite0),
         (
-            PrimeSite0 = normal(PrimeCSDPtr0),
+            PrimeSite0 = slot_normal(PrimeCSDPtr0),
             merge_proc_dynamic_normal_slot(MergeInfo, SlotNum,
                 Clique, PrimePDPtr, PrimeCSDPtr0,
                 RestSiteArrays, PrimeCSDPtr,
                 !InitDeep, !Redirect),
             array.set(PrimeSiteArray0, SlotNum,
-                normal(PrimeCSDPtr), PrimeSiteArray1)
+                slot_normal(PrimeCSDPtr), PrimeSiteArray1)
         ;
-            PrimeSite0 = multi(IsZeroed, PrimeCSDPtrArray0),
+            PrimeSite0 = slot_multi(IsZeroed, PrimeCSDPtrArray0),
             array.to_list(PrimeCSDPtrArray0, PrimeCSDPtrList0),
             merge_proc_dynamic_multi_slot(MergeInfo, SlotNum,
                 Clique, PrimePDPtr, PrimeCSDPtrList0,
@@ -289,7 +289,7 @@
                 !InitDeep, !Redirect),
             PrimeCSDPtrArray = array(PrimeCSDPtrList),
             array.set(PrimeSiteArray0, SlotNum,
-                multi(IsZeroed, PrimeCSDPtrArray),
+                slot_multi(IsZeroed, PrimeCSDPtrArray),
                 PrimeSiteArray1)
         ),
         merge_proc_dynamic_slots(MergeInfo, SlotNum - 1, Clique,
@@ -487,10 +487,10 @@
 lookup_normal_sites([RestArray | RestArrays], SlotNum, [CSDPtr | CSDPtrs]) :-
     array.lookup(RestArray, SlotNum, Slot),
     (
-        Slot = normal(CSDPtr)
+        Slot = slot_normal(CSDPtr)
     ;
-        Slot = multi(_, _),
-        error("lookup_normal_sites: found multi")
+        Slot = slot_multi(_, _),
+        error("lookup_normal_sites: found slot_multi")
     ),
     lookup_normal_sites(RestArrays, SlotNum, CSDPtrs).
 
@@ -501,10 +501,10 @@
 lookup_multi_sites([RestArray | RestArrays], SlotNum, [CSDList | CSDLists]) :-
     array.lookup(RestArray, SlotNum, Slot),
     (
-        Slot = normal(_),
+        Slot = slot_normal(_),
         error("lookup_multi_sites: found normal")
     ;
-        Slot = multi(_, CSDArray),
+        Slot = slot_multi(_, CSDArray),
         array.to_list(CSDArray, CSDList)
     ),
     lookup_multi_sites(RestArrays, SlotNum, CSDLists).
@@ -762,9 +762,10 @@
 :- pred subst_in_slot(redirect::in, call_site_array_slot::in,
     call_site_array_slot::out) is det.
 
-subst_in_slot(Redirect, normal(CSDPtr0), normal(CSDPtr)) :-
+subst_in_slot(Redirect, slot_normal(CSDPtr0), slot_normal(CSDPtr)) :-
     lookup_csd_redirect(Redirect ^ csd_redirect, CSDPtr0, CSDPtr).
-subst_in_slot(Redirect, multi(IsZeroed, CSDPtrs0), multi(IsZeroed, CSDPtrs)) :-
+subst_in_slot(Redirect, slot_multi(IsZeroed, CSDPtrs0),
+        slot_multi(IsZeroed, CSDPtrs)) :-
     array.map(lookup_csd_redirect(Redirect ^ csd_redirect),
         u(CSDPtrs0), CSDPtrs).
 
@@ -925,15 +926,15 @@
     ( Cur =< Max ->
         array.lookup(!.Sites, Cur, Slot0),
         (
-            Slot0 = normal(CSDPtr0),
+            Slot0 = slot_normal(CSDPtr0),
             concat_call_site_dynamic_ptr(PrevMaxCSD, CSDPtr0, CSDPtr),
-            Slot = normal(CSDPtr)
+            Slot = slot_normal(CSDPtr)
         ;
-            Slot0 = multi(IsZeroed, CSDPtrs0),
+            Slot0 = slot_multi(IsZeroed, CSDPtrs0),
             array_map_from_0(
                 concat_call_site_dynamic_ptr(PrevMaxCSD),
                 u(CSDPtrs0), CSDPtrs),
-            Slot = multi(IsZeroed, CSDPtrs)
+            Slot = slot_multi(IsZeroed, CSDPtrs)
         ),
         svarray.set(Cur, Slot, !Sites),
         concatenate_profile_slots(Cur + 1, Max, PrevMaxCSD, PrevMaxPD,
Index: dump.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/dump.m,v
retrieving revision 1.4
diff -u -b -r1.4 dump.m
--- dump.m	9 Mar 2006 04:56:39 -0000	1.4
+++ dump.m	27 Sep 2006 04:43:41 -0000
@@ -265,9 +265,9 @@
 
 :- func call_site_array_slot_to_string(call_site_array_slot) = string.
 
-call_site_array_slot_to_string(normal(call_site_dynamic_ptr(CSDI))) =
+call_site_array_slot_to_string(slot_normal(call_site_dynamic_ptr(CSDI))) =
     string.format("normal(csd%d)", [i(CSDI)]).
-call_site_array_slot_to_string(multi(_, _)) = "multi".
+call_site_array_slot_to_string(slot_multi(_, _)) = "multi".
 
 %----------------------------------------------------------------------------%
 
@@ -400,16 +400,16 @@
 :- pred dump_call_site_kind_and_callee(call_site_kind_and_callee::in,
     io::di, io::uo) is det.
 
-dump_call_site_kind_and_callee(normal_call(Ptr, String), !IO) :-
+dump_call_site_kind_and_callee(normal_call_and_callee(Ptr, String), !IO) :-
     Ptr = proc_static_ptr(Val),
     io.format("normal_call(%d, \"%s\")", [i(Val), s(String)], !IO).
-dump_call_site_kind_and_callee(special_call, !IO) :-
+dump_call_site_kind_and_callee(special_call_and_no_callee, !IO) :-
     io.write_string("special_call", !IO).
-dump_call_site_kind_and_callee(higher_order_call, !IO) :-
+dump_call_site_kind_and_callee(higher_order_call_and_no_callee, !IO) :-
     io.write_string("higher_order_call", !IO).
-dump_call_site_kind_and_callee(method_call, !IO) :-
+dump_call_site_kind_and_callee(method_call_and_no_callee, !IO) :-
     io.write_string("method_call", !IO).
-dump_call_site_kind_and_callee(callback, !IO) :-
+dump_call_site_kind_and_callee(callback_and_no_callee, !IO) :-
     io.write_string("callback", !IO).
 
 %----------------------------------------------------------------------------%
Index: profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/profile.m,v
retrieving revision 1.12
diff -u -b -r1.12 profile.m
--- profile.m	26 Sep 2006 04:19:34 -0000	1.12
+++ profile.m	27 Sep 2006 04:38:53 -0000
@@ -202,8 +202,7 @@
                 user_arity        :: int,
                 user_mode         :: int
             )
-    ;
-            uci_pred(
+    ;       uci_pred(
                 uci_type_name   :: string,
                 uci_type_module :: string,
                 uci_def_module  :: string,
@@ -213,8 +212,8 @@
             ).
 
 :- type call_site_array_slot
-    --->    normal(call_site_dynamic_ptr)
-    ;       multi(is_zeroed, array(call_site_dynamic_ptr)).
+    --->    slot_normal(call_site_dynamic_ptr)
+    ;       slot_multi(is_zeroed, array(call_site_dynamic_ptr)).
 
 :- type is_zeroed
     --->    zeroed
@@ -228,11 +227,11 @@
     ;       callback.
 
 :- type call_site_kind_and_callee
-    --->    normal_call(proc_static_ptr, string)
-    ;       special_call
-    ;       higher_order_call
-    ;       method_call
-    ;       callback.
+    --->    normal_call_and_callee(proc_static_ptr, string)
+    ;       special_call_and_no_callee
+    ;       higher_order_call_and_no_callee
+    ;       method_call_and_no_callee
+    ;       callback_and_no_callee.
 
 :- type call_site_callees
     --->    call_site_callees(
Index: query.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/query.m,v
retrieving revision 1.12
diff -u -b -r1.12 query.m
--- query.m	29 Mar 2006 08:07:40 -0000	1.12
+++ query.m	27 Sep 2006 04:48:39 -0000
@@ -286,10 +286,10 @@
 
 :- func array_slot_to_html(call_site_array_slot) = string.
 
-array_slot_to_html(normal(CSDPtr)) = HTML :-
+array_slot_to_html(slot_normal(CSDPtr)) = HTML :-
     CSDPtr = call_site_dynamic_ptr(CSDI),
     HTML = "normal " ++ string.int_to_string(CSDI).
-array_slot_to_html(multi(_, CSDPtrArray)) = HTML :-
+array_slot_to_html(slot_multi(_, CSDPtrArray)) = HTML :-
     array.to_list(CSDPtrArray, CSDPtrs),
     list.foldl(append_csdi_to_string, CSDPtrs, "", CSDI_HTML),
     list.length(CSDPtrs, CSDPtrCount),
@@ -308,22 +308,29 @@
 
 :- func kind_and_callee_to_string(call_site_kind_and_callee) = string.
 
-kind_and_callee_to_string(normal_call(proc_static_ptr(PSI), TypeSpec)) =
+kind_and_callee_to_string(normal_call_and_callee(proc_static_ptr(PSI),
+        TypeSpec)) =
     "normal " ++ string.int_to_string(PSI) ++ " " ++ TypeSpec.
-kind_and_callee_to_string(special_call) = "special_call".
-kind_and_callee_to_string(higher_order_call) = "higher_order_call".
-kind_and_callee_to_string(method_call) = "method_call".
-kind_and_callee_to_string(callback) = "callback".
+kind_and_callee_to_string(special_call_and_no_callee) = "special_call".
+kind_and_callee_to_string(higher_order_call_and_no_callee) =
+    "higher_order_call".
+kind_and_callee_to_string(method_call_and_no_callee) = "method_call".
+kind_and_callee_to_string(callback_and_no_callee) = "callback".
 
 %-----------------------------------------------------------------------------%
 
 :- func call_site_kind_and_callee_to_html(call_site_kind_and_callee) = string.
 
-call_site_kind_and_callee_to_html(normal_call(_, _)) = "normal_call".
-call_site_kind_and_callee_to_html(special_call) =      "special_call".
-call_site_kind_and_callee_to_html(higher_order_call) = "higher_order_call".
-call_site_kind_and_callee_to_html(method_call) =       "method_call".
-call_site_kind_and_callee_to_html(callback) =          "callback".
+call_site_kind_and_callee_to_html(normal_call_and_callee(_, _)) =
+    "normal_call".
+call_site_kind_and_callee_to_html(special_call_and_no_callee) =
+    "special_call".
+call_site_kind_and_callee_to_html(higher_order_call_and_no_callee) =
+    "higher_order_call".
+call_site_kind_and_callee_to_html(method_call_and_no_callee) =
+    "method_call".
+call_site_kind_and_callee_to_html(callback_and_no_callee) =
+    "callback".
 
 %-----------------------------------------------------------------------------%
 
@@ -969,8 +976,8 @@
     Pair = CSSPtr - CallSiteArraySlot,
     deep_lookup_call_site_statics(Deep, CSSPtr, CSS),
     Kind = CSS ^ css_kind,
-    ( Kind = normal_call(_CalleePSPtr, _) ->
-        ( CallSiteArraySlot = normal(CSDPtr0) ->
+    ( Kind = normal_call_and_callee(_CalleePSPtr, _) ->
+        ( CallSiteArraySlot = slot_normal(CSDPtr0) ->
             CSDPtr = CSDPtr0
         ;
             error("call_site_clique_to_html: normal_call error")
@@ -978,7 +985,7 @@
         normal_call_site_clique_to_html(Pref, Deep, CallerCliquePtr,
             CSDPtr, LineGroups, Percent, ActionPtrs)
     ;
-        ( CallSiteArraySlot = multi(_, CSDPtrs0) ->
+        ( CallSiteArraySlot = slot_multi(_, CSDPtrs0) ->
             array.to_list(CSDPtrs0, CSDPtrs)
         ;
             error("call_site_clique_to_html: non-normal_call error")
@@ -1086,7 +1093,7 @@
     Kind = CSS ^ css_kind,
     CallerPSPtr = CSS ^ css_container,
     call_site_context(Deep, CSSPtr, FileName, LineNumber),
-    ( Kind = normal_call(CalleePSPtr, _) ->
+    ( Kind = normal_call_and_callee(CalleePSPtr, _) ->
         LineGroup0 = normal_call_site_summary_to_html(Pref, Deep,
             FileName, LineNumber, CallerPSPtr, CalleePSPtr,
             CallSiteCallList)
@@ -1302,9 +1309,9 @@
     ;       callee_clique.
 
 :- type wrap_with_url
-    --->    always
-    ;       if_cross_clique(assume_cross_clique)
-    ;       never.
+    --->    wrap_url_always
+    ;       wrap_url_if_cross_clique(assume_cross_clique)
+    ;       wrap_url_never.
 
 :- type assume_cross_clique
     --->    assume_cross_clique
@@ -1316,18 +1323,20 @@
 :- func downward_summary_display = call_site_display.
 
 ancestor_display =
-    call_site_display(call_context, caller_proc_name, caller_clique, always).
+    call_site_display(call_context, caller_proc_name, caller_clique,
+        wrap_url_always).
 
 upward_display =
-    call_site_display(call_context, caller_proc_name, callee_clique, always).
+    call_site_display(call_context, caller_proc_name, callee_clique,
+        wrap_url_always).
 
 downward_display =
-    call_site_display(call_context, callee_proc_name,
-        callee_clique, if_cross_clique(assume_within_clique)).
+    call_site_display(call_context, callee_proc_name, callee_clique,
+        wrap_url_if_cross_clique(assume_within_clique)).
 
 downward_summary_display =
-    call_site_display(empty_context, callee_proc_name,
-        callee_clique, if_cross_clique(assume_within_clique)).
+    call_site_display(empty_context, callee_proc_name, callee_clique,
+        wrap_url_if_cross_clique(assume_within_clique)).
 
 %-----------------------------------------------------------------------------%
 
@@ -1369,10 +1378,10 @@
         [s(deep_cmd_pref_to_url(Pref, Deep, clique(ChosenCliqueNum))),
         s(escape_html_string(ProcName))]),
     (
-        CallSiteDisplay ^ display_wrap = always,
+        CallSiteDisplay ^ display_wrap = wrap_url_always,
         UsedProcName0 = WrappedProcName
     ;
-        CallSiteDisplay ^ display_wrap = if_cross_clique(Assume),
+        CallSiteDisplay ^ display_wrap = wrap_url_if_cross_clique(Assume),
         (
             MaybeCallerCliquePtr = yes(_),
             ( CallerCliquePtr \= CalleeCliquePtr ->
@@ -1391,7 +1400,7 @@
             )
         )
     ;
-        CallSiteDisplay ^ display_wrap = never,
+        CallSiteDisplay ^ display_wrap = wrap_url_never,
         UsedProcName0 = escape_html_string(ProcName)
     ),
     (
@@ -1459,8 +1468,9 @@
     LinkProc   = "Group callers by procedure",
     LinkModule = "Group callers by module",
     LinkClique = "Group callers by clique",
-    BunchSize = 100,    % Don't display more lines than this,
-                        % to avoid quadratic behaviour in Netscape.
+    % Don't display more lines than BunchSize, to avoid quadratic behaviour
+    % in Netscape.
+    BunchSize = 100,
     (
         CallerGroups = group_by_call_site,
         GroupMap = list.foldl(accumulate_csds_by_call_site(Deep),
Index: read_profile.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/read_profile.m,v
retrieving revision 1.14
diff -u -b -r1.14 read_profile.m
--- read_profile.m	29 Mar 2006 08:07:41 -0000	1.14
+++ read_profile.m	27 Sep 2006 04:49:08 -0000
@@ -150,7 +150,7 @@
         array.init(MaxCSS + 1,
             call_site_static(
                 make_dummy_psptr, -1,
-                normal_call(make_dummy_psptr, ""), -1, ""
+                normal_call_and_callee(make_dummy_psptr, ""), -1, ""
             )),
         array.init(MaxPS + 1,
             proc_static(dummy_proc_id, "", "", "", "", -1, no,
@@ -677,7 +677,7 @@
             (
                 Res2 = ok(CSDI),
                 CSDPtr = make_csdptr(CSDI),
-                Res = ok(normal(CSDPtr))
+                Res = ok(slot_normal(CSDPtr))
                 % DEBUGSITE
                 % io.write_string("normal call_site slot ",
                 %   !IO),
@@ -701,7 +701,7 @@
             (
                 Res2 = ok(CSDIs),
                 CSDPtrs = list.map(make_csdptr, CSDIs),
-                Res = ok(multi(Zeroed, array(CSDPtrs)))
+                Res = ok(slot_multi(Zeroed, array(CSDPtrs)))
                 % DEBUGSITE
                 % io.write_string("multi call_site slots ",
                 %   !IO),
@@ -806,8 +806,8 @@
                 read_string(Res2, !IO),
                 (
                     Res2 = ok(TypeSubst),
-                    Res = ok(normal_call(proc_static_ptr(CalleeProcStatic),
-                        TypeSubst))
+                    Res = ok(normal_call_and_callee(
+                        proc_static_ptr(CalleeProcStatic), TypeSubst))
                 ;
                     Res2 = error(Err),
                     Res = error(Err)
@@ -817,13 +817,13 @@
                 Res = error(Err)
             )
         ; Byte = token_special_call ->
-            Res = ok(special_call)
+            Res = ok(special_call_and_no_callee)
         ; Byte = token_higher_order_call ->
-            Res = ok(higher_order_call)
+            Res = ok(higher_order_call_and_no_callee)
         ; Byte = token_method_call ->
-            Res = ok(method_call)
+            Res = ok(method_call_and_no_callee)
         ; Byte = token_callback ->
-            Res = ok(callback)
+            Res = ok(callback_and_no_callee)
         ;
             format("unexpected call_site_kind %d", [i(Byte)], Msg),
             Res = error(Msg)
Index: startup.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/deep_profiler/startup.m,v
retrieving revision 1.12
diff -u -b -r1.12 startup.m
--- startup.m	29 Mar 2006 08:07:41 -0000	1.12
+++ startup.m	27 Sep 2006 04:47:26 -0000
@@ -457,12 +457,11 @@
         array.lookup(CSDArraySlots, SlotNum, CSDArraySlot),
         array.lookup(CSSPtrs, SlotNum, CSSPtr),
         (
-            CSDArraySlot = normal(CSDPtr),
+            CSDArraySlot = slot_normal(CSDPtr),
             construct_call_site_caller_3(Deep, CSSPtr, -1, CSDPtr,
                 !CallSiteStaticMap)
-
         ;
-            CSDArraySlot = multi(_, CSDPtrs),
+            CSDArraySlot = slot_multi(_, CSDPtrs),
             array_foldl_from_0(construct_call_site_caller_3(Deep, CSSPtr),
                 CSDPtrs, !CallSiteStaticMap)
         ),
@@ -517,12 +516,11 @@
         array.lookup(CSDArraySlots, SlotNum, CSDArraySlot),
         array.lookup(CSSPtrs, SlotNum, CSSPtr),
         (
-            CSDArraySlot = normal(CSDPtr),
+            CSDArraySlot = slot_normal(CSDPtr),
             construct_call_site_calls_3(CallSiteDynamics,
-                ProcDynamics, CSSPtr, -1,
-                CSDPtr, !CallSiteCalls)
+                ProcDynamics, CSSPtr, -1, CSDPtr, !CallSiteCalls)
         ;
-            CSDArraySlot = multi(_, CSDPtrs),
+            CSDArraySlot = slot_multi(_, CSDPtrs),
             array_foldl_from_0(
                 construct_call_site_calls_3(CallSiteDynamics,
                     ProcDynamics, CSSPtr),
@@ -850,7 +848,7 @@
 
 gather_call_site_csdptrs(Slot, CSDPtrs0, CSDPtrs1, IsZeroed0, IsZeroed) :-
     (
-        Slot = normal(CSDPtr),
+        Slot = slot_normal(CSDPtr),
         CSDPtr = call_site_dynamic_ptr(CSDI),
         ( CSDI > 0 ->
             CSDPtrs1 = [[CSDPtr] | CSDPtrs0]
@@ -859,7 +857,7 @@
         ),
         IsZeroed = IsZeroed0
     ;
-        Slot = multi(IsZeroed1, PtrArray),
+        Slot = slot_multi(IsZeroed1, PtrArray),
         array.to_list(PtrArray, PtrList0),
         list.filter((pred(CSDPtr::in) is semidet :-
             CSDPtr = call_site_dynamic_ptr(CSDI),
cvs diff: Diffing notes
--------------------------------------------------------------------------
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