inefficiencies when creating the .opt file

Christopher Rodd SPEIRS crs at students.cs.mu.oz.au
Mon Jul 14 17:18:09 AEST 1997


Hi all,
	I was just looking at the code for making the .opt files (with
the intention of adding termination information to the files).  I think
that in some cases the datestamp of the .opt file may be changed
unnecessarily, causing unnecessary recompilation of other files.  The
reason is as follows:

currently the code is:
mercury_compile__maybe_write_optfile(MakeOptInt, HLDS0, HLDS) -->
	....
		intermod__write_optfile(HLDS0, HLDS1),
		( { IntermodArgs = yes } ->
                        mercury_compile__frontend_pass_2_by_phases(
                                HLDS1, HLDS2, FoundModeError),
                        ( { FoundModeError = no } ->
                                mercury_compile__maybe_polymorphism(HLDS2,
                                        Verbose, Stats, HLDS3),
                                mercury_compile__maybe_unused_args(HLDS3,
                                        Verbose, Stats, HLDS)
                	....
In mercury_compile__maybe_unused_args, information about unused_args is
annotated to the end of the .opt file

in intermod__write_optfile(HLDS0, HLDS1), the code is essentially

intermod__write_optfile(HLDS0, HLDS1) :-
	write all the data to the .opt.tmp file
	call update_interface(.opt file)


So, if the compiler is run when intermodule unused args are on, 
then the optfile created by  intermod__write_optfile will not contain
the unusedargs information, so update_interface will update the .opt
file, and then mercury_compile__maybe_unused_args will annotate its
information to the end of the .opt file, possibly making it exactly the
same as it was before the compiler was started.


Chris



More information about the developers mailing list