[m-rev.] for review: fix bug #67

Peter Wang novalazy at gmail.com
Thu Jul 15 12:10:50 AEST 2010


An alternative fix would be to modify mprof to ignore those entries.
---

Branches: main, 10.04

Fix bug #67.

runtime/mercury_prof.c:
        Don't write out entries for do_call_closure_* and
        do_call_class_method_* into Prof.Decl.  These produce duplicates which
        causes mprof when trying to read it in, yet are ignored for profiling
        anyway.

diff --git a/runtime/mercury_prof.c b/runtime/mercury_prof.c
index d64d94b..d63eb65 100644
--- a/runtime/mercury_prof.c
+++ b/runtime/mercury_prof.c
@@ -292,6 +292,19 @@ print_addr_pair_node(FILE *fptr, prof_call_node *node)
 void
 MR_prof_output_addr_decl(const char *name, const MR_Code *address)
 {
+    const char  ignore1[] = "mercury__do_call_closure_";
+    const char  ignore2[] = "mercury__do_call_class_method_";
+
+    /*
+    ** Don't output labels for do_call_closure_* and do_call_class_method_*
+    ** as they are ignored for profiling, and the duplicates confuse mprof.
+    */
+    if (MR_strneq(name, ignore1, sizeof(ignore1) - 1) ||
+        MR_strneq(name, ignore2, sizeof(ignore2) - 1))
+    {
+        return;
+    }
+
     if (!MR_prof_decl_fptr) {
         MR_prof_decl_fptr = MR_checked_fopen("Prof.Decl", "create", "w");
     }

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