mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-28 07:44:43 +00:00
Estimated hours taken: 6 Branches: main Lookups in the map from type_ctors to their definitions are relatively expensive, due to the cost of repeatedly comparing type_ctors, comparisons that are relatively expensive. This diff replaces that direct map with a two-stage map, the first stage being a map on the type constructor name (a plain string), and the second stage being a map of the full type_ctor. Most of the job of searching is done by the first map, since the second map can be expected to have only one entry most of the time. An earlier diff yielded a reduction of 1.1% in compilation time, as measured by a version of tools/speedtest which compiles six modules in grade hlc.gc. The speedup when compiling in grade asm_fast.gc was 0.6%. (The MLDS code generator does more lookups of type definitions than the LLDS code generator.) This diff also has some more changes that led to some further speedups, but I don't have the original basis for comparison anymore. Note that making the type table's type abstract leads to a slowdown, but the faster data structure more than compensates for it. compiler/hlds_data.m: Make the type table an abstract type, and change its representation as described above. Provide the operations on it that are needed by the other modules of the compiler. compiler/*.m: Use the operations provided by hlds_data.m instead of operations on maps to access the type table. In several cases replace old code that iterated on keys and looked up the associated values in the map, with new code that iterates on an association list that puts the value right next to its key (a list that the old code just threw away). In other cases, change code that iterated on a list of the keys to iterating on the whole assoc_list instead, paying attention only to the keys. This is faster, since it avoids allocating memory for the list of keys. compiler/type_ctor_info.m: This module used to use a roundabout method of generating type_ctor_gen_infos for the builtin types conceptually defined in builtin.m. It used to add their type_ctors to the list of user-defined type_ctors it processed, and the code that processed each type_ctor would check whether it was one of these, and if yes, handle them specially. This diff makes the code handle these builtin type_ctors and user-defined type_ctors separately, avoiding a whole bunch of tests. compiler/typecheck_errors.m: Sort lists of types shown in error messages. The new data type table would naturally lead to slightly different orders of types in error messages than the old one; this change neutralizes such effects for the future. tests/invalid/ambiguous_overloading.err_exp: tests/invalid/errors2.err_exp: tests/warnings/ambiguous_overloading.exp: Expect sorted types in error messages.
72 lines
4.7 KiB
Plaintext
72 lines
4.7 KiB
Plaintext
ambiguous_overloading_error.m:043: In clause for predicate `ambig_overload1'/1:
|
|
ambiguous_overloading_error.m:043: error: excessively ambiguous overloading.
|
|
ambiguous_overloading_error.m:043: The following symbol was overloaded in the
|
|
ambiguous_overloading_error.m:043: following contexts.
|
|
ambiguous_overloading_error.m:041: The function symbol `f'/0.
|
|
ambiguous_overloading_error.m:041: The possible matches are:
|
|
ambiguous_overloading_error.m:041: the type constructor
|
|
ambiguous_overloading_error.m:041: `ambiguous_overloading_error.bar'/0,
|
|
ambiguous_overloading_error.m:041: the type constructor
|
|
ambiguous_overloading_error.m:041: `ambiguous_overloading_error.foo'/0,
|
|
ambiguous_overloading_error.m:041: the builtin type constructor
|
|
ambiguous_overloading_error.m:041: `character'.
|
|
ambiguous_overloading_error.m:042: The function symbol `f'/0 is also
|
|
ambiguous_overloading_error.m:042: overloaded here.
|
|
ambiguous_overloading_error.m:046: In clause for predicate `ambig_overload2'/1:
|
|
ambiguous_overloading_error.m:046: warning: highly ambiguous overloading.
|
|
ambiguous_overloading_error.m:046: The following symbols were overloaded in
|
|
ambiguous_overloading_error.m:046: the following contexts.
|
|
ambiguous_overloading_error.m:046: The function symbol `a1'/0.
|
|
ambiguous_overloading_error.m:046: The possible matches are:
|
|
ambiguous_overloading_error.m:046: the type constructor
|
|
ambiguous_overloading_error.m:046: `ambiguous_overloading_error.baz'/0,
|
|
ambiguous_overloading_error.m:046: the type constructor
|
|
ambiguous_overloading_error.m:046: `ambiguous_overloading_error.qux'/0.
|
|
ambiguous_overloading_error.m:046: The function symbol `a2'/0.
|
|
ambiguous_overloading_error.m:046: The possible matches are:
|
|
ambiguous_overloading_error.m:046: the type constructor
|
|
ambiguous_overloading_error.m:046: `ambiguous_overloading_error.baz'/0,
|
|
ambiguous_overloading_error.m:046: the type constructor
|
|
ambiguous_overloading_error.m:046: `ambiguous_overloading_error.qux'/0.
|
|
ambiguous_overloading_error.m:100: In clause for predicate `test_lt'/1:
|
|
ambiguous_overloading_error.m:100: error: excessively ambiguous overloading.
|
|
ambiguous_overloading_error.m:100: The following symbol was overloaded in the
|
|
ambiguous_overloading_error.m:100: following contexts.
|
|
ambiguous_overloading_error.m:051: The predicate symbol predicate `<'/2.
|
|
ambiguous_overloading_error.m:051: The possible matches are:
|
|
ambiguous_overloading_error.m:051: predicate `int.<'/2,
|
|
ambiguous_overloading_error.m:051: predicate `float.<'/2.
|
|
ambiguous_overloading_error.m:052: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:052: also overloaded here.
|
|
ambiguous_overloading_error.m:053: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:053: also overloaded here.
|
|
ambiguous_overloading_error.m:054: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:054: also overloaded here.
|
|
ambiguous_overloading_error.m:055: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:055: also overloaded here.
|
|
ambiguous_overloading_error.m:056: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:056: also overloaded here.
|
|
ambiguous_overloading_error.m:057: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:057: also overloaded here.
|
|
ambiguous_overloading_error.m:058: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:058: also overloaded here.
|
|
ambiguous_overloading_error.m:059: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:059: also overloaded here.
|
|
ambiguous_overloading_error.m:060: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:060: also overloaded here.
|
|
ambiguous_overloading_error.m:061: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:061: also overloaded here.
|
|
ambiguous_overloading_error.m:062: The predicate symbol predicate `<'/2 is
|
|
ambiguous_overloading_error.m:062: also overloaded here.
|
|
ambiguous_overloading_error.m:110: In clause for predicate
|
|
ambiguous_overloading_error.m:110: `set_browser_param_from_option_table'/3:
|
|
ambiguous_overloading_error.m:110: warning: highly ambiguous overloading.
|
|
ambiguous_overloading_error.m:110: The following symbol was overloaded in the
|
|
ambiguous_overloading_error.m:110: following context.
|
|
ambiguous_overloading_error.m:104: The function symbol
|
|
ambiguous_overloading_error.m:104: `lookup_bool_option'/2.
|
|
ambiguous_overloading_error.m:104: The possible matches are:
|
|
ambiguous_overloading_error.m:104: predicate `getopt.lookup_bool_option'/3,
|
|
ambiguous_overloading_error.m:104: function `getopt.lookup_bool_option'/2.
|
|
For more information, recompile with `-E'.
|