mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 12:53:47 +00:00
Estimated hours taken: 25
Branches: main
Improvements for higher-order specialization.
WARNING: This changes the order and number of extra arguments
added to specialized versions, including the type-specialized
procedures in the library. Recompile everything.
compiler/higher_order.m:
Improve the termination check on specialization of recursive
calls to allow parser combinator programs such as extras/xml
to be specialized fully. The old check just stopped on any
recursive specialization.
Construct constant higher-order and type-info arguments in the goal
for the specialized version, and remove them from the argument list.
This increases the chance that terms in the specialized version
which contain the constant terms will also be constant.
Attempt to match specialized versions occurring in higher-order
predicate constants.
Use record syntax throughout the code.
Add a version number to the names for type specialized versions
so that instead of segmentation faults or other program errors
users get link errors when the argument convention for specialized
versions changes.
compiler/options.m:
Add an option `--higher-order-arg-limit' (default 10)
to control the size of the higher-order arguments for
which specialization is allowed. Without this,
extras/xml/xml.parse.chars.m takes too much time
and memory to compile.
doc/user_guide.texi:
Document the new option.
tests/hard_coded/Mmakefile:
tests/hard_coded/type_spec_ho_term.m:
tests/hard_coded/type_spec_ho_term.exp:
Test case.
profiler/demangle.m:
util/mdemangle.c:
tests/misc_tests/mdemangle_test.{inp,exp}:
Update the documentation and test cases for the symbols
produced by type specialization.