mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 23:35:25 +00:00
Estimated hours taken: 8
compiler/unify_proc.m:
Generate specialized comparison predicates for types with at most
N functors, for 0 <= N <= 3. This should speed up comparisons
on such types, and reduce code size, since we can dispense with
an if-then else, several calls (e.g. to index and error) and the
index predicate itself.
compiler/options.m:
Add the option that specifies N, the max number of function symbols
for which we will generate specialized comparison predicates.
compiler/handle_options.m:
Clip the value of this option to the maximum supported by unify_proc.m.
compiler/make_hlds.m:
Use the (clipped and therefore accurate) value of this option to decide
which types have specialized comparison predicates and thus can
dispense with an index predicate.
tests/hard_coded/comparison.{m,exp}:
A test case for specialized comparisons.
tests/hard_coded/Mmakefile:
Enable the test case, and sort the list of test cases.
25 lines
455 B
Plaintext
25 lines
455 B
Plaintext
a1(10, 20) < a1(10, 21)
|
|
a1(10, 20) = a1(10, 20)
|
|
a1(10, 20) > a1(9, 20)
|
|
a2(10, 20) > a2(10, 19)
|
|
a2(10, 20) = a2(10, 20)
|
|
a2(10, 20) < a2(11, 20)
|
|
a2(10, 20) < b2(10)
|
|
b2(30) > a2(50, 40)
|
|
b2(30) > b2(29)
|
|
b2(30) = b2(30)
|
|
b2(30) < b2(31)
|
|
a3(10, 20) > a3(10, 19)
|
|
a3(10, 20) = a3(10, 20)
|
|
a3(10, 20) < a3(11, 20)
|
|
a3(10, 20) < b3(10)
|
|
a3(10, 20) < c3
|
|
b3(30) > a3(50, 40)
|
|
b3(30) > b3(29)
|
|
b3(30) = b3(30)
|
|
b3(30) < b3(31)
|
|
b3(30) < c3
|
|
c3 > a3(50, 40)
|
|
c3 > b3(50)
|
|
c3 = c3
|