[m-rev.] for review: Compute touched .int0 files for nested submodules correctly
Peter Wang
novalazy at gmail.com
Thu Dec 7 15:13:05 AEDT 2023
Compute touched .int0 files for nested submodules correctly.
Since commit 25f8a6cc999ebcfaa8caf6c6e0af42b57503301b, we only write
private interface files (.int0) for modules that actually have child
modules. However, find_files_maybe_touched_by_process_module still
returned a list of "touched" .int0 files for all nested submodules of
the top module, including submodules that do not have child modules.
Each time mmc --make is run, it would check for those unwritten .int0 as
dependencies, conclude that they were not up-to-date, and try to
generate them again (as part of generating the .int0 file for the
top module).
compiler/make.module_target.m:
Make find_files_maybe_touched_by_process_module exclude .int0 files
for nested submodules without child modules.
---
compiler/make.module_target.m | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/compiler/make.module_target.m b/compiler/make.module_target.m
index 97c5b8253..429e125ca 100644
--- a/compiler/make.module_target.m
+++ b/compiler/make.module_target.m
@@ -1059,6 +1059,15 @@
find_files_maybe_touched_by_process_module(ProgressStream, Globals,
TouchedTargetFiles0 = make_target_file_list(TargetModuleNames,
TargetType),
TouchedTargetFiles = TouchedTargetFiles0 ++ HeaderTargets
+ ;
+ Task = task_make_int0,
+ ForeignCodeFiles = [],
+ % TouchedTargetFiles must only include modules with children, as we
+ % no longer write out private interface files for modules without
+ % children.
+ list.filter_map(is_ancestor_module, ModuleDepInfos, AncestorModules),
+ TouchedTargetFiles =
+ make_target_file_list(AncestorModules, TargetType)
;
Task = task_make_int12,
% Both long and short interface files are produced
@@ -1069,7 +1078,6 @@
find_files_maybe_touched_by_process_module(ProgressStream, Globals,
make_target_file_list(TargetModuleNames, module_target_int2)
;
( Task = task_errorcheck
- ; Task = task_make_int0
; Task = task_make_int3
; Task = task_make_opt
; Task = task_make_analysis_registry
@@ -1083,6 +1091,13 @@
find_files_maybe_touched_by_process_module(ProgressStream, Globals,
TouchedTargetFiles, [], TimestampFileNames, !IO),
TouchedFileNames = ForeignCodeFiles ++ TimestampFileNames.
+:- pred is_ancestor_module(module_dep_info::in, module_name::out) is semidet.
+
+is_ancestor_module(ModuleDepInfo, ModuleName) :-
+ module_dep_info_get_children(ModuleDepInfo, Children),
+ not set.is_empty(Children),
+ module_dep_info_get_module_name(ModuleDepInfo, ModuleName).
+
:- pred gather_target_file_timestamp_file_names(globals::in, target_file::in,
list(string)::in, list(string)::out, io::di, io::uo) is det.
--
2.42.0
More information about the reviews
mailing list