[m-rev.] for possibly post-commit review: implement single-solution string trie lookup switches

Julien Fischer jfischer at opturion.com
Wed Apr 3 12:20:44 AEDT 2024


On Wed, 3 Apr 2024, Zoltan Somogyi wrote:

> Implement det/semidet string trie lookup switches.
> 
> compiler/string_switch.m:
>     Implement single-solution string trie lookup switches.
>     The code managing the lookup table is new, while the code managing
>     the trie search generalizes existing code. The latter required
>     some redrawing of the predicate boundaries within that existing code,
>     as well as adjusting some types and variable names.
>
>     Include "jump" in the name of the non-lookup versions of string switches.
>
>     Put state var arguments last in some predicate signatures.
> 
> compiler/switch_gen.m:
>     Enable single-solution string trie lookup switches.
> 
> compiler/string_switch_util.m:
>     Delete the call to build_str_case_id_list from the create_trie predicate,
>     since it is needed only by its old caller, the implementation of string
>     trie JUMP switches (which now does it itself), and not by its new caller,
>     the implementation of string trie LOOKUP switches.
> 
> compiler/lookup_util.m:
> compiler/code_util.m:
>     Give some predicates more expressive names.
> 
> compiler/code_loc_dep.m:
> compiler/disj_gen.m:
> compiler/jumpopt.m:
> compiler/lookup_switch.m:
> compiler/middle_rec.m:
> compiler/ml_string_switch.m:
> compiler/tag_switch.m:
> compiler/unify_gen_test.m:
>     Conform to the changes above.
> 
> compiler/hlds_goal.m:
>     Fix a comment.
> 
> tests/hard_coded/space.m:
>     This test case caught a bug in an early version of this diff.
>     Document this fact.
>
>     Make the code more readable by
>
>     - aligning the columns in some tables,
>     - renaming some function symbols to avoid ambiguity,
>     - replacing the remnants of calls to Prolog's "is" predicate
>       with idiomatic Mercury code, and
>     - deleting commented-out dead code that duplicated the body of predicate.
> 
> tests/hard_coded/Mercury.options:
>     Make space.m's role as a test case for string trie switches official
>     by compiling it with options that force trie switches.

That looks fine.

Julien.


More information about the reviews mailing list