Commit Graph

667 Commits

Author SHA1 Message Date
Zoltan Somogyi
eeb69f14ba Use explicit streams in browser/*.m.
browser/browse.m:
browser/browser_info.m:
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_oracle.m:
browser/declarative_user.m:
browser/diff.m:
browser/help.m:
browser/interactive_query.m:
browser/parse.m:
browser/util.m:
    Replace implicit streams with explicit streams.

    Shorten lines longer than 79 chars.

    In some places, simplify some code, often using constructs such as
    string.format that either did not exist or were too expensive to use
    when the original code was written.

    In some places, change predicate names that were not meaningful
    without module qualification by *including* the module qualification
    in the name (e.g. init -> browser_info_init).

    In some places, add XXXs.

    In browser_info.m, make the output stream *part* of the debugger type,
    because without this, having the debugger type belong to the stream
    typeclass does NOT make sense. (The typeclass instance for debugger
    used to always write to the current output stream, which this diff
    is replacing with the use of explicitly specified streams.)

    In browse.m, consistently put stream arguments before other arguments.

    In browse.m, when exporting Mercury predicates to C, export them
    under names with the standard ML_BROWSE_ prefix, NOT under the name
    of a *different* predicate with that prefix.

    In diff.m, eliminate an unnecessary difference between what we print
    when the difference between two terms is at the root, vs what we print
    when the difference between two terms is lower down.

    In interactive_query.m, when trying to write a program out to a file,
    do NOT write the program to the current output stream if we cannot open
    the file, since that would accomplish nothing useful.

    Also in interactive_query.m, cleanup .dylib instead of .so on MacOS.

    In util.m, delete some unused predicates.

    In collect_lib.m, document why some code is not worth updating.

    In declarative_oracle.m, rename predicates with previously-ambiguous
    names.

browser/MDBFLAGS.in:
    Specify --warn-implicit-stream-calls for all Mercury modules
    in the browser directory from now.

trace/mercury_trace_browse.c:
trace/mercury_trace_cmd_browsing.c:
ssdb/ssdb.m:
    Conform to the changes in browser/*.m.

tests/debugger/queens.{exp,exp2}:
    Expect the extra output from browser/diff.m.
2021-03-05 22:54:28 +11:00
Peter Wang
524f4d72e2 Delete references to Erlang backend in makefiles.
Mmake.workspace:
Mmakefile:
*/Mmakefile:
tests/*/Mmakefile:
tests/valid/Mmake.valid.common:
trace/Mmakefile:
    As above.
2020-10-27 11:10:11 +11:00
Peter Wang
89e59e7cc8 Delete support for browsing terms as XML.
The 'browse --xml' command has not worked with current versions of
xsltproc for quite some time, but we have not received any bug reports,
nor has anyone tried to fix it. We have a method for interactively
exploring a term in 'browse --web' so IMHO there is no need to keep
support for 'browse --xml'.

browser/browse.m:
browser/browser_info.m:
browser/declarative_user.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
    Delete code.

doc/mdb_categories:
doc/user_guide.texi:
    Delete documentation.

configure.ac:
    Don't search for a XUL browser and xsltproc.

scripts/mdbrc.in:
    Delete 'xml_browser_cmd' and 'xml_tmp_filename' lines.

scripts/xul_tree.xsl:
    Delete now unused file.

scripts/Mmakefile:
    Conform to deletions.

tests/debugger/Mmakefile:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp3:
tests/debugger/browser_test.inp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
tests/declarative_debugger/browse_arg.exp:
tests/declarative_debugger/browse_arg.inp:
    Don't test 'browse --xml' any longer.

extras/xml_stylesheets/README:
    Delete reference to 'browse --xml' command.

NEWS:
    Announce change.
2020-10-14 17:41:54 +11:00
Peter Wang
7fec2d28a7 Add test for mdb 'list' external command.
tests/debugger/list_cmd.m:
tests/debugger/list_cmd.inp:
tests/debugger/list_cmd.exp:
tests/debugger/list_cmd.exp2:
    Add new test case.

tests/debugger/list_cmd.sh:
    Add script to be set as the 'list_cmd'.

tests/debugger/Mmakefile:
    Enable the new test.
2020-10-06 13:42:39 +11:00
Peter Wang
a22e973025 Let mdb run an external command for 'list'.
browser/listing.m
    Add list_file_with_command which calls an external command to print
    source listings instead of doing it internally. The implementation
    is incomplete in that the external command's standard output and
    standard error streams are not redirected into OutStrm and ErrStrm.

    Rename mercury_stream_to_c_FILE_star to
    mercury_stream_to_c_file_ptr.

    Consolidate some output calls with string.format.

trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
    Add a 'list_cmd' command which sets or prints the current
    external listing command.

trace/mercury_trace_cmd_browsing.c:
    Make 'list' command call list_file_with_command if an external
    listing command was set.

doc/user_guide.texi:
    Document 'list_cmd' command.

tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
    Update for new command.

NEWS:
    Announce changes.
2020-10-02 19:01:45 +10:00
Zoltan Somogyi
c3af04bb06 Fix the "level" command in mdb.
trace/mercury_trace_cmd_browsing.c:
    The "level" command was documented to reset the current ancestor level
    to the level of the current event (ancestor level 0) when invoked
    without arguments, but when invoked that way, it reported an error
    instead. Fix this.

tests/debugger/queens_rep.inp:
tests/debugger/queens_rep.exp:
    Add a test for the fix in this existing test case.
2020-09-27 16:11:56 +10:00
Zoltan Somogyi
9cacd33f47 Remove "is" as a synonym for "=", step 1.
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.
2020-08-21 10:42:37 +10:00
Zoltan Somogyi
58ea6ffff2 Delete old obsolete predicates and functions.
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.
2020-08-18 11:57:47 +10:00
Zoltan Somogyi
e9323be958 Improve an mdb error message.
trace/mercury_trace_spy.c:
    When the user wants to put a breakpoint on a line in a file,
    but there is no event exactly on the given line number,
    mdb used to tell the user just that fact. This diff makes
    mdb more helpful, by printing the nearest line numbers before
    and after the given line number that *do* have events on which
    breakpoints can be put.

    The mismatch can come for several reasons, with the most common
    probably being that textually, a switch arm for e.g X being f
    starts with the X = f unification goal, but switch detection
    *deletes* that unification from the switch arm, so the event
    for entry into that arm is actually on the line for the *next* goal.

trace/mercury_trace_tables.[ch]:
    Provide the info needed by mercury_trace_spy.c.

    Change the interface of MR_process_file_line_layouts to make it
    self-contained, i.e. returning counts of matches, instead of
    merely *adding* to preexisting counts. This is simpler, since
    the only caller of that function needs no running tally.

tests/debugger/breakpoints.inp:
    Extend this test to test the possible error messages we now generate.

tests/debugger/breakpoints.exp:
tests/debugger/breakpoints.exp2:
    Update the expected outputs in both debug and non-debug grades.
2020-08-08 04:22:44 +10:00
Zoltan Somogyi
1f45f91886 Make "mmake runtests" work again.
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 = .."
2020-06-10 01:05:15 +10:00
Zoltan Somogyi
afe2887882 Remove stale references to test subdirs.
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.
2020-04-14 11:23:12 +10:00
Zoltan Somogyi
9789375cc5 Make pre-HLDS passes use file-kind-specific parse trees.
Replacing item blocks file-kind-specific kinds of section markers with
file-kind-specific parse trees has several benefits.

- It allows us to encode the structural invariants of each kind of file
  we read in within the type of its representation. This makes the detection
  of any accidental violations of those invariants trivial.

- Since each file-kind-specific parse tree has separate lists for separate
  kinds of items, code that wants to operate on one or a few kinds of items
  can just operate on those kinds of items, without having to traverse
  item blocks containing many other kinds of items as well. The most
  important consequence of this is not the improved efficiency, though
  that is nice, but the increased clarity of the code.

- The new design is much more flexible. For example, it should be possible
  to record that e.g. an interface file we read in as a indirect dependency
  (i.e. a file we read not because its module was imported by the module
  we are compiling, but because its module was imported by *another* imported
  module) should be used *only* for the purpose it was read in for. This should
  avoid situations where deleting an import of A from a module, because it
  is not needed anymore, leads the compiler to generate an error message
  about a missing import of module B. This can happen if (a) module B
  always *should* have been imported, since it is used, but (b) module A's
  import of module B lead to module B's interface being available *without*
  an import of B.

  Specifically, this flexibility should enable us to establish each module's
  .int file as the single source of truth about how values of each type
  defined in that module should be represented. When compiling each source
  file, this approach requires the compiler to read in that module's .int file
  but using only the type_repn items from that .int file, and nothing else.

- By recording a single parse tree for each file we have read, instead of
  a varying number of item blocks, it should be significantly easier to
  derive the contents of .d files directly from the records of those
  parse trees, *without* having to maintain a separate set of fields
  in the module_and_imports structure for that purpose. We could also
  trivially avoid any possibility of inconsistencies between these two
  different sources of truth. (We currently fill in the fields used to
  drive the generation of .d files using two different pieces of code,
  one used for --generate-dependencies and one used for all other invocations,
  and these two *definitely* generate inconsistent results, as the significant
  differences in .d files between (a) just after an invocation of
  --generate-dependencies and (b) just after any other compiler invocation
  can witness.)

This change is big and therefore hard to review. Therefore in many files,
this change adds "XXX CLEANUP" comments to draw attention to places that
have issues that should be fixed, but whose fixes should come later, in
separate diffs.

compiler/module_imports.m:
    The compiler uses the module_and_imports structure defined here
    to go from a raw compilation unit (essentially a module to be compiled)
    to an augmented compilation unit (a raw compilation unit together
    with all the interface and optimization files its compilation needs).
    We used to store the contents of both the source file and of
    the interface and optimization files in the module_and_imports structure
    as item blocks. This diff replaces all those item blocks with
    file-kind-specific parse trees, for the reasons mentioned above.

    Separate out the .int0 files of ancestors modules from the .intN
    files for N>0 of directly imported modules. (Their item blocks
    used to be stored in the same list.)

    Maintain a database of the source, interface and optimization files
    we have read in so far. We use it to avoid reading in interface files
    if we have already read in a file for the same module that contains
    strictly more information (either an interface file with a smaller
    number as a suffix, or the source file itself).

    Shorten some field names.

compiler/prog_item.m:
    Define data structures for storing information about include_module,
    import_module and use_module declarations, both in a form that allows
    the representation of possibly erroneous code in actual source files,
    and in checked-and-cleaned-up form which is guaranteed to be free
    of the relevant kinds of errors. Add a block comment at the start
    of the module about the need for this distinction.

    Define parse_tree_module_src, a data structure for representing
    the source code of a single module. This is different from the existing
    parse_tree_src type, which represents the contents of a single source file
    but which may contain *more* than one module, and also different from
    a raw_compilation_unit, which is based on item blocks and is thus
    unable to express to invariants such as "no clauses in the interface".

    Modify the existing parse_tree_intN types to express the distinction
    mentioned just above, and to unify them "culturally", i.e. if they
    store the same information, make them store it using the same types.

    Fix a mistake by allowing promises to appear in .opt files.
    I originally ruled them out because the code that generates .opt files
    does not have any code to write out promises, but some of the predicates
    whose clauses it writes out have goal_type_promise, which means that
    they originated as promises, and get written out as promises.

    Split the existing pragma item kind into three item kinds, which have
    different invariants applying to them.

    - The decl (short for declarative) pragmas give the compiler some
      information, such as that a predicate is obsolete or that we
      want to type specialize some predicate or function, that is in effect
      part of the module's interface. Decl pragmas may appear in module
      interfaces, and the compiler may put them into interface files;
      neither statement is true of the other two kinds of pragmas.

    - The impl (short for implementation) pragmas are named so
      precisely because they may appear only in implementation sections.
      They give the compiler information that is private to that module.
      Examples include foreign_decls, foreign_codes, foreign_procs,
      and promises of clause equivalence, and requests for inlining,
      tabling etc. These will never be put into interface files,
      though some of them can affect the compilation of other modules
      by being included in .opt files.

    - The gen (short for generated) pragmas can never (legally) appear
      in source files at all. They record the results of compiler
      analyses e.g. about which arguments of a predicate are unused,
      or what exceptions a function can throw, and accordingly they
      should only ever occur in compiler-generated interface files.

    Use the new type differences between the three kinds of pragmas
    to encode the above invariants about which kinds of pragmas can appear
    where into the various kinds of parse trees.

    Make the augmented compilation unit, which is computed from
    the final module_and_imports structure, likewise switch from
    storing item blocks to storing the whole parse trees of the
    files that went into its construction. With each such parse tree,
    record *why* we read it, since this controls what permissions
    the source module being compiled has for access to the entities
    in the parse tree.

    Simplify the contains_foreign_code type, since one of three
    function symbols was equivalent to one possible use of another
    function symbol.

    Provide a way to record which method of which class a compiler-generated
    predicate is for. (See hlds_pred.m below.)

    Move the code of almost all utility operations to item_util.m
    (which is imported by many fewer modules than prog_item.m),
    keeping just the most "popular" ones.

compiler/item_util.m:
    Move most of the previously-existing utility operations here from
    prog_item.m, most in a pretty heavily modified form.

    Add a whole bunch of other utility operations that are needed
    in more than one other module.

compiler/convert_parse_tree.m:
    Provide predicates to convert from raw compilation units to
    parse_tree_module_srcs, and vice versa (though the reverse
    shouldn't be needed much longer).

    Update the conversion operations between the general parse_tree_int
    and the specific parse_tree_intN forms for the changes in prog_item.m
    mentioned above. In doing so, use a consistent approach, based on
    new operations in item_util.m, to detect errors such as duplicate
    include_module and import/use_module declarations in all kinds
    of parse trees.

    Enforce the invariants that the types of parse trees of various kinds
    can now express in types, generating error messages for their violations.

    Delete some utility operations that have been moved to item_util.m
    because now they are also needed by other modules.

compiler/grab_modules.m:
    Delete code that did tests on raw compilation units that are now done
    when that raw compilation unit is converted to a parse_tree_module_src.
    Use the results of the checks done during that conversion to decide
    which modules are imported/used and in which module section.

    Record a single reason for why we reading in each interface and
    optimization file. The code of make_hlds_separate_items.m will use
    this reason to set up the appropriate permissions for each item
    in those files.

    Use separate code for handling different kinds of interface and
    optimization files. Using generic traversal code was acceptable economy
    when we used the same data structure for every kind of interface file,
    but now that we *can* express different invariants for different kinds
    of interface and optimization file, we want to execute not just different
    code for each kind of file, but the data structures we want to work on
    are also of different types. Using file-kind-specific code is a bit
    longer, but it is significantly simpler and more robust, and it is
    *much* easier to read and understand.

    Delete the code that separates the parts of the implementation section
    that are exported to submodules, and the part that isn't, since that task
    is now done in make_hlds_separate_items.m.

    Pass a database of the files we have read through the relevant predicates.

    Give some predicates more meaningful names.

compiler/notes/interface_files.html:
    Note a problem with the current operation of grab_modules.

compiler/get_dependencies.m:
    Add operations to gather implicit references to builtin modules
    (which have to be made available even without an explicit import_module
    or use_module declaration) in all kinds of parse trees. These have
    more code overall, but will be at runtime, since we need only look at
    the item kinds that may *have* such implicit references.

    Add a mechanism to record the result of these gathering operations
    in import_and_or_use_maps.

    Give some types, function symbols, predicates and variables
    more meaningful names.

compiler/make_hlds_separate_items.m:
    When we stored the contents of the source module and the
    interface and optimization files we read in to augment it
    in the module_and_imports structure as a bunch of item blocks,
    the job of this module was to separate out the different kinds of items
    in the item blocks, returning a single list of each kind of item,
    with each such item being packaged up with its status (which encodes
    a set of permissions saying what the source module is allowed
    to do with it).

    Now that the module_and_imports structure stores this info in
    file-kind-specific parse trees, all of which have separate lists
    for each kind of item and none of which contain item blocks,
    the job of this module has changed. Now its job is to convert
    the reason why each file was read in into the (one or more) statuses
    that apply to the different kinds of items stored in it, wrap up
    each item with its status, and return the resulting overall list
    of status/item pairs for each kind of item.

compiler/read_modules.m:
    Add predicates that, when reading an interface file, return its contents
    in the tightest possible file-kind-specific parse tree.

    Refine the database of files we have read to allow us to store
    more file-kind-specific parse trees.

    Don't require that files in the database have associated timestamps,
    since in some cases, we read files we can put into the database
    *without* getting their timestamps.

    Allow the database to record that an attempt to read a file failed.

compiler/split_parse_tree_src.m:
    Rearchitect how this module separates out nested submodules from within
    the main module in a file.

    Another of the jobs of this module is to generate error messages for
    when module A includes module B twice, whether via nesting or via
    include_module declarations, with one special exception for the case
    where A's interface contains nested submodule A.B's interface,
    and A's implementation contains nested submodule A.B's implementation.
    The problem ironically was that while it reported duplicate include_module
    declarations as errors, split_parse_tree_src.m also *generated*
    duplicate include_module declarations. Since it replaced each nested
    submodule occurrence with an include_module declaration, in the scenario
    above, it generated two include_module declarations for A.B. Even worse,
    the interface incarnation of submodule A.B could contain
    (the interface of) its own nested submodule A.B.C, while its
    implementation incarnation could contain (the implementation section of)
    A.B.C. Each occurrence of A.B.C would be its only occurrence in the
    including part of its parent A.B, which means local tests for duplicates
    do not work. (I found this out the hard way.)

    The solution we now adopt adds include_module declarations to the
    parents of any submodule only once the parse tree of the entire
    file has been processed, since only then do we know all the
    includer/included relationships among nested modules. Until then,
    we just record such relationships in a database as we discover them,
    reporting duplicates when needed (e.g. when A includes B twice
    *in the same section*), but not reporting duplicates when not needed
    (e.g. when A.B includes A.B.C in *different* sections).

compiler/prog_data.m:
    Add a new type, pf_sym_name_and_arity, that exactly specifies
    a predicate or function. It is a clone of the existing simple_call_id
    type, but its name does NOT imply that the predicate or function
    is being called.

    Add XXXs that call for some other improvements in type names.

compiler/prog_data_foreign.m:
    Give a type, and the operations on that type, a more specific name.

compiler/error_util.m:
    Add an id field to all error_specs, which by convention should be
    filled in with $pred. Print out the value in this field if the compiler
    is invoked with the developer-only option --print-error-spec-id.
    This allows a person debugging the compiler find out where in the code
    an undesired error message is coming from significantly easier
    than was previously possible.

    Most of the modules that have changes only "to conform to the changes
    above" will be for this change. In many cases, the updated code
    will also simplify the creation of the affected error_specs.

    Fix a bug that looked for a phase in only one kind of error_spec.

    Add some utility operations needed by other parts of this change.

    Delete a previously internal function that has been moved to
    mdbcomp/prim_data.m to make it accessible in other modules as well.

compiler/Mercury.options:
    Ask the compiler to warn about dead predicates in every module
    touched by this change (at least in one its earlier versions).

compiler/add_foreign_enum.m:
    Replace a check for an inappropriately placed foreign_enum declaration
    with a sanity check, since with this diff, the error should be caught
    earlier.

compiler/add_mutable_aux_preds.m:
    Delete a check for an inappropriately placed mutable declaration,
    since with this diff, the error should be caught earlier.

compiler/add_pragma.m:
    Instead of adding pass2 and pass3 pragmas, add decl and impl and
    generated pragmas.

    Delete the tests for generated pragma occurring anywhere except
    .opt files, since those tests are now done earlier.

    Shorten some too-long predicate names.

compiler/comp_unit_interface.m:
    Operate on as specific kinds of parse trees as the interface of this
    module will allow. (We could operate on more specific parse trees
    if we changed the interface, but that is future work).

    Use the same predicates for handling duplicate include_module,
    import_module and use_module declarations as everywhere else.

    Delete the code of an experiment that shouldn't be needed anymore.

compiler/equiv_type.m:
    Replace code that operated on item blocks with code that operates
    on various kinds of parse trees.

    Move a giant block of comments to the front, where it belongs.

compiler/hlds_module.m:
    Add a field to the module_info that lets us avoid generating
    misleading error messages above missing definitions of predicates
    or functions when those definitions were present but were not
    added to the HLDS because they had errors.

    Give a field and its access predicates a more specific name.

    Mark a spot where an existing type cannot express everything
    it is supposed to.

compiler/hlds_pred.m:
    For predicates which the compiler creates to represent a class method
    (the virtual function, in OOP terms), record not just this fact,
    but the id of the class and of the method. Using this extra info
    in progress messages (with mmc -V) prevents the compiler from printing e.g.

        % Checking typeclass constraints on class method
        % Checking typeclass constraints on class method
        % Checking typeclass constraints on class method

    when checking three such predicates.

compiler/make.m:
    Provide a slot in the make_info structure to allow the database
    of the files we have read in to be passed around.

compiler/make_hlds_error.m:
    Delete predicates that are needed in just one other module,
    and have therefore been moved there.

compiler/make_hlds_passes.m:
    Add decl, impl and generated pragma separately, instead of adding
    pass2 and pass3 pragmas separately.

    Do not generate error messages for clauses, initialises or finalises
    in module interfaces, since with this diff, such errors should be
    caught earlier.

compiler/mercury_compile_main.m:
compiler/recompilation.check.m:
    Explicitly pass around the expanded database of parse trees
    of files that have been read in.

compiler/module_qual.collect_mq_info.m:
compiler/module_qual.m:
compiler/module_qual.qualify_items.m:
    Collect module qualification information, and do module qualification
    respectively on parse trees of various kinds, not item blocks.
    Take information about what the module may do with the contents
    of each interface or optimization file from the record of why
    we read that file, not from the section markers in item blocks.

    Break up some too-large predicates by carving smaller ones out of them.

compiler/options.m:
    Add an option to control whether errors and/or warnings detecting
    when deciding what should go into a .intN file be printed,
    thus (potentially) preventing the creation of that file.

    Add commented-out documentation for a previously totally undocumented
    option.

doc/user_guide.texi:
    Document the new option.

NEWS:
    Announce the new option.

    Mention that we now generate warnings for unused import_module and
    use_module declarations in the interface even if the module has
    submodules.

compiler/write_module_interface_files.m:
    Let the new option control whether we filter out any messages generated
    when deciding what should go into a .intN file.

compiler/parse_item.m:
    Delete actually_read_module_opt, since it is no longer needed;
    its callers now call actually_read_module_{plain,trans}_opt instead.

    Delete unneeded arguments from some predicates.

compiler/parse_module.m:
    Delete some long unused predicates.

compiler/parse_pragma.m:
    When parsing pragmas, wrap them up in the new decl, impl or generated
    pragma kinds.

compiler/parse_tree_out.m:
    Add predicates to write out each of the file-kind-specific parse trees.

compiler/parse_tree_out_pragma.m:
    Add predicates to write out decl, impl and generated pragmas.

compiler/polymorphism.m:
    Add a conditionally-enabled progress message, which can be useful
    in tracking down problems.

compiler/prog_item_stats.m:
    Conform NOT to the changes above beyond what is needed to let this module
    compile. Let that work be done the next time the functionality of
    this module is needed, by which time the affected data structures
    maybe have changed further.

compiler/typecheck.m:
    Fix a performance problem. With intermodule optimization, we read in
    .opt files, some of which (e.g. list.opt and int.opt) contain promises.
    These promises are read in as predicates with goal_type_promise,
    but they do not have declarations of the types of their arguments
    (since promises do not have declarations as such). Those argument types
    therefore have to be inferred. That inference replaces the original
    "I don't know" argument types with their actual types.

    The performance problem is that when we change the recorded argument types
    of a predicate, we require another loop over all the predicates in the
    module, so that any calls to this predicate can be checked against
    the updated types. This is as it should be for callable predicates,
    but promises are not callable. So if all the *only* predicates whose
    recorded argument types change during the first iteration to fixpoint
    are promises, then a second iteration is not needed, yet we used to do it.

    The fix is to replace the "Have the recorded types of this predicate
    changed?" boolean flag with a bespoke enum that says "Did the checking
    of this predicate discover a need for another iteration", and not
    setting it when processing predicates whose type is goal_type_promise.

compiler/typecheck_errors.m:
    Do not generate an error message for a predicate missing its clauses
    is the clauses existed but were not added to the HLDS because they were
    in the interface section.

    When reporting on ambiguities (when a call can match more than one
    predicate or function), sort the possible matches before reporting
    them.

compiler/accumulator.m:
compiler/add_class.m:
compiler/add_clause.m:
compiler/add_foreign_proc.m:
compiler/add_mode.m:
compiler/add_pragma_tabling.m:
compiler/add_pragma_type_spec.m:
compiler/add_pred.m:
compiler/add_type.m:
compiler/canonicalize_interface.m:
compiler/check_for_missing_type_defns.m:
compiler/check_parse_tree_type_defns.m:
compiler/check_promise.m:
compiler/check_raw_comp_unit.m:
compiler/check_typeclass.m:
compiler/common.m:
compiler/compile_target_code.m:
compiler/compiler_util.m:
compiler/dead_proc_elim.m:
compiler/deps_map.m:
compiler/det_analysis.m:
compiler/det_report.m:
compiler/du_type_layout.m:
compiler/field_access.m:
compiler/find_module.m:
compiler/float_regs.m:
compiler/format_call.m:
compiler/goal_expr_to_goal.m:
compiler/handle_options.m:
compiler/hlds_out_module.m:
compiler/hlds_out_pred.m:
compiler/hlds_out_util.m:
compiler/inst_check.m:
compiler/intermod.m:
compiler/introduce_parallelism.m:
compiler/layout_out.m:
compiler/make.dependencies.m:
compiler/make.module_dep_file.m:
compiler/make_hlds_warn.m:
compiler/mark_tail_calls.m:
compiler/mercury_compile_llds_back_end.m:
compiler/ml_top_gen.m:
compiler/mmakefiles.m:
compiler/mode_errors.m:
compiler/mode_robdd.equiv_vars.m:
compiler/modes.m:
compiler/module_qual.qual_errors.m:
compiler/oisu_check.m:
compiler/old_type_constraints.m:
compiler/options_file.m:
compiler/parse_class.m:
compiler/parse_dcg_goal.m:
compiler/parse_goal.m:
compiler/parse_inst_mode_defn.m:
compiler/parse_inst_mode_name.m:
compiler/parse_mutable.m:
compiler/parse_sym_name.m:
compiler/parse_type_defn.m:
compiler/parse_type_name.m:
compiler/parse_type_repn.m:
compiler/parse_types.m:
compiler/parse_util.m:
compiler/parse_vars.m:
compiler/post_term_analysis.m:
compiler/post_typecheck.m:
compiler/prog_event.m:
compiler/prog_mode.m:
compiler/purity.m:
compiler/qual_info.m:
compiler/recompilation.version.m:
compiler/resolve_unify_functor.m:
compiler/simplify_goal.m:
compiler/simplify_goal_call.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
compiler/simplify_proc.m:
compiler/state_var.m:
compiler/stratify.m:
compiler/style_checks.m:
compiler/superhomogeneous.m:
compiler/table_gen.m:
compiler/term_constr_errors.m:
compiler/term_errors.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/unused_args.m:
compiler/unused_imports.m:
compiler/write_deps_file.m:
compiler/xml_documentation.m:
    Conform to the changes above.

mdbcomp/prim_data.m:
    Move a utility function on pred_or_funcs here from a compiler module,
    to make it available to other compiler modules as well.

scripts/compare_s1s2_lib:
    A new script that helped debug this diff, and may help debug
    similar diffs the future. It can compare (a) .int* files, (b) .*opt
    files, (c) .mh/.mih files or (d) .c files between the stage 1 and
    stage 2 library directories. The reason for the restriction
    to the library directory is that any problems affecting the
    generation of any of these kinds of files are likely to manifest
    themselves in the library directory, and if they do, the bootcheck
    won't go on to compile any of the other stage 2 directories.

tests/debugger/breakpoints.a.m:
tests/debugger/breakpoints.b.m:
    Move import_module declarations to the implementation section
    when they are not used in the interface. Until now, the compiler
    has ignored this, but this diff causes the compiler to generate
    a warning for such misplaced import_module declarations even modules
    that have submodules. The testing of such warnings is not the point
    of the breakpoints test.

tests/invalid/Mercury.options:
    Since the missing_interface_import test case tests error messages
    generated during an invocation of mmc --make-interface, add the
    new option that *allows* that invocation to generate error messages.

tests/invalid/ambiguous_overloading_error.err_exp:
tests/invalid/max_error_line_width.err_exp:
tests/warnings/ambiguous_overloading.exp:
    Expect the updated error messages for ambiguity, in which
    the possible matches are sorted.

tests/invalid/bad_finalise_decl.m:
tests/invalid/bad_initialise_decl.m:
    Fix programming style.

tests/invalid/bad_item_in_interface.err_exp:
    Expect an error message for a foreign_export_enum item in the interface,
    where it should not be.

tests/invalid/errors.err_exp:
    Expect the expanded wording of a warning message.

tests/invalid/foreign_enum_invalid.err_exp:
    Expect a different wording for an error message. It is more "standard"
    but slightly less informative.

tests/invalid_submodules/children2.m:
    Move a badly placed import_module declaration, to avoid having
    the message the compiler now generates for it from affecting the test.

tests/submodules/parent2.m:
    Move a badly placed import_module declaration, to avoid having
    the message the compiler now generates for it from affecting the test.

    Update programming style.
2020-03-13 12:58:33 +11:00
Peter Wang
a0432ca2b5 Update an expected output after changes to library/io.m. 2019-11-21 09:58:03 +11:00
Peter Wang
544f3bf095 Use musl getopt implementation.
LICENSE:
    Mention files derived from musl library.

runtime/process_getopt:
    Process files from ../getopt/*.[ch] to produce
    mercury_getopt.h, mercury_getopt.c, mercury_getopt_long.c.

runtime/mercury_getopt.h:
runtime/mercury_getopt.c:
runtime/mercury_getopt_long.c:
    Add files generated by process_getopt.

runtime/Mmakefile:
    Update list of source files.

util/Mmakefile:
    Use musl getopt if the system C library does not have getopt().

tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
tests/debugger/browser_test.exp3:
tests/hard_coded/runtime_opt.exp:
    Update expected error messages to match new getopt() output.

changed exp output
2019-06-10 13:30:49 +10:00
Zoltan Somogyi
86f563a94d Pack subword-sized arguments next to a remote sectag.
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.
2018-08-30 05:14:38 +10:00
Zoltan Somogyi
a98127a43d Update line numbers after recent changes. 2018-08-30 03:29:00 +10:00
Zoltan Somogyi
7df5045e93 Update expected outputs after my recent change ...
... and record the bootcheck grade of those expected output files.
2018-08-29 02:58:25 +10:00
Zoltan Somogyi
59b11f84ce Update the debugger test directory.
Replace __ with . as the module qualifier symbol.

Replace references to io.state with just io.

Replace DCGs with state variables.

Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.

Replace if-then-elses with switches when possible and where this does not
affect what is being tested.

Replace separate pred and mode declarations with predmode declarations.

Put predicate and function declarations just before the definition
of the predicate or function.

Delete unneeded module qualifications on predicate and function declarations
and definitions.

Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.

For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
2018-08-28 21:20:59 +10:00
Zoltan Somogyi
d4ecc19cc5 Improve mdb's "print io" command.
trace/mercury_trace_cmd_browsing.c:
    Lift the hard-wired limit on printing a maximum of 20 I/O actions at once
    by adding the option "-m max" to the "print io" command. Keep the default
    at 20 for its "print io" form, which prints the next batch of I/O actions,
    but move it up to 500 for the "print io *" form, which is intended
    to print *all* I/O actions.

    Use separate functions for processing the options of the "print" and
    "browse" mdb commands. The new -m option applies only to the print command,
    while the existing -w and -x options apply only to the browse command.

    Make "print io N" print the same out-of-range error message as
    "print io N-M". This inconsistency was an oversight.

doc/user_guide.texi:
    Document the changes above. Document some previously existing aspects
    of the "print io" command that should have been documented but weren't.

    Change some other documentation to refer to "I/O actions" instead of
    just "io actions".

tests/debugger/tabled_read_decl.exp:
    Expect the updated error message for an out-of-range  "print io N".

tests/debugger/tabled_typeclass.{inp,exp,exp2}:
    Print the I/O actions we want using a single "print -m 100 io *" command.
2018-08-08 10:48:54 +10:00
Peter Wang
936c3dfde5 Fix failing tabled_typeclass test case.
tests/debugger/Mmakefile:
    Filter memory addresses from the output.

tests/debugger/tabled_typeclass.inp:
    Print all io actions in two steps: 0-5 for non-debug grades,
    then 6-29 for debug grades.

tests/debugger/tabled_typeclass.exp:
tests/debugger/tabled_typeclass.exp2:
    Update expected outputs.

    Conform to changes to the io module.
2018-08-07 16:27:32 +10:00
Peter Wang
fd24b2e331 Don't compress failed test executables.
Disk space isn't the concern that it used to be so compressing
failed test executables is mostly just a waste of time.

tests/run_one_test:
    Don't compress failed test executables.

tests/Mmake.common:
    Delete clean_zip target.

tests/*/.gitignore:
    Delete *.gz ignore patterns.
2018-07-31 16:32:41 +10:00
Zoltan Somogyi
297114dfd4 Add a systematic test of argument packing. 2018-04-12 00:19:22 +10:00
Zoltan Somogyi
efde8bef9b Update this exp file for an ancient change. 2018-04-11 23:42:23 +10:00
Zoltan Somogyi
606898fd5d Update expected output for library/int64.m. 2018-02-15 09:06:54 +11:00
Zoltan Somogyi
4b052d46dd Allow a test to pass with non-80-column terminals.
This fix is from Keri Harris.
2017-09-27 19:39:40 +10:00
Julien Fischer
330bd9273f Fix a debugging test case failure.
tests/debugger/breakpoints.exp2:
    Conform to the addition of the new integer types.
2017-09-08 03:07:17 -04:00
Julien Fischer
15f3e92bf1 Compile time simplification of fixed size integer operations.
Fix a failing debugger test case.

compiler/simplify_goal_call.m:
     Avoid the check for division by zero in (/) and (rem) when the second
     operand is a non-zero constant for the fixed size integer types.

     Replace (<<) and (>>) with their unchecked variants if the second operand
     is within the valid range for the fixed size integer types.

     Generalise some code to make it suitable for all of the integer types.

     Do not hardcode the names of integer modules in so many places.

     Fix a bug: the current instmap was being passed to
     simplify_improve_library_call twice.

tests/debugger/save.exp:
     Update this expected output; it corresponds to the case where no
     XUL browser (i.e. firefox) is available.
2017-09-07 21:27:10 -04:00
Peter Wang
0d273769fc Add web browser-based term browsing in the debugger.
browser/browse.m:
    Add save_and_browse_browser_term_web to be called when
    "browse --web" is entered at the mdb prompt.

    Add browser_term_to_html_flat_string, a helper predicate for
    term_to_html.

    Make portray_flat_write_browser_term work take a stream parameter
    instead of writing to the current output stream. It is called by
    browser_term_to_html_flat_string, writing to a string builder
    stream.

browser/browser_info.m:
    Add web_browser_cmd field to browser_persistent_state.

browser/mdb.m:
browser/term_to_html.m:
    Add new module to generate an HTML document. The document contains a
    JavaScript represention of a Mercury term.

    (The JavaScript string escaping code is adapted from Julien's
    mercury-json project.)

browser/percent_encoding.m:
    Add new module to perform percent-encoding.

scripts/mdb_term_browser.css:
scripts/mdb_term_browser.js:
    Add JavaScript and CSS files referenced by the generated HTML file
    to create a tree view of a Mercury term using jstree.

scripts/32px.png:
scripts/40px.png:
scripts/throbber.gif:
scripts/jstree.min.js:
scripts/jstree.style.min.css:
    Add local copy of jstree files <https://www.jstree.com/>

scripts/jquery.slim.min.js:
    Add local copy of jquery <https://jquery.com/>

scripts/Mmakefile:
    Install the new files into the same directory as mdbrc and other
    mdb-related files.

trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
    Add "browse --web" and "web_browser_cmd" commands.

doc/user_guide.texi:
    Document "browse --web" and "web_browser_cmd" commands.

configure.ac:
scripts/mdbrc.in:
    Set a reasonable default command to launch a web browser from mdb.
    (Only tested on Linux.)

NEWS:
    Announce the new feature.

.README.in:
    Mention jquery and jstree licensing.

tests/debugger/Mmakefile:
tests/debugger/completion.exp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
    Update debugger tests for new commands.
2017-08-15 16:14:55 +10:00
Zoltan Somogyi
9f21599081 Update a test case for the change to aggregate ops' determinisms. 2017-03-08 11:43:39 +11:00
Zoltan Somogyi
723233914b Update an expected output after changes to library/io.m. 2016-11-04 01:47:16 +11:00
Zoltan Somogyi
f9c8453a15 Add a new option, --warn-no-stream-calls.
compiler/options.m:
doc/user_guide.texi:
NEWS:
    Add the above option.

compiler/simplify_goal_call.m:
    If the option is given, then generate severity_informational messages
    for calls to I/O predicates such as io.write_string/3, which have twins
    (in this case io.write_string/4) that take an extra initial argument
    that explicit specifies the stream to do the I/O on.

    Additionally, generate warnings for the predicates that update
    the library's notion of the current input and outpuy streams,
    since these are effectively the "enablers" for the calls that the
    above paragraph describes.

    Fix the conditions on some error specs.

    Delete a duplicated comment.

compiler/simplify_tasks.m:
    Add the new task to the list of tasks that simplification
    may be asked to do.

compiler/simplify_info.m:
compiler/simplify_proc.m:
    Fix an old minor bug: shut up *all* messages, whether their severity
    is error, warning or informational, during the second pass of
    simplification. (The need for the fix is described in the new comment
    in simplify_proc.m.)

compiler/common.m:
compiler/simplify_goal.m:
compiler/simplify_goal_disj.m:
compiler/simplify_goal_ite.m:
    Conform to the changes above.

tests/warnings/save.{m,exp}:
    A new test case to test the new option.

tests/warnings/Mmakefile:
    Enable the new test case.

    Switch to a more consistent indentation style.

tests/warnings/Mercury.options:
    Run the new test case with the new option.

tests/debugger/save.m:
    The new test case, warnings/save.m, is a version of debugger/save.m
    with up-to-date programming style. Update the original as well.
2016-10-11 10:40:10 +11:00
Zoltan Somogyi
eebe10bf23 Update an expected output after the change to solutions.m. 2016-07-08 17:18:38 +02:00
Julien Fischer
85e621c219 Fix failing debugger test.
test/debugger/interactive.exp:
    Conform to recent changes to the list module.
2016-07-01 11:54:21 +10:00
Zoltan Somogyi
590b34cfac Fix some minor problems in reporting determinism errors.
compiler/det_report.m:
    When a goal has too many solutions, but it occurs in a context in which
    the identity of those solutions does not matter, the compiler inserts
    a commit scope to prune away the redundant (because they are externally
    indistinguishable) solutions.

    When this goal is a switch inside a require_switch_arms_<detism> scope,
    this commit scope added by determinism analysis screwed up the expectation
    of the require_switch_arms_<detism> scope that the switch is its IMMEDIATE
    subgoal. Relax this sometimes-wrong assumption by allowing for a commit
    scope wrapped around the switch.

    When generating error messages for cons_ids missing from switches,
    don't print the module qualifiers for the cons_ids, since users
    will already know it (it is part of the identity of the type of switch-on
    variable).

    Print the missing cons_ids one per line, to make the list easier to read.

    Fix capitalization in some error messages.

compiler/switch_detection.m:
    When creating switch arms, give each arm a more meaningful context
    that the context of the original disjunction, which is usually the context
    of the first ";" operator in it.

tests/invalid/switch_arm_multi_not_det.{m,err_exp}:
    New test case for the fix listed first for det_report.m.

tests/invalid/Mmakefile:
    Enable the new test case.

tests/debugger/dice.exp*:
tests/invalid/det_errors.err_exp:
tests/invalid/require_scopes.err_exp:
    Update these expected outputs for the changes above.
2016-05-13 05:48:47 +10:00
Zoltan Somogyi
764c7ff755 Finish removing the .picreg grade component.
compiler/compute_grade.m:
compiler/file_names.m:
compiler/options.m:
scripts/parse_grade_options.sh-subr:
    Delete code that understood references to picreg.

tests/debugger/Mercury.options:
tests/hard_coded/Mercury.options:
    Don't specify picreg options.
2016-03-10 12:05:39 +11:00
Mark Brown
8e0eb72c15 Various improvements to mdb's interactive query mechanism.
Estimated hours taken: 26

Implement the following improvements:
  - Pass mdb variable bindings to the interactive query processor,
    allowing queries to make use of live values.
  - Catch exceptions thrown by queries, rather than crashing mdb.
  - Write outputs using io.write_cc/3.
  - Don't output underscore variables, avoiding spurious warnings.
  - More protection of the user's namespace.
  - Updated the cleanup code.

browser/interactive_query.m:
    The interface now accepts corresponding lists of names and values,
    which are matched up with variables occurring in the queries.

    Replace the code generator with one that supports passing data
    to and from the query, and catching exceptions from the query.
    Pass the appropriate data at the time the query predicate is called.
    Distinguish between failure of the query and failure of the dynamic
    casts used to instantiate the query inputs.

    Use module qualifiers to avoid clashing with user imports. (Should the
    generated code use use_module, just in case?)

    Perform I/O, failure handling and exception handling in the caller
    instead of in the generated code. This is faster, more maintainable,
    and means that errors are caught earlier.

    Place source_file and line directives more carefully so as to ensure
    more consistent error messages, and to help distinguish errors in the
    template from errors in the query.

    Factor out the query command parser to avoid double maintenance.

browser/debugger_interface.m:
    Conform to above changes.

trace/mercury_trace_vars.[ch]:
    Export MR_trace_return_bindings, which constructs Mercury lists
    of the variable names and values in the current environment.

trace/mercury_trace_browse.c:
    Pass bindings from trace/mercury_trace_vars through to the interactive
    query processor.

tests/debugger/interactive.{m,inp,exp}:
    Update for changes to existing functionality. Additionally test the
    new functionality.

doc/user_guide.texi:
    Document the new behaviour.

NEWS:
    Announce the new behaviour.
2016-02-07 04:09:04 +11:00
Julien Fischer
01995716e9 More test suite cleanups.
tests/benchmarks/Mmakefile:
    Delete variables only used with the IL or GCC back-ends.

tests/debugger/Mmakefile:
tests/declarative_debugger/Mmakefile:
tests/par_conj/Mmakefile:
    Delete references to the IL backend.

tests/par_conj/dep_par_10.m:
    Add missing C# and Java foreign procs.

tests/dppd/Mmakefile:
    Run these tests in the Java grade.

tests/general/Mmakefile:
    Delete a workaround for OSF/1 -- we no longer support it.

tests/hard_coded/Mmakefile:
    Delete the unused list of tests that will pass in the Java grade.

    Delete a reference to the IL backend.
2016-01-02 02:18:04 +11:00
Zoltan Somogyi
b964f5802c Make `break' auto-complete on the filename:linenumber of events.
Mdb supports the location of a breakpoint to be specified either
as a procedure name, or as a source location in the form of a
filename/linenumber pair. It has long had readline auto-complete
on procedure names; this diff adds auto-complete on source locations as well.

NEWS:
    Announce the new capability.

trace/mercury_trace_completion.{h,c}:
    Add a completer for break commands that is separate from the existing
    one that completes only procedure specifications. The new one completes
    on both those AND on the filename:linenumber of all the events in all
    the debuggable modules of the program.

    Move all the forward declarations of static functions to the top
    of mercury_trace_completion.c, and put them in the same order as
    the corresponding definitions.

trace/mercury_trace_internal.c:
    Use the new completer for the "break" command.

trace/mercury_trace_spy.c:
trace/mercury_trace_tables.c:
    Fix some documentation.

tests/debugger/completion.{inp,exp}:
    Update this test. Update the input, because in some cases, this diff
    causes the shortest unambiguous extension of the current line so far
    to become shorter, due to the addition of source locations to the set
    of strings being given to readline. And update the output to show
    the now-expanded set of matching strings at the points at which
    completion is taking place.
2015-12-18 12:07:16 +11:00
Zoltan Somogyi
c6ab550db8 Remove the code for automatic initialization of solver vars.
We haven't supported it in years, and keeping it in the compiler
is just a maintenance burden and a performance problem.

mdbcomp/prim_data.m:
    Delete the spec_pred_init functor, since we don't support special
    "init" predicates anymore.

compiler/prog_data.m:
    Delete the slot in solver type details that record the name of the
    auto-initialization predicate.

compiler/prog_io_type_defn.m:
    Don't allow a type definition to specify an auto-initialization predicate.

compiler/options.m:
compiler/globals.m:
    Delete the option that allowed support for auto-initialization to be
    turned back on.

compiler/inst_match.m:
compiler/inst_util.m:
    Delete comments about auto-initialization.

compiler/mode_info.m:
    Delete the record of whether we have variables that can be
    auto-initialized (we never do anymore) and the flag that controls whether
    auto-initialization is permitted or not.

compiler/modecheck_conj.m:
    Simplify the code that modechecks conjunctions, since it no longer
    has to figure out where to insert auto-initializations of solver vars.

compiler/modecheck_goal.m:
    Delete the code that ensured that if one branch of a branched
    control structure auto-initialized a solver variable, then they
    all did.

compiler/modecheck_unify.m:
    Don't auto-initializate variables before unifications.

compiler/modecheck_util.m:
    Delete the code that auto-initialized solver variables at the ends
    of procedure bodies if this needed to be done and wasn't done before.

compiler/add_special_pred.m:
compiler/equiv_type.m:
compiler/equiv_type_hlds.m:
compiler/get_dependencies.m:
compiler/hlds_module.m:
compiler/hlds_pred.m:
compiler/modecheck_call.m:
compiler/modes.m:
compiler/module_qual.qualify_items.m:
compiler/parse_tree_out.m:
compiler/post_term_analysis.m:
compiler/smm_common.m:
compiler/special_pred.m:
compiler/term_constr_errors.m:
compiler/term_constr_initial.m:
compiler/term_util.m:
compiler/termination.m:
compiler/trace_params.m:
compiler/type_util.m:
compiler/unify_proc.m:
    Delete code that handled stuff related to auto-initialization,
    and now always take the path that would normally be taken in the
    absence of auto-initialization.

deep_profiler/read_profile.m:
runtime/mercury_layout_util.c:
runtime/mercury_stack_trace.c:
util/mdemangle.c:
    Remove code that recognized the compiler-generated name of initialization
    predicates.

tests/debugger/solver_test.m:
tests/hard_coded/solver_construction_init_test.m:
tests/hard_coded/solver_disj_inits.m:
tests/hard_coded/solver_ite_inits.m:
tests/invalid/missing_init_pred.m:
tests/invalid/zinc2mer_lib.m:
tests/valid/fz_conf.m:
tests/valid/solver_type_bug_2.m:
tests/valid/solver_type_mutable_bug.m:
    These tests tested the handling of auto-initialization, which we
    no longer support. Keep them around (and a bit more visible than
    inside the git repo) in case we need them again, but add a comment
    to each saying that the test is disabled.

tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/invalid/Mercury.options:
tests/invalid/Mmakefile:
tests/valid/Mercury.options:
tests/valid/Mmakefile:
    Disable those tests.

tests/warnings/non_term_user_special.{m,exp}:
    Part of this test tested the handling of auto-initialization;
    delete that part.

tests/warnings/Mercury.options:
    Delete the flag required by the deleted part, since we don't support it
    anymore.
2015-12-03 05:06:28 +11:00
Zoltan Somogyi
ef6d68a88d Add items to the HLDS by kinds, not in passes.
There are several reasons for this change.

First, it is more flexible than the previous arrangement of adding items
to the HLDS in three passes. Since adding a fourth pass would have had
significant performance implications, we refrained from making changes
that would have required a fourth pass in a pass-based algorithm.
With the new structure, such changes do not lead to any detectable slowdown,
so there is no reason why we should avoid making them.

In fact, the immediate motivation for this diff is to make such a change.
This is a fix for Mantis bug 318, which requires adding abstract and/or
non-foreign definitions for types before foreign definitions for those types
*regardless* of their relative order in the source code.

This diff also has the side effect that e.g. the mode declarations for
a predicate don't have to follow the declaration of the (type of) the predicate
itself. Pred and mode declarations used to be processed in the same pass,
but now, all pred declaration are processed before all mode declarations.

Second, as identified earlier, the new structure is conceptually cleaner than
the old one, and the constraints on when different kinds of items have to be
added to the HLDS can documented next to the code that does the adding,
since that code is no longer mixed with code that adds other kinds of items
at the same time.

Third, the code we used to use to detect invalid type definitions
was only a crude approximation. With the new setup, it is trivial to use
an exact computation. We now proceed to later compiler passes in many cases
that previously led us to stop before type checking because we (erroneously)
believed that the program had an invalid type definition.

Fourth, my benchmarking shows a speedup on tools/speedtest -l -m of about
1.2% to 1.5%. The new approach does allocate a bit more memory (a pair
and a cons cell per item), but it traverses most items just once, not
three times. A few kinds of items (e.g. pred declarations) do have to be
processed more than once, e.g. both before and after some other kinds
of items are added to the HLDS, but four of the five most frequent items
in bootchecks (the pragmas recording the results of the termination and
exception analyses, mode declarations, and clauses) are processed just once.
Evidently, the speedup from traversing fewer items, and avoiding the
switches on item kinds that those traversals involve, is greater than
the extra cost of the additional memory allocations, including their effect
on garbage collection times.

compiler/make_hlds_passes.m:
    Make the change described above.

    Remove "shim" code, i.e. code that serves only to unpack the pairing
    of an item with other info such as a status, and code that tests
    that status, e.g. to see whether the item is defined in the module
    being compiled. Move that shim code to the other submodules of
    make_hlds.m. (We used to have add_xyz predicate in make_hlds_passes.m
    and module_add_xyz predicates in those submodules, in which add_xyz
    contained only shim code and a call to the corresponding module_add_xyz
    predicate.)

compiler/add_class.m:
compiler/add_mutable_aux_preds.m:
compiler/add_pred.m:
compiler/add_solver.m:
    Move shim code here from make_hlds_passes.m.

    Give some predicates better names.

    In a few cases, remove unneeded arguments from predicates. For example,
    most predicates that do only checks don't need write access to the
    module_info.

compiler/add_pragma.m:
    Use subtypes to make the code a bit more efficient.

    Add specialized fold predicates that can handle those subtypes.

compiler/add_type.m:
    Add documentation for an old design decision.

compiler/make_hlds.m:
    Add some utility types for use by make_hlds_passes.m and the various
    add_xyz.m.

compiler/check_typeclass.m:
    Improve an error message. We now get this error message even for modules
    on which the compiler previously stopped before getting to typechecking.

compiler/modes.m:
    Don't generate redundant error messages for mode errors in mutables' aux
    preds. (Previously, the mode checker wouldn't have been invoked if
    make_hlds_passes.m found the original problem.)

compiler/prog_item_stats.m:
    Delete an unneeded import.

library/list.m:
    Add an inst-preserving version of reverse, since make_hlds_passes.m
    now needs one.

tests/debugger/solver_test.exp:
    We add predicates to the HLDS in a different order now (auxiliary
    predicates for solver types are added *after* used-defined predicates).
    This test prints the raw order of those predicates, so expect the new
    order.

tests/invalid/typeclass_test_9.err_exp:
tests/invalid_purity/purity_nonsense2.err_exp:
    Expect error messages we didn't used to get, because the compiler
    stopped before typechecking due to (incorrectly) believing that it found
    an invalid type definition.

    For typeclass_test_9, expect the updated error message from
    check_typeclass.m. (This newly printed error message was the reason
    *why* I improved the message from check_typeclass.m.)

tests/invalid/tc_err1.err_exp:
tests/invalid/tc_err2.err_exp:
tests/invalid/typeclass_bogus_method.err_exp:
tests/invalid/typeclass_missing_mode_2.err_exp:
tests/invalid/typeclass_test_10.err_exp:
tests/invalid/typeclass_test_3.err_exp:
tests/invalid/typeclass_test_4.err_exp:
    Expect the updated error message from check_typeclass.m.

tests/valid/bug318.m:
    A test case for Mantis bug 318.

tests/valid/Mmakefile:
    Enable the new test case.
2015-10-29 14:13:46 +11:00
Zoltan Somogyi
bd641cc5d7 Expect the context information I added recently. 2015-10-18 06:00:06 +11:00
Zoltan Somogyi
8a764392d9 Avoid warnings from make in test directories.
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.
2015-09-08 05:57:53 +10:00
Zoltan Somogyi
6b124de0a7 Serialize the creation of the dice test's slices.
Without this, mmake -jN may try to create the slices in parallel. Since that
task involves moving trace counts files, whose names are unpredictable (they
include the process id), we do it by moving all files whose names fit the
associated a pattern. If more than one slice is being created at any one time,
this meant that one invocation of the mmake rule doing the moving can "steal"
the trace counts file from another.
2015-09-04 07:42:59 +10:00
Zoltan Somogyi
c34f6dd4e8 Let the compiler bootstrap in decldebug grades again.
The big diff that replaced the item list with proper parse trees included code
that the compiler couldn't handle in decldebug grades, aborting with a message
about liveness mismatch between different switch arms. The problem occurred
when compiling this code in generate_missing_start_section_warning_int,
which is one arm of a switch on !.MissingStartSectionWarning:

    !.MissingStartSectionWarning =
        have_not_given_missing_section_start_warning,
    !:MissingStartSectionWarning =
        have_given_missing_section_start_warning,
    Pieces = [invis_order_default_start(1), ...],
    _Spec = error_spec(severity_error, phase_term_to_parse_tree,
        [simple_msg(Context, [always(Pieces)])])

The problem was liveness.m's handling of the from_ground_term_construct
scope that is generated for the assigmnet of the ground term to Pieces.

compiler/liveness.m:
    During the first pass through the procedure body, the liveness pass,
    replace with the empty conjunction any from_ground_term_construct scopes
    that construct terms to assign to dead variables. This prevents the
    second pass, the deadness pass, from including the dead variable
    (Pieces in the above example, after the assignment to _Spec was
    optimized away by earlier passes) in the set of variables that
    have been seen, since obviously, they won't be seen in the other arms.
    This inclusion was the cause of the assertion failure that led to
    the compiler abort.

    Improve the existing debugging infrastructure to help find bugs like this,
    by printing out what the selected procedure's body looks like before
    as well as after the initial requantification.

compiler/quantification.m:
    Replace from_ground_term_construct scopes whose ground term is assigned
    to a dead variable with empty conjunctions, so that the compiler passes
    between the first quantification after mode checking and the liveness
    pass also see a smaller HLDS.

    Implement an unrelated improvement whose possibility I discovered when
    investigating why a version of the test case *without* the from_ground_term
    scope wasn't getting the abort. When processing unifications, build up the
    set of variables in the unification directly, not by recording a bunch
    of maybe(somethings)s and then processing the somethings, if they existed,
    later. This yields code that is shorter, simpler *and* faster.

tests/valid/liveness_disagree.m:
    A new test case for this bug. It is a cut-down version of
    generate_missing_start_section_warning_int.

tests/valid/Mmakefile:
tests/valid/Mercury.options:
    Enable the new test case, and try to compile it in a declarative debugging
    grade.

compiler/assertion.m:
compiler/deep_profiling.m:
compiler/lookup_switch.m:
compiler/par_loop_control.m:
    Add module qualifications in several places. I found the need for these
    when I temporarily redefined the set_of_var type to use sets instead of
    sparse_bitsets, to make debugging the bug in liveness.m easier; without
    them, I got errors about excessive overloading.

    Do some other cleanups as well.

tests/debugger/all_solutions.exp4:
tests/debugger/exception_cmd.exp3:
tests/debugger/loopcheck.exp3:
tests/debugger/uci_index.exp2:
tests/declarative_debugger/Mmakefile:
tests/declarative_debugger/builtin_call_rep.exp:
tests/declarative_debugger/catch_retry.exp:
tests/declarative_debugger/condition_bug.exp:
tests/declarative_debugger/find_origin.exp3:
tests/declarative_debugger/lpe_example.exp3:
tests/declarative_debugger/priv_builtin_bug.exp:
tests/declarative_debugger/solns.exp3:
tests/declarative_debugger/sort.exp:
tests/declarative_debugger/track_through_catch.exp:
tests/declarative_debugger/typed_unify.exp:
    Update all these expected outputs for the changes in line numbers
    caused by my cleanups of the test cases early in 2015.

    For the declarative_debugger/{condition_bug,sort} test cases, also
    update them for the change to print the types and values of foreign types.

tests/hard_coded/type_qual.{m,exp}:
    This test case failed for an earlier version of this diff, so add some
    context to its outputs, to make such failures easier to debug.
    To make *that* easier, bring it to date in programming style.
2015-08-29 13:07:01 +10:00
Julien Fischer
4bbc1e48eb Make mdb interactive queries work on OS X.
browser/interactive_query.m:
    Use '.dylib' as the extension for the shared library we generate for
    interactive queries when on OS X.  (While '.so' would work in principle,
    its use is unusual on OS X and the Mercury compiler will always use
    '.dylib' anyway.)

    Replace some sequences of I/O operations with single calls to io.format
    so that message components are not spread over multiple lines.

    Add an XXX comment about object file extensions.

    Update comments that refer to 'libquery' rather than 'libmdb_query'.

README.MacOS:
    Delete interactive queries from the list of unsupported features.

tests/debugger/interactive.exp:
    Update this expected output.  The changes are due to earlier
    changes to the formatting and presentation of error messages.
2015-08-21 22:15:30 +10:00
Zoltan Somogyi
f6aafec917 Print more info for foreign types.
runtime/mercury_ml_expand_body.h:
    When deconstructing values of foreign types, include the type name
    and the hex version off the value in the function symbol we generate.

tests/debugger/Mmakefile:
    Replace the hex values of foreign types, which depend on the precise
    layout of an executable, with 0xXXXXs.

    Remove an old redundant rule.

tests/debugger/foreign_type.exp:
    Expect the type names and the (filtered) values, both when the foreign type
    value is printed by the program, and when it is printed by the debugger.
2015-05-31 14:58:44 +02:00
Zoltan Somogyi
2f4f8c72cd Prepare for printing more info about foreign type values.
runtime/mercury_deconstruct.h:
    Bring this module up to our current standards of programming style,
    by making type names only camelcase, not camelcase AND underscores.

runtime/mercury_deconstruct.c:
runtime/mercury_ml_expand_body.h:
runtime/mercury_ml_functor_body.h:
library/deconstruct.m:
    Conform to the above.

    In mercury_ml_expand_body.h, fix an old mistake in documentation.

library/rtti_implementation.m:
    Bring this module up to our current standards of programming style.
    Note some inconsistencies. Factor out some common code.

tests/hardcoded/foreign_type.m:
    Bring this module up to our current standards of programming style.

tests/debugger/foreign_type.{m,inp,exp}:
    A new test case, to test the printing of values of foreign types.

tests/debugger/Mmakefile:
    Enable the new test case.
2015-05-31 14:22:55 +02:00
Julien Fischer
88ba726688 Fix various minor problems.
Mmakefile:
	Run the realclean_tests target *before* the realclean_subdirs
	target since the former requires scripts/mmake to exist and
	the latter deletes it.

tests/debugger/save.exp:
	Update this expected output to conform to recent changes.
	(The .exp2 file was updated as part of those changes, but
	this one wasn't.)

trace/mercury_trace_cmd_breakpoint.c:
trace/mercury_trace_source.c:
	Avoid warnings from GCC.
2015-03-27 13:40:24 +11:00
Zoltan Somogyi
aa2c89d12e Update expected outputs for --debug bootchecks. 2015-02-19 13:46:52 +11:00
Zoltan Somogyi
73f0a36719 Allow the use of -jN in many test directories.
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.
2015-02-19 06:02:45 +11:00