[m-rev.] diff: fix smart recompilation bug

Simon Taylor stayl at cs.mu.OZ.AU
Mon Mar 11 01:56:40 AEDT 2002


Estimated hours taken: 0.5
Branches: main

compiler/recompilation_version.m:
	Fix a bug in the handling of the arities of pragmas
	for functions which caused recompilations to be missed.

tests/recompilation/change_func*:
	Test case.

Index: compiler/recompilation_version.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/recompilation_version.m,v
retrieving revision 1.14
diff -u -u -r1.14 recompilation_version.m
--- compiler/recompilation_version.m	7 Mar 2002 08:30:17 -0000	1.14
+++ compiler/recompilation_version.m	10 Mar 2002 13:31:53 -0000
@@ -158,7 +158,6 @@
 	AddIfNotExisting = no,
 	(
 		MaybePredOrFunc = yes(PredOrFunc),
-
 		ItemType = pred_or_func_to_item_type(PredOrFunc),
 		recompilation_version__add_gathered_item(Item,
 			item_id(ItemType, SymName - Arity),
@@ -166,15 +165,12 @@
 			GatheredItems0, GatheredItems2)
 	;
 		MaybePredOrFunc = no,
-
 		recompilation_version__add_gathered_item(Item,
 			item_id(predicate, SymName - Arity),
 			ItemContext, AddIfNotExisting,
 			GatheredItems0, GatheredItems1),
-
-		adjust_func_arity(function, Arity, FuncArity),
 		recompilation_version__add_gathered_item(Item,
-			item_id(function, SymName - FuncArity),
+			item_id(function, SymName - Arity),
 			ItemContext, AddIfNotExisting,
 			GatheredItems1, GatheredItems2)
 	),
Index: tests/recompilation//change_func_r.err_exp.2
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/change_func_r.err_exp.2,v
retrieving revision 1.1
diff -u -u -r1.1 change_func_r.err_exp.2
--- tests/recompilation//change_func_r.err_exp.2	5 Nov 2001 09:40:03 -0000	1.1
+++ tests/recompilation//change_func_r.err_exp.2	10 Mar 2002 12:23:42 -0000
@@ -1,2 +1,4 @@
 Recompiling module `change_func_r':
   function `change_func_r_2:changed_func/1' was modified.
+Recompiling module `change_func_r':
+  function `change_func_r_2:changed_func_2/1' was modified.
Index: tests/recompilation//change_func_r.exp.1
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/change_func_r.exp.1,v
retrieving revision 1.1
diff -u -u -r1.1 change_func_r.exp.1
--- tests/recompilation//change_func_r.exp.1	5 Nov 2001 09:40:03 -0000	1.1
+++ tests/recompilation//change_func_r.exp.1	10 Mar 2002 12:17:42 -0000
@@ -1 +1,2 @@
 OK
+OK
Index: tests/recompilation//change_func_r.exp.2
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/change_func_r.exp.2,v
retrieving revision 1.1
diff -u -u -r1.1 change_func_r.exp.2
--- tests/recompilation//change_func_r.exp.2	5 Nov 2001 09:40:03 -0000	1.1
+++ tests/recompilation//change_func_r.exp.2	10 Mar 2002 12:18:34 -0000
@@ -1 +1,2 @@
 OK
+OK
Index: tests/recompilation//change_func_r.m.1
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/change_func_r.m.1,v
retrieving revision 1.1
diff -u -u -r1.1 change_func_r.m.1
--- tests/recompilation//change_func_r.m.1	5 Nov 2001 09:40:03 -0000	1.1
+++ tests/recompilation//change_func_r.m.1	10 Mar 2002 12:17:35 -0000
@@ -15,5 +15,6 @@
 		io__write_string(Str)
 	;
 		io__write_string("failed\n")
-	).
+	),
+	io__write_string(changed_func_2("OK\n")).
 
Index: tests/recompilation//change_func_r_2.m.1
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/change_func_r_2.m.1,v
retrieving revision 1.1
diff -u -u -r1.1 change_func_r_2.m.1
--- tests/recompilation//change_func_r_2.m.1	5 Nov 2001 09:40:03 -0000	1.1
+++ tests/recompilation//change_func_r_2.m.1	10 Mar 2002 12:03:33 -0000
@@ -4,6 +4,11 @@
 
 :- func changed_func(string) = string is det.
 
+:- func changed_func_2(string) = string is det.
+
 :- implementation.
 
 changed_func(X) = X.
+
+changed_func_2(X) = X.
+
Index: tests/recompilation//change_func_r_2.m.2
===================================================================
RCS file: /home/mercury1/repository/tests/recompilation/change_func_r_2.m.2,v
retrieving revision 1.1
diff -u -u -r1.1 change_func_r_2.m.2
--- tests/recompilation//change_func_r_2.m.2	5 Nov 2001 09:40:03 -0000	1.1
+++ tests/recompilation//change_func_r_2.m.2	10 Mar 2002 12:05:43 -0000
@@ -4,9 +4,14 @@
 
 :- func changed_func(string) = string is semidet.
 
+:- func changed_func_2(string) = string is det.
+:- pragma terminates(changed_func_2/1).
+
 :- implementation.
 
 :- import_module std_util.
 
 changed_func(X) = X :-
 	semidet_succeed.
+
+changed_func_2(X) = X.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list