library/io.m:
As above. They were already marked as obsolete.
NEWS:
Mention the change.
tests/hard_coded/remove_file.m:
tests/hard_coded/utf8_io.m:
tests/par_conj/dep_par_24.m:
tests/par_conj/dep_par_24b.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace references to the deleted predicates.
compiler/table_gen.m:
Find the maximum value used by an enum type to determine the size of
a trie node required for its step. Previously the code counted the
number of alternatives in the enum type, which does not work for
subtypes.
compiler/hlds_pred.m:
Update comment.
runtime/mercury_ml_expand_body.h:
runtime/mercury_deconstruct_macros.h:
Move some macros from mercury_ml_expand_body.h to
mercury_deconstruct_macros.h, and add MR_ prefixes.
runtime/mercury_construct.c:
Update comment.
runtime/mercury_table_type_body.h:
Use macros to search the ptag layout array or secondary tag array
if it is not possible to directly index them (which is the case for
subtypes).
tests/tabling/Mmakefile:
tests/tabling/table_subtype_du.m:
tests/tabling/table_subtype_du.exp:
tests/tabling/table_subtype_enum.m:
tests/tabling/table_subtype_enum.exp:
Add test cases.
tests/tabling/fast_loose.m:
Reset memo tables between before each trial. Results left in the
memo tables from previous trials cause subsequent trials to run
faster than they otherwise would, making it harder to detect a
difference in run time between strict and fast-loose tabling.
The program ends up trying bigger and bigger numbers, inflating the
memo tables, and possibly running out of heap or stack space.
This first step deals with the consequences of such removal.
The removal itself will happen in stage 2. That step will
add "is" to the prolog module in the library.
compiler/add_pred.m:
Prepare for "is" being in the prolog module.
compiler/options.m:
Add a way to test whether the change to add_pred.m is in the
installed compiler.
tests/accumulator/base.m:
tests/accumulator/call_in_base.m:
tests/accumulator/chain.m:
tests/accumulator/commutative.m:
tests/accumulator/construct_test.m:
tests/accumulator/dcg.m:
tests/accumulator/deconstruct_test.m:
tests/accumulator/disj.m:
tests/accumulator/func.m:
tests/accumulator/heuristic.m:
tests/accumulator/highorder.m:
tests/accumulator/identity.m:
tests/accumulator/inter.m:
tests/accumulator/nonrec.m:
tests/accumulator/out_to_in.m:
tests/accumulator/qsort.m:
tests/accumulator/simple.m:
tests/accumulator/split.m:
tests/accumulator/swap.m:
tests/benchmarks/cqueens.m:
tests/benchmarks/crypt.m:
tests/benchmarks/deriv.m:
tests/benchmarks/deriv2.m:
tests/benchmarks/nrev.m:
tests/benchmarks/poly.m:
tests/benchmarks/primes.m:
tests/benchmarks/qsort.m:
tests/benchmarks/query.m:
tests/benchmarks/tak.m:
tests/debugger/interactive.m:
tests/declarative_debugger/Mercury.options:
tests/declarative_debugger/io_read_bug.m:
tests/declarative_debugger/queens.exp:
tests/declarative_debugger/queens.m:
tests/dppd/imperative_solve_impl.m:
tests/dppd/map_impl.m:
tests/dppd/max_length_impl.m:
tests/dppd/sum.m:
tests/dppd/upto_sum_impl.m:
tests/par_conj/dep_par_21.m:
tests/tabling/seq.m:
tests/term/dds3_14.m:
tests/term/mmatrix.m:
tests/term/money.m:
tests/term/occur.m:
tests/term/pl4_5_2.m:
tests/term/queens.m:
tests/typeclasses/inference_test.m:
tests/typeclasses/inference_test_2.m:
tests/valid/lazy_list.m:
tests/warnings/duplicate_const.m:
Replace calls to "is" with unifications. In many places,
bring programming style up to date.
library/*.m:
Specifically, delete any predicates and functions whose `pragma obsolete'
dates from 2018 or before. Keep the ones that were obsoleted
only this year or last year.
NEWS:
Announce the changes.
tests/debugger/io_tab_goto.m:
tests/debugger/tabled_read.m:
tests/declarative_debugger/io_stream_test.m:
tests/declarative_debugger/tabled_read_decl.m:
tests/declarative_debugger/tabled_read_decl_goto.m:
tests/general/array_test.m:
tests/hard_coded/mutable_init_impure.m:
tests/hard_coded/remove_file.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace references to predicates and functions that this diff deletes
with their suggested replacements.
In several test cases, bring the programming style up to date.
tests/hard_coded/shift_test.{m,exp}:
Most of this test case tested the now-deleted legacy shift operations.
Replace these with tests of their non-legacy versions, including
testing for the expected exceptions.
tests/hard_coded/shift_test.{m,exp}:
Don't pass --no-warn-obsolete when compiling shift_test.m anymore.
My commit afe2887882 broke the ability
to run the test suite outside of a bootcheck by executing "mmake runtests"
in the tests directory. This diff fixes that.
tests/Mmake.common:
Don't define "TESTS_DIR = ..". While every single tests/*/Mmakefile
defined it as such, I overlooked the fact that tests/Mmakefile itself
defined it ".", referring to the same directory from a different starting
point. Document this easily-overlooked fact.
Rename the old runtests target, which after afe2887 runs the tests
in a single directory, as runtests_dir, to leave the target name
"runtests" itself free for tests/Mmakefile to use.
tests/Mmakefile:
Define "TESTS_DIR = .", and add a target "runtests" which invokes
"mmake runtests_dir" in each test directory.
tools/bootcheck:
Invoke "mmake runtests_dir" instead of "mmake runtests" in each
test directory.
Initialize a variable just before it is used.
tests/*/Mmakefile:
Add back the definition "TESTS_DIR = .."
A long time ago, test directories such as hard_coded had subdirectories
such as hard_coded/typeclasses. These have since been flattened out
(e.g. hard_coded/typeclasses is now just typeclasses), but there were
still remnants of the old approach. This diff deletes those remnants.
tests/*/Mmakefile:
Delete the TESTS_DIR and the SUBDIRS mmake variables; TESTS_DIR
was always set to "..", and SUBDIRS to the empty string.
Delete any references to the make variable NOT_WORKING, since
it is never used.
tests/Mmake.common:
Document that Mmakefiles in test directories don't have to set
TESTS_DIR and SUBDIRS anymore. Fix the formatting of the documentation
of the make variables they do still have to set.
Delete the targets and actions for handling subdirectories of
test directories, since there aren't any.
tests/Mmakefile:
Simplify some code.
library/string.m:
Delete long-deprecated substring/3 function and substring/4 predicate.
The newly introduced `string_piece' type has a substring/3 data
constructor which takes (start, end) offsets into the base string,
whereas the function and predicate take (start, count) arguments.
To reduce potential confusion, delete the deprecated function and
predicate.
Delete other deprecated substring predicates and functions as well.
tests/general/Mercury.options:
tests/general/string_foldl_substring.exp:
tests/general/string_foldl_substring.m:
tests/general/string_foldr_substring.exp:
tests/general/string_foldr_substring.m:
tests/hard_coded/Mercury.options:
tests/hard_coded/string_substring.m:
Delete tests for deprecated predicates.
tests/tabling/mercury_java_parser_dead_proc_elim_bug.m:
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.m:
tests/valid/mercury_java_parser_follow_code_bug.m:
Replace calls to unsafe_substring with unsafe_between.
NEWS:
Announce the changes.
compiler/simplify_goal_call.m:
As above.
Also improve some comments, some predicate names, and formatting,
as part of a post-commit review.
tests/invalid/loopcheck.err_exp:
tests/warnings/infinite_recursion.exp:
tests/warnings/simple_code.exp:
Expect the predicate name in infinite loop warnings.
tests/tabling/Mercury.options:
tests/tabling/Mmakefile:
Disable warning about the infinite loop this test case tests
not by filtering out lines from the compiler output (which does not
work anymore due to the predicate name causing the warning to spill
onto a second line), but by simply asking the compiler not to generate
the warning.
Fix an old problem: the Mmakefile action for the loopcheck_nondet test case
was modifying a file that did not belong to it.
compiler/du_type_layout.m:
If the --allow-packing-remote-sectag option is set, then try to pack
an initial subsequence of subword-sized arguments next to remote sectags.
To allow the polymorphism transformation to put the type_infos and/or
typeclass_infos it adds to a function symbol's argument list at the
*front* of that argument list, pack arguments next to remote sectags
only in function symbols that won't have any such extra arguments
added to them.
Do not write all new code for the new optimization; instead, generalize
the code that already does a very similar job for packing args next to
local sectags.
Delete the code we used to have that picked the packed representation
over the base unpacked representation only if it reduced the
"rounded-to-even" number of words. A case could be made for its usefulness,
but in the presence of the new optimization the extra code complexity
it requires is not worth it (in my opinion).
Extend the code that informs users about possible argument order
rearrangements that yield better packing to take packing next to sectags
into account.
compiler/hlds_data.m:
Provide a representation for cons_tags that use the new optimization.
Instead of adding a new cons_tag, we do this by replacing several old
cons_tags that all represent pointers to memory cells with a single
cons_tag named remote_args_tag with an argument that selects among
the old cons_tags being replaced, and adding a new alternative inside
this new type. The new alternative is remote_args_shared with a
remote_sectag whose size is rsectag_subword(...).
Instead of representing the value of the "data" field in classes
on the Java and C# backends as a strange kind of secondary tag
that is added to a memory cell by a class constructor instead of
having to be explicitly added to the front of the argument vector
by the code of a unification, represent it more directly as separate
kind of remote_args_tag. Continuing to treat it as a sectag would have
been very confusing to readers of the code of ml_unify_gen_*.m in the
presence of the new optimization.
Replacing several cons_tags that were usually treated similarly with
one cons_tag simplifies many switches. Instead of an switch with that
branches to the same switch arm for single_functor_tag, unshared_tag
and shared_remote_tag, and then switches on these three tags again
to get e.g. the primary tag of each, the new code of the switch arm
is executed for just cons_tag value (remote_args_tag), and switches
on the various kinds of remote args tags only when it needs to.
In is also more natural to pass around the argument of remote_args_tag
than to pass around a variable of type cons_tag that can be bound to only
single_functor_tag, unshared_tag or shared_remote_tag.
Add an XXX about possible further steps along these lines, such as
making a new cons_tag named something like "user_const_tag" represent
all user-visible constants.
compiler/unify_gen_construct.m:
compiler/unify_gen_deconstruct.m:
compiler/unify_gen_test.m:
compiler/unify_gen_util.m:
compiler/ml_unify_gen_construct.m:
compiler/ml_unify_gen_deconstruct.m:
compiler/ml_unify_gen_test.m:
compiler/ml_unify_gen_util.m:
Implement X = f(Yi) unifications where f uses the new representation,
i.e. some of its arguments are stored next to a remote sectag.
Some of the Yi are stored in a tagword (a word that also contains a tag,
in this case the remote secondary tag), while some are stored in other
words in a memory cell. This means that such unifications have similarities
both to unifications involving arguments being packed next to local
sectags, and to unifications involving ordinary arguments in memory cells.
Therefore wherever possible, their implemenation uses suitably generalized
versions of existing code that did those two jobs for two separate kinds of
cons_tags.
Making such generalizations possible in some cases required shifting the
boundary between predicates, moving work from a caller to a callee
or vice versa.
In unify_gen_deconstruct.m, stop using uni_vals to represent *either* a var
*or* a word in a memory cell. While this enabled us to factor out some
common code, the predicate boundaries it lead to are unsuitable for the
generalizations we now need.
Consistently use unsigned ints to represent both the whole and the parts
of words containing packed arguments (and maybe sectags), except when
comparing ptag constants with the result of applying the "tag" unop
to a word, (since that unop returns an int, at least for now).
In a few cases, avoid the recomputation of some information that we
already know. The motivation is not efficiency, since the recomputation
we avoid is usually cheap, but the simplification of the code's correctness
argument.
Use more consistent terminology in things such as variable names.
Note the possibility of further future improvements in several places.
compiler/ml_foreign_proc_gen.m:
Delete a long unused predicate.
compiler/mlds.m:
Add an XXX documenting a possible improvement.
compiler/rtti.m:
Update the compiler's internal representation of RTTI data structures
to make them able to describe secondary tags that are smaller than
a full word.
compiler/rtti_out.m:
Conform to the changes above, and delete a long-unused predicate.
compiler/type_ctor_info.m:
Use the RTTI's du_hl_rep to represent cons_tags that distinguish
between function symbols using a field in a class.
compiler/ml_type_gen.m:
Provide a specialized form of a function for code in ml_unify_gen_*.m.
Conform to the changes above.
compiler/add_special_pred.m:
compiler/bytecode_gen.m:
compiler/export.m:
compiler/hlds_code_util.m:
compiler/lco.m:
compiler/ml_closure_gen.m:
compiler/ml_switch_gen.m:
compiler/ml_tag_switch.m:
compiler/rtti_to_mlds.m:
compiler/switch_util.m:
compiler/tag_switch.m:
Conform to the changes above.
runtime/mercury_type_info.h:
Update the runtime's representation of RTTI data structures to make them
able to describe remote secondary tags that are smaller than a full word.
runtime/mercury_deconstruct.[ch]:
runtime/mercury_deconstruct.h:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_ml_expand_body.h:
runtime/mercury_ml_arg_body.h:
runtime/mercury_ml_deconstruct_body.h:
runtime/mercury_ml_functor_body.h:
These modules collectively implement the predicates in deconstruct.m
in the library, and provide access to its functionality to other C code,
e.g. in the debugger. Update these to be able to handle terms with the
new data representation optimization.
This update requires a significant change in the distribution of work
between these files for the predicates deconstruct.deconstruct and
deconstruct.limited_deconstruct. We used to have mercury_ml_expand_body.h
fill in the fields of their expand_info structures (whose types are
defined in mercury_deconstruct.h) with pointers to three vectors:
(a) a vector of arg_locns with one element per argument, with a NULL
pointer being equivalent to a vector with a given element in every slot;
(b) a vector of type_infos with one element per argument, constructed
dynamically (and later freed) if necessary; and (c) a vector of argument
words. Once upon a time, before double-word and sub-word arguments,
vector (c) also had one word per argument, but that hasn't been true
for a while; we added vector (a) help the consumers of the expand_info
decode the difference. The consumers of this info always used these
vectors to build up a Mercury term containing a list of univs,
with one univ for each argument.
This structure could be stretched to handle function symbols that store
*all* their arguments in a tagword next to a local sectag, but I found
that stretching it to cover function symbols that have *some* of their
arguments packed next to a remote sectag and *some other* of their
arguments in a memory cell as usual would have required a well-nigh
incomprehensibly complex, and therefore almost undebuggable, interface
between mercury_ml_expand_body.h and the other files above. This diff
therefore changes the interface to have mercury_ml_expand_body.h
build the list of univs directly. This make its code relatively simple
and self-contained, and it should be somewhat faster then the old code
as well, since it never needs to allocate, fill in and then free
vectors of type_infos (each such typeinfo now gets put into a univ
as soon as it is constructed). The downside is that if we ever wanted
to get all the arguments at once for a purpose other than constructing
a list of univs from them, it would nevertheless require constructing
that list of univs anyway as an intermediate data structure. I don't see
this downside is significant, because (a) I don't think such a use case
is very likely, and (b) even if one arises, debuggable but a bit slow
is probably preferable to faster but very hard to debug.
Reduce the level of indentation of some of these files to make the code
easier to edit. Do this by
- not adding an indent level from switch statements to their cases; and
- not adding an indent level when a case in a switch has a local block.
Move the break or return ending a case inside that case's block,
if it has one.
runtime/mercury_deep_copy_body.h:
runtime/mercury_table_type_body.h:
Update these to enable the copying or tabling of terms whose
representations uses the new optimization.
Use the techniques listed above to reduce the level of indentation
make the code easier to edit.
runtime/mercury_tabling.c:
runtime/mercury_term_size.c:
Conform to the changes above.
runtime/mercury_unify_compare_body.h:
Make this code compile after the changes above. It does need to work
correctly, since we only ever used this code to compare the speed
of unify-by-rtti with the speed of unify-by-compiler-generated-code,
and in real life, we always use the latter. (It hasn't been updated
to work right with previous arg packing changes either.)
library/construct.m:
Update to enable the code to construct terms whose representations
uses the new optimization.
Add some sanity checks.
library/private_builtin.m:
runtime/mercury_dotnet.cs.in:
java/runtime/Sectag_Locn.java:
Update the list of possible sectag kinds.
library/store.m:
Conform to the changes above.
trace/mercury_trace_vars.c:
Conform to the changes above.
tests/hard_coded/deconstruct_arg.{m,exp,exp2}:
Extend this test to test the deconstruction of terms whose
representations uses the new optimization.
Modify some of the existing terms being tested to make them more diverse,
in order to make the output easier to navigate.
tests/hard_coded/construct_packed.{m,exp}:
A new test case to test the construction of terms whose
representations uses the new optimization.
tests/debugger/browse_packed.{m,exp}:
A new test case to test access to the fields of terms whose
representations uses the new optimization.
tests/tabling/test_packed.{m,exp}:
A new test case to test the tabling of terms whose
representations uses the new optimization.
tests/debugger/Mmakefile:
tests/hard_coded/Mmakefile:
tests/tabling/Mmakefile:
Enable the new test cases.
tests/hard_coded/target_mlobjs_c.c:
Fix a bad use of printf.
tests/hard_coded/trace_goal_4.m:
tests/hard_coded/word_aligned_pointer.m:
tests/hard_coded/word_aligned_pointer_2.m:
tests/tabling/memo_non.m:
tests/tabling/table_foreign_output.m:
tests/tabling/test_enum.m:
Don't assume that MR_Integers are ints; print them using
MR_INTEGER_LENGTH_MODIFIER.
library/table_builtin.m:
Add the various tabling primitives -- they could not previously
be added until part 1 of the fixed size integer change had
bootstrapped.
library/table_statistics.m:
runtime/mercury_tabling.h:
Update the table_step_kind/0 type and its C version to cover the fixed
size integer types. (The corresponding type in compiler/hlds_pred.m
has already been updated.)
tests/tabling/Mmakefile:
tests/tabling/fib_int{8,16,32}.{m,exp}:
tests/tabling/fib_uint{8,16,32}.{m,exp}:
Test tabling for each of the fixed size integer types.
tests/Mmake.common:
Don't invoke any actions in the clean_local and realclean_local
targets, since if using mmc --make, the builtin mmake rules
have actions for those targets as well, and make can't handle
more than one action for a target having actions. Replace those
actions with dependencies on other, unique targets that have
the actions instead.
tests/*/Mmakefile:
Avoid actions in clean_local and realclean_local targets the same way.
Sort the test names in some directories that didn't already do so.
Delete some obsolete comments.
Fix style.
tests/valid/Mmake.valid.common:
As for the Mmakefiles above, and also move the definition of a make
variable before it is needed.
tests/Mmake.common:
Replace the -j1 in the runtests_local target used by all the test
directories with $(MAYBE_J1).
tests/*/Mmakefile:
Define MAYBE_J1 it as the empty string in test directories in which
different tests don't share source files.
Define MAYBE_J1 as -j1 in test directories in which
different tests do share source files.
tests/submodules/sub2_a.m:
Add this copy of sub_a.m to allow tests in the submodules directory
to be done in parallel.
tests/submodules/accessibility2.m:
Import sub2_a.m instead of sub_a.m.
tests/warnings/ambig_types_high_level.m:
Add this copy of ambig_types.m to allow tests in the warnings directory
to be done in parallel.
tests/warnings/ambig_high_level.m:
Import ambig_types_high_level.m instead of ambig_types.m.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the tests
that check compiler error messages, expect the new line numbers.
browser/cterm.m:
browser/tree234_cc.m:
Import only one module per line.
tests/hard_coded/boyer.m:
Fix something I missed.
This file-specific setting will override a default setting of expandtabs
in $HOME/.vimrc.
*/Makefile:
*/Mmakefile:
As above.
tests/hard_coded/.gitignore:
Don't ignore the purity subdir. This ignore must have been left over
from when purity.m was a test in hard_coded, not hard_coded/purity,
and it ignored an executable, not a directory.
library/array.m:
library/array2d.m:
library/bitmap.m:
library/store.m:
library/thread.semaphore.m:
library/version_array2d.m:
library/version_bitmap.m:
library/version_hash_table.m:
library/version_store.m:
Delete predicates that were deprecated in Mercury 13.05 and before.
library/version_array.m
Delete the deprecated function new/2.
Deprecate unsafe_new/2 and unsafe_init/2 to replace it.
(We had overlooked this previously.)
library/string.m:
Delete the deprecated function set_char_char/3.
(We will leave the other deprecated procedures in this module
for at least another release.)
library/svlist.m:
library/svpqueue.m:
library/svstack.m:
Delete these modules: they were only ever needed as a transitional
mechanism.
library/library.m:
Conform to the above changes.
doc/Mmakefile:
Unrelated change: delete references to files that have been
deleted since we moved to git.
tests/hard_coded/*/*.m
tests/tabling/*.m:
Update test cases where they made use of predicates that have
now been deleted from the standard library.
Branches: main, 11.07
Make the none.gc.memprof grade work with MSVC again.
Avoid more warnings when compiling with MSVC.
compiler/layout_out.m:
Avoid an incomplete type in the declaration of the alloc_sites
array. (Similar changes need to be made for the layout structures
related to debugging and deep profiling - I am in the process of
testing the former, the latter doesn't currently work on Windows
any way.)
browser/listing.m:
Use don't-care variables in some foreign_procs.
This avoids warnings about assignments from uninitialized
variables with MSVC.
*/.cvsignore:
Update cvsignore entries.
Ignore files generated by mprof.
Branches: main
Pack consecutive enumeration arguments in discriminated union types into a
single word to reduce cell sizes. Argument packing is only enabled on C
back-ends with low-level data, and reordering arguments to improve
opportunities for packing is not yet attempted. The RTTI implementations for
other back-ends will need to be updated, but that is best left until after any
argument reordering change.
Modules which import abstract enumeration types are notified so by writing
declarations of the form:
:- type foo where type_is_abstract_enum(NumBits).
into the interface file for the module which defines the type.
compiler/prog_data.m:
Add an `arg_width' argument to constructor arguments.
Replace `is_solver_type' by `abstract_type_details', with an extra
option for abstract exported enumeration types.
compiler/handle_options.m:
compiler/options.m:
Add an internal option `--allow-argument-packing'.
compiler/make_hlds_passes.m:
Determine whether and how to pack enumeration arguments, updating the
`arg_width' fields of constructor arguments before constructors are
added to the HLDS.
compiler/mercury_to_mercury.m:
compiler/modules.m:
Write `where type_is_abstract_enum(NumBits)' to interface files
for abstract exported enumeration types.
compiler/prog_io_type_defn.m:
Parse `where type_is_abstract_enum(NumBits)' attributes on type
definitions.
compiler/arg_pack.m:
compiler/backend_libs.m:
Add a new module. This mainly contains a predicate which packs rvals
according to arg_widths, which is used by both LLDS and MLDS back-ends.
compiler/ml_unify_gen.m:
compiler/unify_gen.m:
Take argument packing into account when generating code for
constructions and deconstructions. Only a relatively small part of the
compiler actually needs to understand argument packing. The rest works
at the HLDS level with constructor arguments and variables, or at the
LLDS and MLDS levels with structure fields.
compiler/code_info.m:
compiler/var_locn.m:
Add assign_field_lval_expr_to_var and
var_locn_assign_field_lval_expr_to_var.
Allow more kinds of rvals in assign_cell_arg. I do not know why it was
previously restricted, except that the other kinds of rvals were not
encountered as cell arguments before.
compiler/mlds.m:
We can now rely on the compiler to pack arguments in the
mlds_decl_flags type instead of doing it manually. A slight downside
is that though the type is packed down to a single word cell, it will
still incur a memory allocation per cell. However, I did not notice
any difference in compiler speed.
compiler/rtti.m:
compiler/rtti_out.m:
Add and output a new field for MR_DuFunctorDesc instances, which, if
any arguments are packed, points to an array of MR_DuArgLocn. Each
array element describes the offset in the cell at which the argument's
value is held, and which bits of the word it occupies. In the more
common case where no arguments are packed, the new field is simply
null.
compiler/rtti_to_mlds.m:
Generate the new field to MR_DuFunctorDesc.
compiler/structure_reuse.direct.choose_reuse.m:
For now, prevent structure reuse reusing a dead cell which has a
different constructor to the new cell. The code to determine whether a
dead cell will hold the arguments of a new cell with a different
constructor will need to be updated to account for argument packing.
compiler/type_ctor_info.m:
Bump RTTI version number.
Conform to changes.
compiler/add_type.m:
compiler/check_typeclass.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/erl_rtti.m:
compiler/hlds_data.m:
compiler/hlds_out_module.m:
compiler/intermod.m:
compiler/make_tags.m:
compiler/mlds_to_gcc.m:
compiler/opt_debug.m:
compiler/prog_type.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/special_pred.m:
compiler/type_constraints.m:
compiler/type_util.m:
compiler/unify_proc.m:
compiler/xml_documentation.m:
Conform to changes.
Reduce code duplication in classify_type_defn.
compiler/hlds_goal.m:
Clarify a comment.
library/construct.m:
Make `construct' pack arguments when necessary.
Remove an old RTTI version number check as recommended in
mercury_grade.h.
library/store.m:
Deal with packed arguments in this module.
runtime/mercury_grade.h:
Bump binary compatibility version number.
runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
Bump RTTI version number.
Add MR_DuArgLocn structure definition.
Add a macro to unpack an argument as described by MR_DuArgLocn.
Add a function to determine a cell's size, since the number of
arguments is no longer correct.
runtime/mercury_deconstruct.c:
runtime/mercury_deconstruct.h:
runtime/mercury_deconstruct_macros.h:
runtime/mercury_ml_arg_body.h:
runtime/mercury_ml_expand_body.h:
Deal with packed arguments when deconstructing.
Remove an old RTTI version number check as recommended in
mercury_grade.h.
runtime/mercury_deep_copy_body.h:
Deal with packed arguments when copying.
runtime/mercury_table_type_body.h:
Deal with packed arguments in tabling.
runtime/mercury_dotnet.cs.in:
Add DuArgLocn field to DuFunctorDesc. Argument packing is not enabled
for the C# back-end yet so this is unused.
trace/mercury_trace_vars.c:
Deal with packed arguments in MR_select_specified_subterm,
use for the `hold' command.
java/runtime/DuArgLocn.java:
java/runtime/DuFunctorDesc.java:
Add DuArgLocn field to DuFunctorDesc. Argument packing is not enabled
for the Java back-end yet so this is unused.
extras/trailed_update/tr_store.m:
Deal with packed arguments in this module (untested).
extras/trailed_update/samples/interpreter.m:
extras/trailed_update/tr_array.m:
Conform to argument reordering in the array, map and other modules in
previous changes.
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/lco_pack_args.exp:
tests/hard_coded/lco_pack_args.m:
tests/hard_coded/pack_args.exp:
tests/hard_coded/pack_args.m:
tests/hard_coded/pack_args_copy.exp:
tests/hard_coded/pack_args_copy.m:
tests/hard_coded/pack_args_intermod1.exp:
tests/hard_coded/pack_args_intermod1.m:
tests/hard_coded/pack_args_intermod2.m:
tests/hard_coded/pack_args_reuse.exp:
tests/hard_coded/pack_args_reuse.m:
tests/hard_coded/store_ref.exp:
tests/hard_coded/store_ref.m:
tests/invalid/Mmakefile:
tests/invalid/where_abstract_enum.err_exp:
tests/invalid/where_abstract_enum.m:
tests/tabling/Mmakefile:
tests/tabling/pack_args_memo.exp:
tests/tabling/pack_args_memo.m:
Add new test cases.
tests/hard_coded/deconstruct_arg.exp:
tests/hard_coded/deconstruct_arg.exp2:
tests/hard_coded/deconstruct_arg.m:
Add constructors with packed arguments to these cases.
tests/invalid/where_direct_arg.err_exp:
Update expected output.
support tabling.
(The Makefiles in tests directory should prevent this, but in at least one
grade on neptune this isn't currently happening and it's rendering that
machine unusable - I'll fix the Makefile issue separately.)
tests/tabling/*.m:
Add require_feature_set pragmas to all the tabling tests to ensure
they aren't accidently run in grades that don't support tabling.
Estimated hours taken: 0.2
Branches: main
tests/tabling/Mmakefile:
Avoid infinite loops in grades (such as hl.gc) that do not support
tabling, in which two of the test cases of this directory loop forever
if executed.
Estimated hours taken: 0.2
Branches: main
Fix some test case failures that were causes by the test setups, not by any
bugs.
tests/debugger/dice.exp3:
Add a new expected output for this test. I believe this is the correct
expected output for the current HLDS form of the code from which the
goal paths are computed. (The new .exp3 differs from the .exp2 file
in goal paths and the resulting orderings.)
tests/tabling/fib_stats.exp2:
Add a new expected output for this test with the expected output on 64
bit systems. This is the same as fib_stats.exp, but with twice the
expected memory usage.
tests/tabling/Mmakefile:
tests/tabling/specified_stats.exp:
We used to replace up to five-digit numbers with NNNs to avoid
depending on platform specific details. Since this is not enough,
with differences showing up on 64 bit platforms, do this for up
to seven-digit numbers.
Estimated hours taken: 0.2
Branches: main
tests/*/Mmakefile:
Sort the lists of tests in each directory. (We usually keep each list
sorted, but then we concatenate several lists, which loses the order.)
This gives you a better idea of how far a bootcheck still has to go.
tools/bootcheck:
Build the interface files before the rest of the files in the library
directory. Again, this gives you a better idea of how far a bootcheck
still has to go.
Make the dependencies for the slice subdirectory of the stage2 at the
same time as the other subdirs; don't let it be caught later.
library/Mmakefile:
Build the interface files in the right order.
Branches: main
The bodies of table reset and statistics procedures generated by the
compiler were being written to `.opt' files. However, those procedures
need access to C variables which are local to their defining modules.
compiler/add_pragma.m:
Set the `may_not_duplicate' attribute on table reset and
statistics procedures.
compiler/intermod.m:
Don't write foreign procedures to `.opt' files if they have the
`may_not_duplicate' attribute.
tests/tabling/Mercury.options:
tests/tabling/Mmakefile:
tests/tabling/reset_stats_intermod.exp:
tests/tabling/reset_stats_intermod.m:
tests/tabling/reset_stats_intermod_2.m:
Add test case.
Estimated hours taken: 0.1
Branches: main
tests/tabling/specified_stats.exp:
After modifying the Mmakefile rule for generating specified_stats.out,
update the .exp file accordingly.
Estimated hours taken: 0.5
Branches: main
tests/tabling/Mmakefile:
Replace all the statistics in the output of the specified_stats test
case with NNNs, to allow the test case to succeed even if e.g. the
number of bytes allocated for hash tables differs on different
platforms (e.g. 32 vs 64 bit).
Estimated hours taken: 2
Branches: main
Fix tabling of foreign enumerations. There are two problems: (1) the
original runtime support for tabling foreign enumerations was wrong since it
treated them like ordinary enumerations and (2) the runtime had got out of
sync with the source-to-source transformation in the compiler which was
generating code that hashed foreign enumeration values.
This diff replaces the original runtime support for tabling foreign
enumerations and separates the handling of foreign enumeration values
from that of int values.
compiler/table_gen.m:
Call the new runtime infrastructure when tabling foreign enumerations.
compiler/hlds_pred.m:
Extend the type table_trie_step/0 to handle foreign enumerations.
Re-order the type table_trie_step/0 so that it matches the ordering
of table_statistics.table_step_kind/0 and MR_TableTrieStep in
runtime/mercury_tabling.h.
XXX Why does the comment above this type say that it doesn't have
to handle dummy steps and yet the type contains a able_trie_step_dummy
alternative?
compiler/rtti.m:
compiler/hlds_out.m:
Conform to the above change.
library/table_builtin.m:
Add a new service predicate for doing table lookups or insertions
of foreign enumeration values.
library/table_statistics.m:
Extend the type table_step_kind/0 to cover foreign enumerations.
runtime/mercury_table_type_body.h:
When doing an RTTI lookup on how to table a foreign enumeration value,
don't treat it as an ordinary enumeration value.
runtime/mercury_tabling.h:
Extend MR_TableTrieStep to cover foreign enumerations.
Update a reference: s/table_builtin.m/table_statistics.m.
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_pred.h:
Define macros for tabling foreign enumeration values.
tests/tabling/Mmakefile:
Enable the foreign enumeration tabling test case.
tests/tabling/.cvsignore:
Ignore some generated files.
Estimated hours taken: 30
Branches: main
Make tabling statistics much more useful, and avoid core dumps while printing
them (thereby fixing bug #23 in Mantis).
runtime/mercury_tabling.h:
Expand the set of statistics we can gather about tabling (starting
to gather information about memory consumption).
Put the statistics into logical groups: enum functors, non-enum
du functors, hash tables, and the expandable table used for I/O
tabling. For du types and polymorphic types, we can gather different
statistics for different parts of a term. We used to use one field
to gather more than one related kind of count, but these are now
separated.
Group the MR_ProcTableInfo struct fields relating to statistics
into substructures. The substructures describing a call or answer
table have their own substructures giving the statistics about the
individual steps; put these in parallel with the descriptions of the
steps themselves.
Put those substructures into two-element arrays to allow them
to be handled uniformly.
runtime/mercury_types.h:
Add the typedefs needed by mercury_tabling.h.
runtime/mercury_tabling_macros.h:
Conform to the modified classification of tabling categories.
runtime/mercury_tabling.c:
runtime/mercury_hash_lookup_or_add_body.h:
runtime/mercury_table_int_fix_index_body.h:
runtime/mercury_table_int_start_index_body.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_stats_defs.h:
runtime/mercury_tabling_stats_nodefs.h:
runtime/mercury_tabling_stats_undefs.h:
Gather the modified and expanded set of statistics.
Use more meaningful names (with MR_ prefixes) for macros.
library/table_builtin.m:
library/table_statistics.m:
Move the material relating to statistics that used to be in
table_builtin.m to the new module table_statistics.m. This is
necessary because table_builtin.m is deliberately not included
in the library documentation, yet users needs to know how to
print out and interpret tabling statistics.
Expand the code for handling statistics, adding predicates for printing
them together with (hopefully explanatory) labels.
Make it all work with the new runtime data structures.
library/library.m:
Include the new library module.
mdbcomp/prim_data.m:
Provide a way to refer to the tabling statistics module.
compiler/hlds_pred.m:
Add utility function to compute the kind of statistics we gather
for a given kind of tabling step.
compiler/rtti.m:
Change the compiler's representation of tabling's runtime data
structures to conform to the change to runtime/mercury_tabling.h.
Replace a bool with a purpose-designed type (is_array),
and add other similar types (call_or_answer_table, curr_or_prev_table).
compiler/rtti_out.m:
compiler/llds_out.m:
Output the updated data structures.
compiler/ml_code_gen.m:
Generate the updated data structures.
compiler/table_gen.m:
Update the C code we generate to gather statistics.
Gather the extra information needed by the updated data structures
in the compiler (to fill in the updated data structures in the
runtime).
compiler/mlds.m:
Add a new kind of constant, one that has just a name. This allows
ml_code_gen.m to avoid lying about the type of constants of enum tyes
(such as the kind of tabling stats we gather for a step).
compiler/modules.m:
Import the new table_statistics module automatically if any tabling
pragma asks for statistics.
compiler/add_pragma.m:
compiler/hlds_out.m:
compiler/llds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
trace/mercury_trace_cmd_developer.c:
Conform to the changes above.
tests/tabling/fib_stats.{m,exp}:
tests/tabling/specified_stats.{m,exp}:
New test cases to the test tabling statistics.
tests/tabling/Mmakefile:
Enable the new test cases.
tests/tabling/fib.m:
tests/tabling/specified.m:
Clean up the code of these test cases, which were used as the basis
of the new test cases.
Estimated hours taken: 3
Branches: main
Add an optional argument to the `specified' attribute of `pragma memo' that
allows the user to choose to table arguments introduced by the polymorphism
transformation by address instead of by value. e.g.
:- pragma memo(p/2, [specified([addr, output], hidden_arg_addr)]).
Also accept `hidden_arg_value'.
compiler/prog_io_pragma.m:
Accept the optional argument when parsing `pragma memo'.
Add some missing spaces in long error messages.
compiler/prog_data.m:
Hold the tabling method for hidden arguments when the `specified'
attribute is used.
compiler/table_gen.m:
Respect the hidden argument tabling method.
Allow typeclass_infos and base_typeclass_infos to be tabled by address
instead of aborting. The compiler still aborts if asked to table them
by value, as it's not yet implemented.
compiler/add_pragma.m:
compiler/hlds_out.m:
compiler/mercury_to_mercury.m:
Conform to the changes above.
doc/reference_manual.texi:
Add (currently commented out) documentation for the `hidden_arg_value'
and `hidden_arg_addr' options.
tests/tabling/Mmakefile:
tests/tabling/specified_hidden_arg.exp:
tests/tabling/specified_hidden_arg.m:
tests/invalid/specified.err_exp:
tests/invalid/specified.m:
Add test cases.
Estimated hours taken: 50 by quan, 8 by zs
Branches: main
Implement the runtime system for region-based memory management. This includes
the implementation of regions, region instructions and support for
backtracking.
Support for backtracking deals with preventing the destruction of backward
live regions and provides instant reclaiming of space in regions when
backtracking reaches a resume point. This support now exploits the data
in rbmm_goal_info structures. The mechanisms are documented in the
papers/rbmm module of the Mercury repository.
compiler/code_info.m:
Change the option to control the addition of region operations from
use_region to region_analysis so that no region operations are
introduced when compiling a compiler in .rbmm grade. This is temporary,
as is the re-adding of --region-analysis option.
Make use of rbmm_goal_info when generating backtrack-supporting code
for commit operations.
compiler/commit_gen.m:
Make use of rbmm_goal_info when generating backtrack-supporting code.
compiler/disj_gen.m:
Make use of rbmm_goal_info when generating semidet disjunction.
Correct one error so that use_region_disj_later is not generated in
the code for the first disjunct.
compiler/ite_gen.m:
Make use of rbmm_goal_info.
compiler/options.m:
Modify the size of disj_protect(ion) to 1 instead of 2.
library/region_builtin.m:
Change the region builtins to call to the correct region operations
in the region runtime system.
Add a predicate to print out profiling information for region-based
memory management.
runtime/mercury_region.h
runtime/mercury_region.c
New files containing the implementation of the region runtime system.
This runtime system supports its own profiling and debugging messages,
which can be turned on and off via the MR_RBMM_PROFILING and
MR_RBMM_DEBUG flags.
Note that these files are still in a state of flux.
runtime/mercury_types.h:
Add typedefs needed by declarations in mercury_region.h.
runtime/mercury_conf_paramh:
Document MR_RBMM_PROFILING and MR_RBMM_DEBUG.
runtime/mercury_imp.h:
#include mercury_region.h in rbmm grades.
runtime/Mmakefile:
Link the region runtime system into the runtime system of Mercury.
tests/tabling/Mmakefile:
Avoid accidental matches on the "mm" in "rbmm".
Estimated hours taken: 0
Branches: main
Back out the (broken) support for tabling with foreign enumerations.
(Attempting to treat foreign enumerations like normal ones for the
purposes of tabling will not work.)
compiler/table_gen.m:
Call sorry/2 if we attempt to table a foreign enumeration.
tests/tabling/Mmakefile:
Disable the table_foreign_enum test case for now.
Estimated hours taken: 50
Branches: main
Add support for foreign enumerations to Mercury. These allow the
programmer to assign foreign language values as the representation of
enumeration constructors.
e.g.
:- type status
---> optimal
; infeasible
; unbounded
; unknown.
:- pragma foreign_enum("C", status/0, [
optimal - "STATUS_OPTIMAL",
infeasible - "STATUS_INFEASIBLE",
unbounded - "STATUS_UNBOUNDED",
unknown - "STATUS_UNKNOWN"
]).
The advantage of this is that when values of type status/0 are passed to
foreign code (C in this case) no translation is necessary. This should
simplify the task of writing bindings to foreign language libraries.
Unification and comparison for foreign enumerations are the usual
unification and comparison for enumeration types, except that the default
ordering on them is determined by the foreign representation of the
constructors. User-defined equality and comparison also work for foreign
enumeration types.
In order to implement foreign enumerations we have to introduce two
new type_ctor representations. The existing ones for enum type do not
work since they use the value of an enumeration constructor to perform
table lookups in the RTTI data structures. For foreign enumerations
we need to perform a linear search at the corresponding points. This
means that some RTTI operations related to deconstruction are more
expensive.
The dummy type optimisation is not applied to foreign enumerations as
the code generators currently initialise the arguments of non-builtin
dummy type foreign_proc arguments to zero. For unit foreign enumerations
they should be initialised to the correct foreign value. (This is could be
implemented but in practice it's probably not going to be worth it.)
Currently, foreign enumerations are only supported by the C backends.
compiler/prog_io_pragma.m:
Parse foreign_enum pragmas.
Generalise the code used to parse association lists of sym_names
and strings since this is now used by the code to parse foreign_enum
pragmas as well as that for foreign_export_enum pragmas.
Fix a typo: s/foreign_expor_enum/foreign_export_enum/
compiler/prog_item.m:
Represent foreign_enum pragmas in the parse tree.
compiler/prog_type.m:
Add a new type category for foreign enumerations.
compiler/modules.m:
Add any foreign_enum pragmas for enumeration types defined in the
interface of a module to the interface files.
Output foreign_import_module pragmas in the interface file
if any foreign_enum pragmas are included in it. This ensures that
the contents that any foreign declarations that are needed by the
foreign_enum pragmas are visible.
compiler/make_hlds_passes.m:
compiler/add_pragma.m:
Add pragma foreign_enum items to the HLDS after all the types
have been added. As they are added, error check them.
Change the constructor tag values of foreign enum types to their
foreign values.
compiler/module_qual.m:
Module qualify pragma foreign_enum items.
compiler/mercury_to_mercury.m:
Output foreign_enum pragmas.
Generalise some of the existing code for writing out association
lists in foreign_export_enum pragmas for use with foreign_enum
pragmas as well.
compiler/hlds_data.m:
Add the alternative `is_foreign_type' to the type enum_or_dummy/0.
Add new type of cons_tag, foreign_tag, whose values are directly
embedded in the target language.
compiler/intermod.m:
Write out any foreign_enum pragmas for opt_exported types.
(The XXX concerning attaching language information to foreign tags
will be addressed in a subsequent change.)
compiler/llds.m:
compiler/mlds.m:
Support new kinds of rval constants: llconst_foreign and
mlconst_foreign respectively. Both of these represent tag values
as strings that are intended to be directly embedded in the target
language.
compiler/llds_out.m:
Add code to write out the new kind of rval_const.
s/Integer/MR_Integer/ in a spot.
s/Float/MR_Float/ in a spot.
compiler/rtti.m:
compiler/rtti_out.m:
compiler/rtti_to_mlds.m:
compiler/type_ctor_info.m:
Add support the RTTI required by foreign enums.
compiler/switch_util.m:
Handle switches on foreign_enums as-per normal enumerations.
compiler/table_gen.m:
Tabling of foreign_enums is also like normal enumerations.
compiler/type_util.m:
Add a predicate that tests whether a type is a foreign enumeration.
compiler/unify_gen.m:
compiler/unify_proc.m:
compiler/ml_unify_gen.m:
Handle unification and comparison of foreign enumeration values.
They are treated like normal enumerations for the purposes of
implementing these operations.
compiler/ml_type_gen.m:
Handle foreign enumerations when generating the MLDS representation
of enumerations.
compiler/ml_util.m:
Add a function to create an initializer for an object with a
foreign tag.
compiler/mlds_to_c.m:
Handle mlconst_foreign/1 rval constants.
compiler/bytecode_gen.m:
compiler/dupproc.m:
compiler/erl_rtti.m:
compiler/exception_analysis.m:
compiler/export.m:
compiler/exprn_aux.m:
compiler/global_data.m:
compiler/hlds_out.m:
compiler/higher_order.m:
compiler/inst_match.m:
compiler/jumpopt.m:
compiler/llds_to_x86_64.m:
compiler/ml_code_util.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/mlds_to_managed.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/polymorphism.m:
compiler/recompilation.version.m:
compiler/term_norm.m:
compiler/trailing_analysis.m:
Conform to the above changes.
doc/reference_manual.texi:
Document the new pragma.
Fix some typos: s/pramga/pragma/, s/behavior/behaviour/
library/construct.m:
Handle the two new type_ctor reps.
Break an over-long line.
library/rtti_implementation.m:
Support the two new type_ctor reps.
(XXX The Java versions of some of this cannot be implemented until
support for foreign enumerations is added to mlds_to_java.m.)
Reformat the inst usereq/0 and extend it to include foreign enums.
runtime/mercury_type_info.h:
Add two new type_ctor reps. One for foreign enumerations and
another for foreign enumerations with user equality.
Define new types (and extend existing ones) in order to support
RTTI for foreign enumerations.
runtime/mercury_unify_compare_body.h:
Implement generic unify and compare for foreign enumerations.
(It is the same as that for regular enumerations.)
runtime/mercury_construct.[ch]:
runtime/mercury_deconstruct.h:
Handle (de)construction of foreign enumeration values.
runtime/mercury_deep_copy_body.h:
Implement deep copy for foreign enumerations.
runtime/mercury_table_type_body.h:
runtime/mercury_term_size.c:
Handle the new type_ctor representations.
java/runtime/ForeignEnumFunctorDesc.java:
Add a Java version of the MR_ForeignEnumFuntorDesc structure.
(Note: this is untested, as the java grade runtime doesn't work
anyway.)
java/runtime/TypeFunctors.java:
Add a constructor method for foreign enumerations.
(Likewise, untested.)
NEWS:
Announce pragma foreign_enum.
vim/syntax/mercury.vim:
Highlight the new pragma appropriately.
tests/hard_coded/.cvsignore:
Ignore executables generated by the new tests.
Ignore a bunch of other files create by the Mercury compiler.
tests/hard_coded/Mmakefile:
tests/hard_coded/foreign_enum_rtti.{m,exp}:
Test RTTI for foreign enumerations.
tests/hard_coded/foreign_enum_dummy.{m,exp}:
Check that dummy type optimisation is disabled for foreign
enumerations.
tests/hard_coded/Mercury.options:
tests/hard_coded/foreign_enum_mod1.{m,exp}:
tests/hard_coded/foreign_enum_mod2.m:
Test that foreign_enum pragmas are hoisted into interface files
and that they are handled correctly in optimization interfaces.
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/invalid/foreign_enum_import.{m,err_exp}:
tests/invalid/foreign_enum_invalid.{m,err_exp}:
Test that errors in foreign_enum pragmas are reported.
tests/tabling/Mmakefile:
tests/hard_coded/table_foreign_enum.{m,exp}:
Test case for tabling of foreign enumerations.
Estimated hours taken: 4
Branches: main
Fix the warning we used to get in hlc grades when tabling tuples, and fix
the conceptual error that caused the problem.
compiler/hlds_pred.m:
library/table_builtin.m:
runtime/mercury_tabling.h:
In descriptions of tabling trie steps, replace references to
"user" (as in user-defined types) with "gen" (general types),
since these are also used for other kinds of types, such as tuples
and higher order types.
library/table_builtin.m:
runtime/mercury_tabling_macros.h:
runtime/mercury_tabling_preds.h:
Adopt a more consistent naming scheme for these tabling trie steps,
and for the Mercury predicates and C macros that operate on them.
In table_builtin.m, add a missing Mercury clause for a predicate
usually defined in C.
In mercury_tabling_macros, parameterize the diagnostic message when
doing a lookup step on a general type.
In mercury_tabling_preds, cast general value types to MR_Word,
since they can be some other type originally (e.g. if the general type
value is a tuple).
compiler/table_gen.m:
Conform to the changes above, and switch to using a single nested
switch for generating the lookup code of each step.
compiler/hlds_out.m:
runtime/mercury_table_body.h:
Conform to the changes above.
tests/tabling/expand_tuple2.{m,exp}:
New test case to test tabling of values statically known to be tries.
(The old expand_tuple test case tested tabling polymorphic values in
which the type variable was bound to a tuple, which is not the same
thing.)
tests/tabling/Mmakefile:
Enable the new test case.
Estimated hours taken: 8
Branches: main
My previous fix to dead proc elimination helped fixed some compiler aborts,
but a related problem remained.
The problem involved an unused procedure that was kept around so that the code
generator would create the table associated with it. Since the procedure was
unused, its body was thought to be unused too. If it contained a reference to a
procedure that wasn't referred to from anywhere else, that procedure would be
removed, leaving a dangling reference. This would cause a code generator abort.
We can't fix the abort by replacing the kept-around procedure's body with
"true", since that would cause a different code generator abort when moving the
(now unbound) output variables to their argument registers. We could avoid
generating any code for the procedure at all by e.g. marking it as
opt_imported, but this would (a) be inconsistent and (b) require special case
coding to still generate the table structure.
The fix is to generate the global variable used for tabling *independently* of
the procedure that enters things in the table.
compiler/hlds_module.m:
Add a field to the module_info (actually module_sub_info) that records
the information the backends need to create the global variables
representing call tables.
Name all the fields of the module_info and module_sub_info during
initialization, to make it easier to know where to add a new field.
Put the initializations of the fields in the same order as the fields
themselves.
compiler/hlds_pred.m:
Keep only the info for I/O tabling in procedures, since such tabling
does not require defining a per-procedure global variable.
Since the info for the forms of tabling that *do* require a
per-procedure global variable are now divorced from the procedure,
change their definition to avoid storing prog_vars in them, since
those prog_vars would be separated from their varset. Instead, we
record their numbers and their names (both are used only for debug
support).
On the other hand, some info from the pred_info and proc_info are
to create the global variable; copy them into the data structure stored
in hlds_module.
Rename some fields to avoid ambiguities.
compiler/table_gen.m:
Continue to record information about I/O tabling in the proc_info,
but record information about other forms of tabling in the new field
in the module_info.
compiler/rtti.m:
compiler/hlds_rtti.m:
Move the functions for constructing and deconstructing rtti_proc_labels
from rtti.m (which is in backend_libs) to hlds_rtti.m (which is in
hlds); the definition of rtti_proc_label was already in hlds_rtti.m.
The move is needed to allow table_gen to put an rtti_proc_label
in the data structures it puts in the module_info.
compiler/hlds_out.m:
Print out the new module_info field, and conform to the change to
hlds_pred and table_arg_info.
Always print variable numbers for type variables in table_arg_infos.
compiler/continuation_info.m:
Make room for either kind of tabling info for a procedure.
(While the LLDS code generator doesn't need to know about the global
variable representing the call table in order to create it, it does
need to know about it in order to describe it to the debugger.)
Conform to the change in table_arg_info.
Rename some fields to avoid ambiguities.
compiler/proc_gen.m:
When generating code for procedures, do not try to create a
per-procedure tabling struct, but do fill in the slot describing it
in the continuation_info.
Add a predicate to define all the tabling structs in a module.
compiler/mercury_compile.m:
Call proc_gen separately to define all the tabling structs.
compiler/ml_code_gen.m:
As with proc_gen, define tabling structs directly from the module_info
and not when generating code from each proc_info.
(The code for handling each proc is now logically not contiguous;
I will address that in a separate change, to make the diff for this one
easier to read.)
compiler/dead_proc_elim.m:
Don't keep unused tabled procedures alive, since that leads to the
problem described up top.
Keep track of which tabling structs are live, but don't yet act on that
information, since some uses are hidden (for now).
Add conditionally compiled tracing code that helped me trace down the
problem.
Fix an oversight in the severity level of an error spec.
compiler/base_typeclass_info.m:
compiler/code_util.m:
compiler/deep_profiling.m:
compiler/ml_code_util.m:
compiler/proc_label.m:
compiler/type_ctor_info.m:
Conform to the move of make_rtti_proc_label.
compiler/optimize.m:
Conform to the change to continuation_info.
compiler/stack_layout.m:
Conform to the data structure changes above.
doc/user_guide.texi:
Document 'Z' as the character in -D arguments that tells hlds_out
to dump the global structures needed for tabling.
Fix an old oversight: document 'S' as the character in -D arguments
that tells hlds_out to dump info about structure sharing.
compiler/handle_options.m:
Include 'Z' in -DALL -and -Dall.
tests/tabling/mercury_java_parser_dead_proc_elim_bug.{m,exp}:
Move this test case here from valid, since compiling all the way to
executable doesn't work in valid (in yields link errors unrelated to
the bug we are testing for).
tests/tabling/mercury_java_parser_dead_proc_elim_bug2.{m,exp}:
Add this new test case that in unfixed compilers gives the problem
described up top.
tests/tabling/Mmakefile:
Enable the new tests.
tests/valid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/mercury_java_parser_dead_proc_elim_bug.m:
Remove references to the moved test and the test itself.
Estimated hours taken: 1
Branches: main
Remove support for the reserve tag (.rt) grades.
These were only ever needed to support the implementation of Herbrand
variables in (older versions of) HAL.
NOTE: this change removes the .rt grade, the undocumented
reserve_tag pragma is unchanged.
runtime/mercury_grade.h:
Do not handle the .rt component. Rather than renumbering the
grade parts here I have documented that grade part 8 (formerly .rt)
is unused.
runtime/mercury_tags.h:
runtime/mercury_type_info.h:
runtime/mercury_conf_param.h:
Conform to the above change.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/options.m:
compiler/make_tags.m:
compiler/prog_type.m:
Remove the `--reserve-tag' option and modify any code
that relied upon it. Such code is largely unchanged
since it is still required for the implementation of the
reserve_tag pragma.
doc/user_guide.texi:
Delete documentation for `--reserve-tag'.
scripts/canonical_grade.sh-subr:
scripts/init_grade_otpions.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Remove support for the `.rt' grade component.
NEWS:
Announce that .rt grades are no longer supported.
extras/trailed_update/var.m:
extras/trailed_update/samples/Mmakefile:
extras/trailed_update/tests/Mmakefile:
Update some documentation.
tests/debugger/Mmakefile:
tests/tabling/Mmakefile:
Delete special handling for .rt grades.
Estimated hours taken: 0.2
Branches: main
tests/*/.cvsignore:
tests/*/.nocopyright:
Update or add these files. In particular, CVS should ingore
.mgnuc* files.
Estimated hours taken: 6
Branches: main
Fix some software rot that prevented I/O operations from working in mmos
grades. The problem was the change to the I/O module to make it use thread
local storage via a new field of the MR_Context structure which was accessed
via the MR_eng_this_context field of the engine, instead of via the
MR_eng_context field. The new field was not set by the code for initializing
the contexts used by own stack minimal model tabling.
runtime/mercury_context.h:
runtime/mercury_engine.h:
Add significant new documentation about how fields of the MR_Context
structure are accessed, both because the documentation is useful and to
make similar mistakes less likely in future.
Add a macro for use by own stack minimal model tabling.
runtime/mercury_thread.c:
Add a comment about a link to mercury_engine.h.
runtime/mercury_thread.h:
Convert to four-space indentation, and fix some formatting.
runtime/mercury_mm_own_stacks.c:
Add code for filling in the missing fields of newly created contexts.
runtime/mercury_wrapper.c:
In own stack minimal model grades, set up the main context properly.
The previous code was based on a flawed understanding of the
relationalship between MR_eng_context and MR_eng_this_context.
tests/debugger/mmos_print.{m,inp,exp}:
Add a new test case (which we don't yet pass due to a problem with
formatting of mdb output) to test the fix. The old versions of the
compiler don't pass this test case, because the "p *" commands of the
debugger invoke I/O code in the Mercury standard library, which fails
with a segfault due to the thread local fields of generators' contexts
being uninitialized.
Note that the .inp aborts execution, because without the abort the
execution would go into an infinite loop since mmos grades don't yet
have code for detecting completion.
tests/debugger/Mmakefile:
Enable the new test case in mmos grades.
Fix inconsistent indentation.
tests/tabling/Mmakefile:
Do not try to execute minimal tests in mmos grades, since we don't pass
them yet, and the symptom is in many cases an infinite loop.
Estimated hours taken: 80
Branches: main
Improvements for bitmap.m, to make it useable as a general container
for binary data.
library/bitmap.m:
runtime/mercury_bitmap.c:
runtime/mercury_bitmap.h:
Specialize the representation of bitmaps to an array of unsigned
bytes defined as a foreign type.
This is better than building on top of array(int) because it:
- is better for interfacing with foreign code
- has a more sensible machine-independent comparison order
(same as array(bool))
- avoids storing the size twice
- has more efficient copying, unification, comparison and tabling
(although we should probably specialize the handling of array(int)
and isomorphic types as well)
- uses GC_MALLOC_ATOMIC to avoid problems with bit patterns that look
like pointers (although we should do that for array(int) as well)
XXX The code for the Java and IL backends is untested.
Building the library in grade Java with Sun JDK 1.6 failed (but
at least passed error checking), and I don't have access to a
copy of MSVS.NET. The foreign code that needs to be tested is
trivial.
Add fields `bit', `bits' and `byte' to get/set a single bit,
multiple bits (from an int) or an 8 bit byte.
Add functions for converting bitmaps to hex strings and back,
for use by stream.string_writer.write and deconstruct.functor/4.
bitmap.intersect was buggy in the case where the input bitmaps
had a different size. Given that bitmaps are implemented with
a fixed domain (lookups out of range throw an exception), it
makes more sense to throw an exception in that case anyway,
so all of the set operations do that now.
The difference operation actually performed xor. Fix it and
add an xor function.
library/version_bitmap.m:
This hasn't been fully updated to be the same as bitmap.m.
The payoff would be much less because foreign code can't
really do anything with version_bitmaps.
Add a `bit' field.
Deprecate the `get/2' function in favour of the `bit' field.
Fix the union, difference, intersection and xor functions
as for bitmap.m.
Fix comparison of version_arrays so that it uses the same
method as array.m: compare size then elements in order.
The old code found version_arrays to be equal if one was
a suffix of the other.
library/char.m:
Add predicates for converting between hex digits and integers.
library/io.m:
library/stream.string_writer.m:
library/term.m:
Read and write bitmaps.
runtime/mercury_type_info.h:
runtime/mercury_deep_copy_body.h:
runtime/mercury_mcpp.h:
runtime/mercury_table_type_body.h:
runtime/mercury_tabling_macros.h:
runtime/mercury_unify_compare_body.h:
runtime/mercury_construct.c:
runtime/mercury_deconstruct.c:
runtime/mercury_term_size.c:
runtime/mercury_string.h:
library/construct.m:
library/deconstruct.m
compiler/prog_type.m:
compiler/mlds_to_gcc.m:
compiler/rtti.m:
Add a MR_TypeCtorRep for bitmaps, and handle it in the library
and runtinme.
library/Mercury.options:
Compile bitmap.m with `--no-warn-insts-without-matching-type'.
runtime/mercury_type_info.h:
Bump MR_RTTI_VERSION.
NEWS:
Document the changes.
tests/hard_coded/Mmakefile:
tests/hard_coded/bitmap_test.m:
tests/hard_coded/bitmap_simple.m:
tests/hard_coded/bitmap_tester.m:
tests/hard_coded/bitmap_test.exp:
tests/tabling/Mmakefile:
tests/tabling/expand_bitmap.m:
tests/tabling/expand_bitmap.exp:
tests/hard_coded/version_array_test.m:
tests/hard_coded/version_array_test.exp:
Test cases.