[m-rev.] diff: cutting over to the new code in file_names.m

Julien Fischer jfischer at opturion.com
Wed Jul 5 15:08:25 AEST 2023



On Wed, 5 Jul 2023, Zoltan Somogyi wrote:

> The concept has been approved and the diff is relatively
> simple, so I don't think a review is needed, but I wouldn't
> object to one. I deliberately did not include two things
> in this diff to make review easier.

...

> Cut over to the new code in file_names.m.
> 
> compiler/file_names.m:
>     Delete the old code for doing filename translations, and use
>     just the new code.
>
>     Delete all the code that was needed only for comparing the old and
>     new code.
>
>     Delete the newext_other extension category, since it was also needed
>     only for that purpose. Delete all the code that supported it.
>
>     Switch the infrastructure for recording the demand for translations
>     to work with the new code.
> 
> compiler/analysis.file.m:
>     Delete functions that returned old-style extensions, which are
>     not useful anymore. The new-style extensions, by identifying
>     extensions via enums rather than strings, serve the purpose
>     for which these functions were created.
> 
> compiler/mercury_compile_main.m:
>     Move the code to call to write out the translation record
>     from just after a call to real_main_after_expansion to the
>     end of real_main_after_expansion. The reason is that the
>     predicate being called now needs access to a globals structure,
>     real_main_after_expansion has access to a globals structure,
>     but its caller does not.
>
>     Don't try to test the equivalence of the old and new algorithms
>     for file name translation, since that test code has been deleted.

...

> diff --git a/compiler/grab_modules.m b/compiler/grab_modules.m
> index 85ff7373e..bc983d795 100644
> --- a/compiler/grab_modules.m
> +++ b/compiler/grab_modules.m
> @@ -1123,7 +1123,11 @@ maybe_log_augment_decision(Why, IntFileKind, ReadWhy, ModuleName, Read, !IO) :-
>          runtime(env("LOG_AUGMENT_DECISION")), io(!TIO)]
>      (
>          ModuleNameStr = sym_name_to_string(ModuleName),
> -        int_file_kind_to_extension(IntFileKind, ExtStr, _Ext, _NewExt),
> +        ( IntFileKind = ifk_int0, ExtStr = ".int0"
> +        ; IntFileKind = ifk_int1, ExtStr = ".int1"  % for alignment

I suggest:

     % For alignment (actually .int).

> +        ; IntFileKind = ifk_int2, ExtStr = ".int2"
> +        ; IntFileKind = ifk_int3, ExtStr = ".int3"
> +        ),
>          WhyStr = string.string(ReadWhy),
>          (
>              Read = decided_not_to_read,

The looks fine otherwise.

Julien.


More information about the reviews mailing list