[m-dev.] diff: fix transitive intermodule optimization bug

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 5 01:58:12 AEDT 2001


On 05-Feb-2001, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> I posted that one a moment too soon.  After thinking about the problem
> a bit harder, I realized that the same issue arises with ordinary
> intermodule optimization.  Hence the following changes.

Unfortunately further testing revealed that neither of the previous
two patches work; setting --no-trans-intermod-opt causes problems
because it changes the contents of the `.d' files that we generate,
in particular removing the trans_opt dependencies from them.

And the second patch is not necessary, because mercury_compile.m
already ensures that we don't read in `.opt' files when creating
`.opt' files.

So here's my third try.  Hopefully this one will work ;-)

----------

Estimated hours taken: 2.5

Fix a bug: if `--trans-intermod-opt' was included in MCFLAGS,
then mmake would pass `--make-opt-int --trans-intermod-opt' to
mmc when creating the `.opt' files, and this would cause the
compiler to read the `.trans_opt' files when creating the `.opt'
files.  That's a bug, since the `.opt' files are not supposed to
depend on the `.trans_opt' files.

compiler/mercury_compile.m:
	Make sure that we don't read in the `.trans_opt' files
	when creating the `.opt' file.

Workspace: /home/venus/fjh/ws-venus2/mercury
Index: compiler/mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.190
diff -u -d -r1.190 mercury_compile.m
--- compiler/mercury_compile.m	2001/01/29 01:54:09	1.190
+++ compiler/mercury_compile.m	2001/02/04 14:56:40
@@ -707,11 +707,17 @@
 				[]
 			)
 		)
+	; { MakeOptInt = yes } ->
+		% If we're making the `.opt' file, then we can't
+		% read any `.trans_opt' files, since `.opt' files 
+		% aren't allowed to depend on `.trans_opt' files.
+		{ Imports = Imports1 },
+		{ Error2 = no }
 	;
 		( { TransOpt = yes } ->
 			% If transitive optimization is enabled, but we are
-			% not creating the trans opt file, then import the
-			% trans_opt files for all the modules that are
+			% not creating the .opt or .trans opt file, then import
+			% the trans_opt files for all the modules that are
 			% imported (or used), and for all ancestor modules.
 			{ Imports0 = module_imports(_File, _Module, Ancestors,
 				InterfaceImports, ImplementationImports,

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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