[m-dev.] for review: transitive optimization and `:- pragma type_spec'

Simon Taylor stayl at cs.mu.OZ.AU
Thu Oct 14 14:33:50 AEST 1999



Estimated hours taken: 0.1

compiler/trans_opt.m:
	Don't write `:- pragma termination_info' declarations for
	procedures created for `:- pragma type_spec' declarations.
	These should be allowed, but the predicate declaration for
	the specialized predicate is not produced before the
	termination pragmas are read in, resulting in an undefined
	predicate error.

Index: compiler/trans_opt.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/trans_opt.m,v
retrieving revision 1.12
diff -u -u -r1.12 trans_opt.m
--- trans_opt.m	1998/06/29 09:21:53	1.12
+++ trans_opt.m	1999/10/12 01:32:08
@@ -74,7 +74,7 @@
 :- import_module prog_io, globals, code_util.
 :- import_module passes_aux, prog_out, options, termination.
 
-:- import_module string, list, map, varset, term, std_util.
+:- import_module set, string, list, map, varset, term, std_util.
 
 %-----------------------------------------------------------------------------%
 
@@ -127,14 +127,21 @@
 	io__state, io__state).
 :- mode trans_opt__write_preds(in, in, di, uo) is det.
 trans_opt__write_preds([], _) --> [].
-trans_opt__write_preds([ PredId | PredIds ], Module) -->
+trans_opt__write_preds([PredId | PredIds], Module) -->
 	{ module_info_preds(Module, PredTable) },
+	{ module_info_type_spec_info(Module, TypeSpecInfo) },
+	{ TypeSpecInfo = type_spec_info(_, TypeSpecForcePreds, _, _) },
 	{ map__lookup(PredTable, PredId, PredInfo) },
 
 	( 	
 		{ pred_info_is_exported(PredInfo) },
 		\+ { code_util__predinfo_is_builtin(PredInfo) },
-		\+ { code_util__compiler_generated(PredInfo) }
+		\+ { code_util__compiler_generated(PredInfo) },
+		% XXX These should be allowed, but the predicate
+		% declaration for the specialized predicate is not produced 
+		% before the termination pragmas are read in, resulting
+		% in an undefined predicate error.
+		\+ { set__member(PredId, TypeSpecForcePreds) }
 	->
 		% All predicates to write predicate info into the .trans_opt 
 		% file should go here.
--------------------------------------------------------------------------
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