[m-rev.] diff: fix off-by-one error in hlc profiles
Julien Fischer
juliensf at csse.unimelb.edu.au
Mon May 21 18:03:25 AEST 2007
(This is still bootchecking.)
Estimated hours taken: 1
Branches: main
When converting an mlds_user_pred_label into a C identifier, subtract one
from the arity if the mlds_user_pred_label corresponds to a Mercury
function.
This fixes a problem with mprof in the high-level C profiling grades where
the arity of functions was off-by-one.
compiler/mlds_to_c.m:
Make the above fix.
Julien.
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.214
diff -u -r1.214 mlds_to_c.m
--- compiler/mlds_to_c.m 7 May 2007 05:21:33 -0000 1.214
+++ compiler/mlds_to_c.m 21 May 2007 07:56:48 -0000
@@ -1970,9 +1970,15 @@
:- pred mlds_output_pred_label(mlds_pred_label::in, io::di, io::uo) is det.
mlds_output_pred_label(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule,
- Name, Arity, _CodeModel, _NonOutputFunc), !IO) :-
- ( PredOrFunc = pf_predicate, Suffix = "p"
- ; PredOrFunc = pf_function, Suffix = "f"
+ Name, Arity0, _CodeModel, _NonOutputFunc), !IO) :-
+ (
+ PredOrFunc = pf_predicate,
+ Suffix = "p",
+ Arity = Arity0
+ ;
+ PredOrFunc = pf_function,
+ Suffix = "f",
+ Arity = Arity0 - 1
),
MangledName = name_mangle(Name),
io.format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)], !IO),
@@ -2006,9 +2012,15 @@
:- func mlds_pred_label_to_string(mlds_pred_label) = string.
mlds_pred_label_to_string(mlds_user_pred_label(PredOrFunc, MaybeDefiningModule,
- Name, Arity, _CodeModel, _NonOutputFunc)) = Str :-
- ( PredOrFunc = pf_predicate, Suffix = "p"
- ; PredOrFunc = pf_function, Suffix = "f"
+ Name, Arity0, _CodeModel, _NonOutputFunc)) = Str :-
+ (
+ PredOrFunc = pf_predicate,
+ Suffix = "p",
+ Arity = Arity0
+ ;
+ PredOrFunc = pf_function,
+ Suffix = "f",
+ Arity = Arity0 - 1
),
MangledName = name_mangle(Name),
MainStr = string.format("%s_%d_%s", [s(MangledName), i(Arity), s(Suffix)]),
--------------------------------------------------------------------------
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