Files
mercury/tests/hard_coded/string_switch4.exp
Zoltan Somogyi fd8c495e4e Fix trie string switches, speed them up, ...
... and turn them back on.

compiler/c_util.m:
    Provide a version of output_quoted_string_c which accepts strings
    that may not be well formed, and prints out any code_units that
    do not belong to a well-formed UTF-8 code point using an octal
    escape sequence.

    Ask for some predicates with trivial bodies to be inlined.

compiler/llds_out_data.m:
    Use the new predicate in c_util to output string constants.
    This fixes the bug that could cause trie string switches to fail
    in the presence of strings containing multi-byte code points.
    In such cases, given the string constants that trie switches can generate,
    which contain only part of such a multi-byte code unit sequence,
    llds_out_data.m used to write out a C string constant that contained
    the unicode replacement character instead of those code units.

compiler/string_switch.m:
    If a trie node has four or more code units that can lead to matches, then
    use binary search instead of linear search to find out what to do next.

    To make this possible, separate the action of generating such search code
    from the action of finding out what to do for each possible code unit
    value.

    Generate comments that can be helpful in tracking down bugs such as
    the one described above.

compiler/switch_gen.m:
    Allow trie string switches once again.

runtime/mercury_ml_expand_body.h:
    Add an XXX for new behavior that I found the need for while
    debugging this change.

tests/hard_coded/string_switch*.{m,exp}:
    Add some new alternatives to each switch to create nodes
    at which the LLDS code generator will now use binary search.
    Add a query string to test one of these alternatives.
    (All four test cases are identical, apart from their module names.)

    Expect the changes for the existing keys caused by the new switch arms,
    as well as the extra outputs for the new query string.
2024-03-31 03:27:09 +11:00

127 lines
2.7 KiB
Plaintext

jump a -> 51
jump b -> 52
jump c failed
jump aa -> 11
jump ab -> 11
jump ac failed
jump ba -> 62
jump bb -> 62
jump bc failed
jump ca -> 13
jump cb -> 14
jump cc failed
jump cf -> 15
jump xxx -> 21
jump xxxxxxΓ -> 25
jump xxxxxxx failed
jump Γ -> 27
jump Δ -> 28
jump Θ -> 29
jump Σ -> 29
jump Σζ failed
one a -> 1
one b -> 2
one c failed
one aa -> 11
one ab -> 11
one ac failed
one ba -> 12
one bb -> 12
one bc failed
one ca -> 13
one cb -> 14
one cc failed
one cf -> 15
one xxx -> 21
one xxxxxxΓ -> 25
one xxxxxxx failed
one Γ -> 27
one Δ -> 28
one Θ -> 29
one Σ -> 29
one Σζ failed
one known a failed
one known b failed
one known c failed
one known aa -> 11
one known ab failed
one known ac failed
one known ba failed
one known bb -> 12
one known bc failed
one known ca failed
one known cb failed
one known cc failed
one known cf failed
one known xxx failed
one known xxxxxxΓ failed
one known xxxxxxx failed
one known Γ failed
one known Δ failed
one known Θ failed
one known Σ failed
one known Σζ failed
several a -> [1]
several b -> [2]
several c -> []
several aa -> [11, 12]
several ab -> [11, 12]
several ac -> []
several ba -> [13, 14, 15]
several bb -> [13, 14, 15]
several bc -> []
several ca -> [16]
several cb -> [16]
several cc -> []
several cf -> [18, 19]
several xxx -> [21]
several xxxxxxΓ -> [25]
several xxxxxxx -> []
several Γ -> [27]
several Δ -> [28]
several Θ -> [29, 30]
several Σ -> [29, 30]
several Σζ -> []
several known a -> []
several known b -> []
several known c -> []
several known aa -> [11, 12]
several known ab -> []
several known ac -> []
several known ba -> []
several known bb -> [13, 14, 15]
several known bc -> []
several known ca -> []
several known cb -> []
several known cc -> []
several known cf -> []
several known xxx -> []
several known xxxxxxΓ -> []
several known xxxxxxx -> []
several known Γ -> []
several known Δ -> []
several known Θ -> []
several known Σ -> []
several known Σζ -> []
several nested a -> [1001, 11001, 12001]
several nested b -> [2002, 11002, 12002]
several nested c -> []
several nested aa -> [11011, 11012, 12011, 12012]
several nested ab -> [11011, 11012, 12011, 12012]
several nested ac -> []
several nested ba -> [13013, 13014, 13015, 14013, 14014, 14015, 15013, 15014, 15015]
several nested bb -> [13013, 13014, 13015, 14013, 14014, 14015, 15013, 15014, 15015]
several nested bc -> []
several nested ca -> [16016]
several nested cb -> [16016]
several nested cc -> []
several nested cf -> []
several nested xxx -> [21021]
several nested xxxxxxΓ -> []
several nested xxxxxxx -> []
several nested Γ -> [27027]
several nested Δ -> [28028]
several nested Θ -> []
several nested Σ -> [29029]
several nested Σζ -> []