[m-rev.] [reuse] for review: files erronuously touched
Nancy Mazur
Nancy.Mazur at cs.kuleuven.ac.be
Sat Aug 11 01:19:50 AEST 2001
Hi Simon,
I solved the problem of c and c_date files being erronuously touched
when generating trans_opt files by simply making the clear distinction
between whether to generate trans_opts after stage 50 (and doing
nothing more) or whether to compile further on (hence touching
the required files).
I don't know whether this has major consequences or not. It all
seems to work fine this way.
Nancy
===================================================================
Estimated hours taken: 1
Branches: reuse
In combination with smart_recompilation, problems occurred as
files were erronuously touched where they shouldn't. This problem
is caused by the fact that we delay the generation of the .trans_opt
file till after stage 50 (as reuse analysis will only be done
by then). Normally it assumed that once after stage 50,
full compilation will be required, hence touching all the necessary
files.
mercury_compile.m:
After stage 50, either check whether only the trans_opts
need to be generated. If so, do so, if not, go on, and compile till
the end, including touching all possible files.
Index: mercury_compile.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mercury_compile.m,v
retrieving revision 1.175.2.23
diff -u -r1.175.2.23 mercury_compile.m
--- mercury_compile.m 2001/08/07 09:36:35 1.175.2.23
+++ mercury_compile.m 2001/08/10 13:46:59
@@ -1012,7 +1012,7 @@
globals__io_get_target(Target),
globals__io_lookup_bool_option(target_code_only,
TargetCodeOnly),
-
+
%
% Remove any existing `.used' file before writing the
% output file file. This avoids leaving the old `used'
@@ -1029,96 +1029,100 @@
( { NumErrors = 0 } ->
mercury_compile__maybe_generate_rl_bytecode(HLDS50,
Verbose, MaybeRLFile),
- ( { AditiOnly = yes } ->
- { HLDS = HLDS50 }
- ; { MakeTransOptInt = yes } ->
- { HLDS = HLDS50 },
+ ( { MakeTransOptInt = yes } ->
+ % { HLDS = HLDS50 },
mercury_compile__output_trans_opt_file(HLDS50)
- ; { Target = il } ->
- { HLDS = HLDS50 },
- mercury_compile__mlds_backend(HLDS, MLDS),
- ( { TargetCodeOnly = yes } ->
- mercury_compile__mlds_to_il_assembler(MLDS)
- ;
- { HasMain = mercury_compile__mlds_has_main(
- MLDS) },
- mercury_compile__mlds_to_il_assembler(MLDS),
- mercury_compile__il_assemble(ModuleName,
- HasMain)
- )
- ; { Target = java } ->
- { HLDS = HLDS50 },
- mercury_compile__mlds_backend(HLDS, MLDS),
- mercury_compile__mlds_to_java(MLDS),
- ( { TargetCodeOnly = yes } ->
- []
- ;
- mercury_compile__compile_java_file(ModuleName)
- )
- ; { Target = asm } ->
- % compile directly to assembler using the gcc back-end
- { HLDS = HLDS50 },
- mercury_compile__mlds_backend(HLDS, MLDS),
- mercury_compile__maybe_mlds_to_gcc(MLDS,
- ContainsCCode),
- ( { TargetCodeOnly = yes } ->
- []
- ;
- % We don't invoke the assembler to produce an
- % object file yet -- that is done at
- % the top level.
- %
- % But if the module contained `pragma c_code',
- % then we will have compiled that to a
- % separate C file. We need to invoke the
- % C compiler on that.
- %
- ( { ContainsCCode = yes } ->
- module_name_to_file_name(ModuleName,
- ".c", no, CCode_C_File),
- object_extension(Obj),
- module_name_to_file_name(ModuleName,
- "__c_code" ++ Obj,
- yes, CCode_O_File),
- mercury_compile__single_c_to_obj(
- CCode_C_File, CCode_O_File,
- _CompileOK),
- % add this object file to the list
- % of extra object files to link in
- globals__io_lookup_accumulating_option(
- link_objects, LinkObjects),
- globals__io_set_option(link_objects,
- accumulating([CCode_O_File |
- LinkObjects]))
+ ;
+ (
+ ( { AditiOnly = yes } ->
+ { HLDS = HLDS50 }
+ ; { Target = il } ->
+ { HLDS = HLDS50 },
+ mercury_compile__mlds_backend(HLDS, MLDS),
+ ( { TargetCodeOnly = yes } ->
+ mercury_compile__mlds_to_il_assembler(MLDS)
;
+ { HasMain = mercury_compile__mlds_has_main(
+ MLDS) },
+ mercury_compile__mlds_to_il_assembler(MLDS),
+ mercury_compile__il_assemble(ModuleName,
+ HasMain)
+ )
+ ; { Target = java } ->
+ { HLDS = HLDS50 },
+ mercury_compile__mlds_backend(HLDS, MLDS),
+ mercury_compile__mlds_to_java(MLDS),
+ ( { TargetCodeOnly = yes } ->
[]
+ ;
+ mercury_compile__compile_java_file(ModuleName)
)
- )
- ; { HighLevelCode = yes } ->
- { HLDS = HLDS50 },
- mercury_compile__mlds_backend(HLDS, MLDS),
- mercury_compile__mlds_to_high_level_c(MLDS),
- ( { TargetCodeOnly = yes } ->
- []
- ;
- module_name_to_file_name(ModuleName, ".c", no,
- C_File),
- object_extension(Obj),
- module_name_to_file_name(ModuleName, Obj, yes,
- O_File),
- mercury_compile__single_c_to_obj(
- C_File, O_File, _CompileOK)
+ ; { Target = asm } ->
+ % compile directly to assembler using the gcc back-end
+ { HLDS = HLDS50 },
+ mercury_compile__mlds_backend(HLDS, MLDS),
+ mercury_compile__maybe_mlds_to_gcc(MLDS,
+ ContainsCCode),
+ ( { TargetCodeOnly = yes } ->
+ []
+ ;
+ % We don't invoke the assembler to produce an
+ % object file yet -- that is done at
+ % the top level.
+ %
+ % But if the module contained `pragma c_code',
+ % then we will have compiled that to a
+ % separate C file. We need to invoke the
+ % C compiler on that.
+ %
+ ( { ContainsCCode = yes } ->
+ module_name_to_file_name(ModuleName,
+ ".c", no, CCode_C_File),
+ object_extension(Obj),
+ module_name_to_file_name(ModuleName,
+ "__c_code" ++ Obj,
+ yes, CCode_O_File),
+ mercury_compile__single_c_to_obj(
+ CCode_C_File, CCode_O_File,
+ _CompileOK),
+ % add this object file to the list
+ % of extra object files to link in
+ globals__io_lookup_accumulating_option(
+ link_objects, LinkObjects),
+ globals__io_set_option(link_objects,
+ accumulating([CCode_O_File |
+ LinkObjects]))
+ ;
+ []
+ )
+ )
+ ; { HighLevelCode = yes } ->
+ { HLDS = HLDS50 },
+ mercury_compile__mlds_backend(HLDS, MLDS),
+ mercury_compile__mlds_to_high_level_c(MLDS),
+ ( { TargetCodeOnly = yes } ->
+ []
+ ;
+ module_name_to_file_name(ModuleName, ".c", no,
+ C_File),
+ object_extension(Obj),
+ module_name_to_file_name(ModuleName, Obj, yes,
+ O_File),
+ mercury_compile__single_c_to_obj(
+ C_File, O_File, _CompileOK)
+ )
+ ;
+ mercury_compile__backend_pass(HLDS50, HLDS,
+ DeepProfilingStructures, GlobalData, LLDS),
+ mercury_compile__output_pass(HLDS, GlobalData, LLDS,
+ MaybeRLFile, ModuleName, _CompileErrors)
+ ),
+ recompilation_usage__write_usage_file(HLDS,
+ NestedSubModules, MaybeTimestamps),
+ FindTimestampFiles(ModuleName, TimestampFiles),
+ list__foldl(touch_datestamp, TimestampFiles)
)
- ;
- mercury_compile__backend_pass(HLDS50, HLDS,
- DeepProfilingStructures, GlobalData, LLDS),
- mercury_compile__output_pass(HLDS, GlobalData, LLDS,
- MaybeRLFile, ModuleName, _CompileErrors)
- ),
- recompilation_usage__write_usage_file(HLDS,
- NestedSubModules, MaybeTimestamps),
- FindTimestampFiles(ModuleName, TimestampFiles),
- list__foldl(touch_datestamp, TimestampFiles)
+ )
;
% If the number of errors is > 0, make sure that
% the compiler exits with a non-zero exit
--------------------------------------------------------------------------
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