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

Peter Ross pro at missioncriticalit.com
Sat Aug 3 01:06:01 AEST 2002


On Fri, Aug 02, 2002 at 04:58:41PM +1000, Simon Taylor wrote:
> On 01-Aug-2002, Peter Ross <pro at missioncriticalit.com> wrote:
> > On Thu, Aug 01, 2002 at 08:23:00AM +1000, Fergus Henderson wrote:
> > > On 31-Jul-2002, Peter Ross <petdr at cs.mu.OZ.AU> wrote:
> > > > compiler/intermod.m:
> > > >     Don't add pragma foreign_code to .opt files until the limitation
> > > >     with foreign_import_module documented in
> > > >     intermod__write_intermod_info_2 is fixed.
> > > 
> > > That looks like it could cause a serious performance regression
> > > for a lot of programs.  Is this really needed?
> > > 
> > Well according to the XXX in intermod__write_intermod_info_2, using
> > foreign_include_module causes the library not to compile, so yes it is
> > needed.
> > 
> > I intend to look at fixing this problem as a seperate change.
> 
> It would be better to fix this first.
> 
> Fixing this properly is more difficult than it appears because
> `mmake depend' doesn't have information about the dependencies of
> modules in libraries, so it's not possible to work out the full
> set of header files that a given module could depend on.  After the
> first compilation the `.d' files can be updated with the correct set
> of headers.  We already get this wrong for `.opt' files with
> `--read-opt-files-transitively'.
> 
> In practice it shouldn't be too much of a problem, but we should document
> somewhere that `--intermodule-optimization' only works properly with
> `mmc --make'.
> 
This diff bootstraps in the asm_fast.gc grade, is this patch acceptable
for everyone at the moment?

diff -u mercury/compiler/intermod.m mercury/compiler/intermod.m
--- mercury/compiler/intermod.m	31 Jul 2002 15:27:26 -0000
+++ mercury/compiler/intermod.m	2 Aug 2002 14:50:32 -0000
@@ -320,12 +320,6 @@
 		pred_info_clauses_info(PredInfo, ClauseInfo),
 		clauses_info_clauses(ClauseInfo, Clauses),
 
-		% XXX until mmake can handle the extra dependencies introduced
-		% in intermod__write_intermod_info_2 we cannot use
-		% foreign_procs because they might depend on foreign decls
-		% which are in the header file.
-		\+ pred_info_pragma_goal_type(PredInfo),
-
 		pred_info_procids(PredInfo, [ProcId | _ProcIds]),
 		pred_info_procedures(PredInfo, Procs),
 		map__lookup(Procs, ProcId, ProcInfo),
@@ -1124,22 +1118,13 @@
 		% `:- pragma foreign_import_module("C", ModuleName).' 
 		% to the `.opt' file.
 		%
-		% XXX We should do this, but mmake can't handle
-		% the extra dependencies properly yet, so building
-		% the standard library fails (mmake attempts to build
-		% tree234.o before std_util.h is built). Note that once
-		% this is fixed the restriction on adding pragma
-		% foreign_procs to the .opt file in
-		% intermod__should_be_processed can be removed.
-		%
 		% XXX Currently we only handle procedures
 		% exported to C.
 		{
 			% Check that the  import could contain anything.
 			( PragmaExportedProcs \= []
 			; RevForeignDecls \= []
-			),
-			semidet_fail
+			)
 		->
 			module_info_name(ModuleInfo, ModuleName),
 			ForeignImportThisModule = foreign_import_module(c,
only in patch2:
--- mercury/library/Mmakefile	29 Jul 2002 07:51:06 -0000	1.95
+++ mercury/library/Mmakefile	2 Aug 2002 14:54:11 -0000
@@ -239,9 +239,11 @@
 # making tree234.$O first improves effective parallelism with parallel makes.
 # `mmc --make' does not support parallel makes, so this dependency just
 # slows things down.
-ifeq ($(MMAKE_USE_MMC_MAKE),no)
-lib_std: $(os_subdir)tree234.$O
-endif
+# XXX This is currently disabled because .mh files aren't built before
+# the tree234.o
+#ifeq ($(MMAKE_USE_MMC_MAKE),no)
+#lib_std: $(os_subdir)tree234.$O
+#endif
 lib_std: lib$(STD_LIB_NAME)
 
 ifeq ($(MMAKE_USE_MMC_MAKE),no)
--------------------------------------------------------------------------
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