Estimated hours taken: 8
Branches: main
Factor out the common Mmake code to set up the mmc, mgnuc
and ml flags when building the Mercury compiler and libraries.
Use options, not environment variables. This will make it simpler
to use `mmc --make' to compile the compiler.
Mmake.workspace:
Similar to tools/lmc. Sets up Mmake variables to
use the library files in a workspace rather than
an installed library.
configure.in:
Check for the `--no-mercury-stdlib-dir' mmc option.
Bootstrap CVS tag: bootstrap_20020429_stdlib_dir
Mmake.common.in:
*/Mmakefile:
Move common code into Mmake.workspace.
browser/Mmakefile:
library/Mmakefile:
Avoid invoking the linker explicitly when creating
libraries of Mercury code. That won't work well
with `mmc --make'.
tools/bootcheck:
tests/Mmake.common:
Use Mmake.workspace instead of setting up environment
variables in bootcheck.
scripts/Mmake.vars.in:
mmc compiles split C files to object code itself,
so pass `--cflags "$(ALL_CFLAGS)"' to mmc when
compiling with `--split-c-files'.
browser/interactive_query.m:
Use `mmc --make' when compiling the query. This is needed
to make tests/debugger/interactive_query.m work when linking
against a workspace using options rather than environment
variables. This also fixes a bug -- mmc options were being
passed to ml.
Clean up after the query.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
Generate the input file to this test so that MCFLAGS
and MC_MAKE_FLAGS (from Mmake.workspace) are used when
compiling queries.
tests/debugger/Mmakefile now sets SHELL to /usr/local/bash
to allow the use of $(...) style command substitution
(`...` style command substitution can't be nested).
tests/warnings/Mmakefile:
tests/dppd/Mmakefile:
Include tests/Mmake.common.
tools/*:
scripts/c2init.in:
scripts/ml.in:
Update the lists of files containing the library names.
Estimated hours taken: 2
Branches: main
Get the debugger's interactive query mechanism to print out details of
non-canonical types (e.g. higher-order types).
browser/interactive_query.m:
Use `io__write_cc' rather than `io__write', and hence declare the
argument passed to `builtin_aggregate' as `cc_multi' rather than `det'.
library/std_util.m:
Add modes to `builtin_aggregate' and `do_while' in which the
collector predicate has determinism `cc_multi'.
library/builtin.m:
Add impure variants of `promise_only_solution' and
`promise_only_solution_io', for use by std_util.m.
Estimated hours taken: 1
Branches: main
browser/interactive_query.m:
Use the correct object file name when --use-subdirs is specified.
tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.inp.subdirs:
tests/debugger/interactive.inp.nosubdirs:
tests/debugger/interactive.exp:
tests/debugger/interactive.exp2:
Use a different input file for the `interactive' test case
depending on whether `--use-subdirs' is enabled.
The .inp.subdirs file contains the line `mmc_options --use-subdirs'.
We strip this line out of the output before comparing with
the .exp* files.
Estimated hours taken: 3
Branches: main
Change the list constructor from `./2' to `[|]/2'. `./2' will
eventually become the module qualification operator.
library/parser.m:
library/io.m:
library/sparse_bitset.m:
library/std_util.m:
library/term_io.m:
compiler/mercury_to_mercury.m:
compiler/prog_io_dcg.m:
compiler/prog_io_goal.m:
compiler/prog_io_pragma.m:
compiler/prog_io_typeclass.m:
compiler/prog_io_util.m:
browser/interactive_query.m:
extras/moose/grammar.m:
extras/moose/moose.m:
extras/morphine/source/generate_call_site_cov.m:
extras/xml/xml.encoding.m:
samples/muz/higher_order.m:
tests/debugger/declarative/app.m:
tests/dppd/transpose_impl.m:
tests/hard_coded/ground_dd.m:
tests/hard_coded/split_c_files.m:
Change all references to `./2' to use `[|]/2' instead.
compiler/typecheck.m:
Handle `./2' as a special case in `report_error_undef_cons'.
Warn about module list not being imported if `[|]/2' is undefined.
compiler/llds_out.m:
util/mdemangle.c:
profiler/demangle.m:
Add name conversions for `[|]' (f_cons) and `[]' (f_nil).
NEWS:
doc/reference_manual.texi:
w3/tutorial/lists-n-things.m4:
Document the changes.
tests/debugger/{,declarative}/*.exp*:
Update test case results. For some tests the output changed
because they output lists in the non-pretty format. For others,
the output changed because the alphabetical ordering of the
constructors of type `list/1' changed, so the numbering of
the switch branches in the goal paths changed.
Estimated hours taken: 0.25
browser/interactive_query.m:
Pass `--allow-undefined' to ml when building libquery.so;
this is needed now that `--no-allow-undefined' is the default,
since the query will refer to symbols in the executable that
it gets loaded into.
Estimated hours taken: 20
Various fixes to get the GCC back-end interface to bootstrap.
library/exception.m:
Define function versions of mercury__exception__builtin_catch_3_p_*.
This is needed (a) in case we take their address, and (b) for the
GCC back-end interface, where we can't use C macros, since we're
compiling to assembler.
browser/dl.m:
browser/util.m:
browser/interactive_query.m:
compiler/stack_layout.m:
Add #includes for header files needed by these modules.
browser/dl.m:
Delete an unnecessary nested extern declaration, to avoid
a warning from `gcc -Wshadow'.
compiler/mlds_to_gcc.m:
When calling mlds_to_c to process foreign_code, make all
definitions public, so that the can be used from the assembler
code that we generate in mlds_to_gcc.
Don't call mlds_to_c to generate `.c' and `.h' files if the
module contains only `pragma foreign_decls', not `pragma
foreign_code', `pragma foreign_proc', or `pragma export'.
This change is needed to avoid calling mlds_to_c when
intermodule optimization is enabled and `pragma c_header_code'
declarations have been read in from the `.opt' file and have
propagated through to the MLDS. Calling mlds_to_c when the
module itself doesn't contain C code breaks things, since
Mmake won't compile and link in the generated `.c' files, but
those files contain the definition of the `*__init_type_tables()'
functions that are referenced by `*_init.c'.
XXX This is not quite right, since if the module itself contains
`pragma foreign_decls', the `.h' file might be needed.
But the Mercury standard library needs intermodule optimization
enabled for `make install' to work.
A better fix would be to ignore foreign_decls that were defined
in other modules, but to call mlds_to_c for foreign_decls
that were defined in the module that we're compiling.
compiler/modules.m:
Change the code which decides when to link in extra object files
for foreign code to reflect the above change to when mlds_to_gcc.m
invokes mlds_to_c.m.
compiler/mlds_to_c.m:
When target=asm, i.e. we're compiling to asm, but mlds_to_c.m
has been invoked to generate C code for a `foreign_code',
`foreign_proc', or `pragma export' declaration, don't generate
#include directives for the imported modules, since we may not
have generated any header file for them.
XXX This is a bit of a hack; it might sometimes lead to
problems, since the header files might sometimes be needed.
But including them unconditionally is definitely wrong,
since they may not exist, and so this change is needed to get
the compiler to bootstrap.
compiler/Mmakefile:
Add a dependency of mercury_compile on $(GCC_BACK_END_LIBS),
so that we know to relink it if the GCC back-end has changed.
(That variable is set to empty if we're not linking in the GCC
back-end, so it won't cause problems when not using the GCC
back-end.)
library/Mmakefile:
browser/Mmakefile:
compiler/Mmakefile:
Add an `ss' target, for use by tools/bootcheck.
tools/bootcheck:
Add `--target asm' option. If that is set, pass `--target asm'
to mmake, and build and compare the stage 3 `.s' files rather
than the `.c' files.
Also add `--make-opts' option, for passing options to `make'.
Put `-k' in `--make-opts', not `--mmake-opts', since `-k' is
an option to `make', not to `mmake'. This makes a difference
since although `make' options can be passed to `mmake', any
options after the first `make' option are assumed to be
options to `make', not to `mmake'.
Estimated hours taken: 2
Get the compiler to bootstrap with -DMR_NO_BACKWARDS_COMPAT.
compiler/c_util.m:
compiler/rtti_out.m:
Add MR_ prefixes to various type names in generated code.
compiler/*.m:
browser/*.m:
library/*.m:
Add MR_prefixes to various type and function names in pragma C code.
runtime/*.[ch]:
trace/*.[ch]:
Add MR_prefixes to various type and function names in
hand-written code.
Estimated hours taken: 1
Make all the modules in the browser library sub-modules of
module `mdb', to avoid link errors when users use module names
such as `parse'.
browser/Mmakefile:
browser/browser_library.m:
browser/mdb.m:
Rename browser_library.m to mdb.m.
Change `:- import_module' declarations to
`:- include_module' declarations.
browser/Mmakefile:
Remove the special case rule for `mer_browser.init' --
it doesn't work when the file names are not the same
as the module name. Instead, the default rule for `mdb.init'
is used and the output is copied to `mer_browser.init'.
browser/.cvsignore:
Rename header files, etc.
browser/*.m:
Add a `mdb__' prefix to the names of modules in the browser library
in `:- module' and `:- import_module' declarations.
trace/*.c:
Rename the header files for the browser library in
`#include' statements.
tests/hard_coded/Mmakefile:
tests/hard_coded/parse.m:
tests/hard_coded/parse.exp:
Test case.
Estimated hours taken: 6
If calling from the internal debugger, use readline input for the
interactive term browser and interactive queries.
browser/browse.m:
Change some if-then-elses to switches, which will help
catch errors if a new functor is added to the debugger type.
browser/parse.m:
browser/util.m:
Return a string from util__trace_getline/4 rather than a
list of chars, which saves converting from a string to a list
of chars and then back again.
browser/util.m:
Add a version of util__trace_getline that also takes I/O
stream arguments. Pass these arguments to MR_trace_getline.
browser/declarative_oracle.m:
Call util__trace_getline/4 to do input via readline (if
available). Improve error handling.
browser/interactive_query.m:
Call util__trace_getline to get user input, instead of
standard library predicates.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
trace/mercury_trace_internal.c:
trace/mercury_trace_internal.h:
Add two I/O stream arguments to MR_trace_getline.
Estimated hours taken: 11
This change allows interactive queries to be typed from the external debugger.
browser/debugger_interface.m:
Define new debugger requests: query/1, cc_query/1, io_query/1 and
mmc_options/1.
Define 2 new procedures that are used in trace/mercury_trace_external.c:
get_list_modules_to_import/3 retrieves from a *query/1 request a list
of modules to be imported; and get_mmc_options/2 retrieves from a
mmc_options/1 request the option to pass to mmc to compile the query.
browser/interactive_query.m:
Define a new procedure query_external/7 that does the same job as
query/7 but for the external debugger.
Unset the environment variable `MERCURY_OPTIONS' before compiling a
query; `MERCURY_OPTIONS' is exported before executing a program under
the control of Opium-M (and mdb) and is not supposed to be set before
compiling a program.
trace/mercury_trace_browse.ch:
Add a new function MR_trace_query_external() to interface the
ML_query_external() function defined by browser/interfactive_query.m.
trace/mercury_trace_external.c:
Add code to implement new commands `query', `cc_query', `io_query',
and `mmc_options', using the MR_trace_query_external() function defined
by trace/mercury_trace_browse.h.
trace/mercury_trace_external.h:
Export MR_debugger_socket_in and MR_debugger_socket_out since there
are needed in interactive_query.m.
doc/user_guide.texi:
Add a comment to tell that there exists duplicated documentation betwenn
Opium-M/source/interactive_queries.op and doc/user_guide.texi and to
tell me to update it if someone update the documentation here.
Estimated hours taken: 3
Add some test cases to test interactive queries.
tests/debugger/queens.inp:
Add tests of interactive queries.
tests/debugger/Mmakefile:
Add dependency of queens.out on queens.ints.
This is needed in order for us to use interactive queries.
tests/debugger/queens.m:
Export qperm/2, for use in interactive queries.
browser/interactive_query.m:
Flush MDB_stdout after printing the prompt, so things work
properly with I/O redirections.
trace/mercury_trace_internal.c:
Fix an off-by-one error detected by the above test cases.
Estimated hours taken: 17
Add support for invoking interactive queries to mdb.
browser/interactive_query.m:
New module, to implement interactive queries.
browser/dl.m:
browser/name_mangle.m:
Copy these files from extras/dynamic_linking, since
they are needed by browser/interactive_query.m.
configure.in:
runtime/mercury_conf.h.in:
Autodetect the presence of support for dlopen() etc.
browser/dl.m:
Add #ifdefs so that the code will compile (but report
an error at runtime) if dlopen() etc. are not supported.
browser/browser_library.m:
Add interface_query, dl, and name_mangle to the list of
modules in this library.
trace/mercury_trace_browse.h:
trace/mercury_trace_browse.c:
Add a new function MR_trace_query() to interface to the ML_query()
function defined by browser/interfactive_query.m.
trace/mercury_trace_internal.c:
Add code to implement new commands `query', `cc_query', `io_query',
and `mmc_options', using the MR_trace_query() function defined by
trace/mercury_trace_browse.h.
runtime/mercury_grade.h:
Add code to define MR_GRADE_OPT, so that browser/interactive_query.m
can use this to invoke mmc with the same grade that the executable
being debugged was built with.
doc/mdb_categories:
doc/user_guide.texi:
Document the new commands `query', `cc_query', `io_query',
and `mmc_options'.