[m-rev.] for review: fix foreign_decls in the LLDS grades

Peter Ross pro at missioncriticalit.com
Wed Aug 7 23:21:06 AEST 2002


On Wed, Aug 07, 2002 at 09:17:34PM +1000, Simon Taylor wrote:
> On 07-Aug-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > On Wed, Aug 07, 2002 at 08:40:54PM +1000, Simon Taylor wrote:
> > > On 07-Aug-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > > > The directory search in this change could be avoided by depending on the
> > > > .mh files, but only if the code in export.m was changed so that we alway
> > > > output a .mh file.
> > > > 
> > > > If that change is prefered, then let me know.
> > > 
> > > I think that would be the better (and simpler) solution.
> > > It would also allow the `.o' files to depend on the `.mh'
> > > file for the imported modules rather than the `.c' file,
> > > which will cause less unnecessary recompilation.
>  
> > Estimated hours taken: 0.5
> > Branches: main
> > 
> > When intermodule optimization is enabled make the .o file depend on all
> > the possible imported .mh files.  This avoids unneccessary recompilation
> > because the .mh files are less likely to change, as well as a directory
> > search for .m files.
> > 
> > compiler/export.m:
> >     Always produce a .mh file because intermodule optimization relies on
> >     it.
> > 
> > compiler/modules.m:
> >     Make the .o file depend on all the possible .mh files which could be
> >     imported when intermodule optimization is enabled.
> 
> You will also need to change the definition of `<main_module>.mhs'
> in modules.m and the code in make__module_target__touched_files
> which works out which modules have header files.
> 

diff -u compiler/modules.m compiler/modules.m
--- compiler/modules.m	7 Aug 2002 10:59:15 -0000
+++ compiler/modules.m	7 Aug 2002 13:01:13 -0000
@@ -3760,17 +3760,7 @@
 	io__write_string(DepStream, MakeVarName),
 	io__write_string(DepStream, ".mhs = "),
 	( { Target = c ; Target = asm } ->
-		% We only generate `.mh' files for modules containing
-		% `:- pragma export' declarations.
-		{ HeaderModules =
-		    list__filter(
-			(pred(Module::in) is semidet :-
-			    map__lookup(DepsMap, Module,
-			    		deps(_, ModuleImports)),
-			    contains_foreign_export =
-					ModuleImports ^ contains_foreign_export 
-			), Modules) },
-		write_dependencies_list(HeaderModules, ".mh", DepStream)
+		write_dependencies_list(Modules, ".mh", DepStream)
 	;
 		[]
 	),
only in patch2:
--- compiler/make.module_target.m	17 Jul 2002 07:09:21 -0000	1.11
+++ compiler/make.module_target.m	7 Aug 2002 13:08:05 -0000
@@ -556,20 +556,10 @@
 	    ),
 
 	    { ( CompilationTarget = c ; CompilationTarget = asm ) ->
-		    %
-		    % We only generate a `.mh' file if the module contains
-		    % `:- pragma export' declarations.
-		    %
-	    	PragmaExportModuleNames =
-			list__filter_map(
-			    (func(MImports) =
-			    		MImports ^ module_name is semidet :-
-				contains_foreign_export =
-				    MImports ^ contains_foreign_export
-			    ), ModuleImportsList),
-	    	HeaderTargets =
-			make_target_list(PragmaExportModuleNames, c_header(mh))
-			++ HeaderTargets0
+		Names = list__map((func(MI) = MI ^ module_name),
+				ModuleImportsList),
+	    	HeaderTargets = make_target_list(Names, c_header(mh))
+				++ HeaderTargets0
 	    ;
 		HeaderTargets = HeaderTargets0
 	    },
--------------------------------------------------------------------------
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