[m-dev.] [reuse] diff: fix problem in profile grades

Peter Ross peter.ross at miscrit.be
Fri Mar 9 23:50:22 AEDT 2001


Hi,


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


Estimated hours taken: 1
Branches: reuse

This change avoids generating MR_init_entry() calls for procedures which
don't have a body.

compiler/ml_util.m:
    Rename defn_is_function to defn_is_function_with_body, and add the
    constraint that the function must also have a body.

compiler/mlds_to_c.m:
    Change to using defn_is_function_with_body when determining which
    procedures need a call to MR_init_entry generated for them.

Index: compiler/ml_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_util.m,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 ml_util.m
--- compiler/ml_util.m	2001/02/20 10:15:28	1.1.2.3
+++ compiler/ml_util.m	2001/03/09 12:40:07
@@ -62,9 +62,10 @@
 :- pred defn_is_type(mlds__defn).
 :- mode defn_is_type(in) is semidet.
 
-	% Succeeds iff this definition is a function definition.
-:- pred defn_is_function(mlds__defn).
-:- mode defn_is_function(in) is semidet.
+	% Succeeds iff this definition is a function definition, which
+	% has a body defined for it.
+:- pred defn_is_function_with_body(mlds__defn).
+:- mode defn_is_function_with_body(in) is semidet.
 
 	% Succeeds iff this definition is a data definition which
 	% defines a type_ctor_info constant.
@@ -267,8 +268,9 @@
 	Defn = mlds__defn(Name, _Context, _Flags, _Body),
 	Name = type(_, _).
 
-defn_is_function(Defn) :-
-	Defn = mlds__defn(Name, _Context, _Flags, _Body),
+defn_is_function_with_body(Defn) :-
+	Defn = mlds__defn(Name, _Context, _Flags, Body),
+	Body = function(_, _, yes(_)),
 	Name = function(_, _, _, _).
 
 defn_is_type_ctor_info(Defn) :-
Index: compiler/mlds_to_c.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_c.m,v
retrieving revision 1.55.2.6
diff -u -r1.55.2.6 mlds_to_c.m
--- compiler/mlds_to_c.m	2001/03/05 12:05:55	1.55.2.6
+++ compiler/mlds_to_c.m	2001/03/09 12:40:10
@@ -224,7 +224,7 @@
 	{ list__filter(defn_is_type, PrivateDefns, PrivateTypeDefns,
 		PrivateNonTypeDefns) },
 	{ list__filter(defn_is_type, Defns, _TypeDefns, NonTypeDefns) },
-	{ list__filter(defn_is_function, NonTypeDefns, FuncDefns) },
+	{ list__filter(defn_is_function_with_body, NonTypeDefns, FuncDefns) },
 	{ list__filter(defn_is_type_ctor_info, NonTypeDefns,
 		TypeCtorInfoDefns) },
 	{ MLDS_ModuleName = mercury_module_name_to_mlds(ModuleName) },
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list