[m-rev.] diff: fix recompilation test case failure

Simon Taylor stayl at cs.mu.OZ.AU
Sat Jul 7 19:05:58 AEST 2001



Estimated hours taken: 0.5

I didn't quite get this change right last time.

Avoid differing recompilation output for
tests/recompilation/pragma_type_spec_r in
debugging grades.

compiler/make_hlds.m:
	Record equivalence types used by `:- pragma type_spec'
	declarations for imported predicates even if type
	specialization is not being performed.


Index: make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.374
diff -u -u -r1.374 make_hlds.m
--- make_hlds.m	2001/07/05 09:16:43	1.374
+++ make_hlds.m	2001/07/07 08:51:40
@@ -931,22 +931,22 @@
 		ModuleInfo1, ModuleInfo2),
 	    globals__io_lookup_bool_option(user_guided_type_specialization,
 	    	DoTypeSpec),
-
-	    { pred_info_is_imported(PredInfo0) ->
-		Status = opt_imported
-	    ;
-		pred_info_import_status(PredInfo0, Status)
-	    },
-	    { pred_info_get_is_pred_or_func(PredInfo0, PredOrFunc) },
-
+	    globals__io_lookup_bool_option(smart_recompilation, Smart),
 	    {
 		ModesOk = yes,
 		% Even if we aren't doing type specialization, we need
 		% to create the interface procedures for local predicates
 		% to check the type-class correctness of the requested
 		% specializations.
+		%
+		% If we're doing smart recompilation we need to record the
+		% pragmas even if we aren't doing type specialization to
+		% avoid problems with differing output for the recompilation
+		% tests in debugging grades.
+		%
 		( DoTypeSpec = yes
 	    	; \+ pred_info_is_imported(PredInfo0)
+		; Smart = yes
 	    	)
 	    ->
 		%
@@ -954,6 +954,7 @@
 		% specified types to force the specialization. For imported
 		% predicates this forces the creation of the proper interface. 
 		%
+		pred_info_get_is_pred_or_func(PredInfo0, PredOrFunc),
 		adjust_func_arity(PredOrFunc, Arity, PredArity),
 		varset__init(ArgVarSet0),
 		make_n_fresh_vars("HeadVar__", PredArity,
@@ -989,6 +990,12 @@
 		pred_info_get_markers(PredInfo0, Markers),
 		map__init(Proofs),
 
+		( pred_info_is_imported(PredInfo0) ->
+			Status = opt_imported
+		;
+			pred_info_import_status(PredInfo0, Status)
+		),
+
 		pred_info_module(PredInfo0, ModuleName),
 		pred_info_get_aditi_owner(PredInfo0, Owner),
 		pred_info_init(ModuleName, SpecName, PredArity, TVarSet,
@@ -1033,25 +1040,20 @@
 			ForceVersions, SpecMap, PragmaMap),
 		module_info_set_type_spec_info(ModuleInfo3,
 			TypeSpecInfo, ModuleInfo),
-		TransformInfo1 = transform_info(ModuleInfo, Info0)
-	    ;
-		TransformInfo1 = transform_info(ModuleInfo2, Info0)
-	    },
-	    { ModesOk = yes, status_is_imported(Status, yes) ->
-		%
-		% This isn't strictly necessary if we aren't doing
-		% user-guided type specialization, but it isn't very
-		% expensive and it avoids problems with differing output
-		% for the recompilation tests in debugging grades.
-		%
-		ItemType = pred_or_func_to_item_type(PredOrFunc),
-		apply_to_recompilation_info(
+
+		TransformInfo1 = transform_info(ModuleInfo, Info0),
+		( status_is_imported(Status, yes) ->
+		    ItemType = pred_or_func_to_item_type(PredOrFunc),
+		    apply_to_recompilation_info(
 			recompilation__record_used_equivalence_types(
 				item_id(ItemType, SymName - Arity), 
 				UsedEquivTypes),
 			TransformInfo1, TransformInfo)
+		;
+		    TransformInfo = TransformInfo1
+		)
 	    ;
-	    	TransformInfo = TransformInfo1
+		TransformInfo = transform_info(ModuleInfo2, Info0)
 	    }
 	;
 	    { TransformInfo = transform_info(ModuleInfo1, Info0) }
--------------------------------------------------------------------------
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