Estimated hours taken: 3
Branches: main
Clean up the handling of the `--java' and `--gc' compilation options.
README.Java:
Document the `--java' and `--target java' options,
and use `--java' rather than `--grade java' in the examples.
compiler/handle_options.m:
Fix a bug where `mmc --java --output-grade-string'
was printing "java.gc" instead of "java". It was calling
set_gc_method to set the gc_method field in the globals structure,
but it was not setting the corresponding string option in the
options table, and compute_grade was looking at the string option.
The fix was to also set the string option.
scripts/parse_grade_options.sh-subr:
Handle the `--java' and `--java-only' options.
scripts/final_grade_options.sh-subr:
For the IL and Java back-ends, set the gc_method to automatic.
For the Java back-end, set highlevel_data to true.
compiler/globals.m:
Fix an XXX: add a new alternative to the gc_method type,
"automatic", to distinguish lack of GC ("none") from the
automatic GC done by Java or the .NET CLR.
compiler/options.m:
doc/user_guide.texi:
Document the new `--gc automatic' alternative for the `--gc' option.
Delete the documentation of the deprecated `--gc conservative'
option (which has been replaced with `--gc boehm').
compiler/compile_target_code.m:
compiler/handle_options.m:
scripts/parse_grade_options.sh-subr:
scripts/final_grade_options.sh-subr:
Handle the new `--gc automatic' option..
Estimated hours taken: 0.1
Branches: main
compiler/compile_target_code.m:
Added the missing space in between the java compiler flags and the
input filename when invoking the java compiler.
Estimated hours taken: 10
Branches: main
Split the existing browser library into two libraries, by making the
program_representation module into its own library. This is useful because
the compiler refers to program_representation.m, whose code thus needs to be
linked into compiler executables even if the compiler isn't compiled with
debugging enabled. By creating a new library for this module, we avoid any
chance of the linker dragging in the rest of the modules in the browser
library. (This is a problem with an upcoming diff.).
The name of the new library is "mdbcomp", because the intention is that it
contain code that is shared between the debugger and the compiler. This means
mostly the definitions of data structures that the compiler generates for the
debugger, and the predicates that operate on them.
Mmake.common.in:
Allow MDB_COMP_ as a prefix for symbol names in the browser directory.
Mmake.workspace:
Add a make variable holding for the name of the new library, and
add the name to the relevant lists of libraries.
Avoid duplicating the lists of filenames that need to be updated
when adding new libraries or changing their names.
Mmakefile:
Use make variables to refer to library names.
browser/mdbcomp.m:
browser/mer_mdbcomp.m:
Add these files as the top modules of the new library.
browser/program_representation.m:
Make program_representation.m a submodule of mdbcomp, not mdb.
browser/program_representation.m:
browser/browser_info.m:
Move a predicate from program_representation.m to browser_info.m
to avoid the mdbcomp library depend on the browser library, since
this would negate the point of the exercise.
browser/mdb.m:
Delete program_representation.m from the list of submodules.
browser/Mmakefile:
Update this file to handle the new module.
browser/Mercury.options:
Mention the new module.
browser/*.m:
Update the lists of imported modules. Import only one browser module
per line.
compiler/notes/overall_design.html:
Document the new library.
compiler/compile_target_code.m:
Add the mdbcomp library to the list of libraries we need to link with.
compiler/prog_rep.m:
trace/mercury_trace_internal.c:
Import program_representation.m by its new name.
scripts/c2init.in:
Centralize knowledge about which files need to be updated when the list
of libraries changes here.
scripts/c2init.in:
scripts/ml.in:
tools/binary:
tools/binary_step:
tools/bootcheck:
tools/linear:
tools/lml:
Update the list of libraries programs are linked with.
Estimated hours taken: 400
Branches: main
Implement the infrastructure for term size profiling. This means adding two
new grade components, tsw and tsc, and implementing them in the LLDS code
generator. In grades including tsw (term size words), each term is augmented
with an extra word giving the number of heap words it contains; in grades
including tsc (term size cells), each term is augmented with an extra word
giving the number of heap cells it contains. The extra word is at the start,
at offset -1, to leave almost all of the machinery for accessing the heap
unchanged.
For now, the only way to access term sizes is with a new mdb command,
"term_size <varspec>". Later, we will use term sizes in conjunction with
deep profiling to do experimental complexity analysis, but that requires
a lot more research. This diff is a necessary first step.
The implementation of term size profiling consists of three main parts:
- a source-to-source transform that computes the size of each heap cell
when it is constructed (and increments it in the rare cases when a free
argument of an existing heap cell is bound),
- a relatively small change to the code generator that reserves the extra
slot in new heap cells, and
- extensions to the facilities for creating cells from C code to record
the extra information we now need.
The diff overhauls polymorphism.m to make the source-to-source transform
possible. This overhaul includes separating type_ctor_infos and type_infos
as strictly as possible from each other, converting type_ctor_infos into
type_infos only as necessary. It also includes separating type_ctor_infos,
type_infos, base_typeclass_infos and typeclass_infos (as well as voids,
for clarity) from plain user-defined type constructors in type categorizations.
This change needs this separation because values of those four types do not
have size slots, but they ought to be treated specially in other situations
as well (e.g. by tabling).
The diff adds a new mdb command, term_size. It also replaces the proc_body
mdb command with new ways of using the existing print and browse commands
("print proc_body" and "browse proc_body") in order to make looking at
procedure bodies more controllable. This was useful in debugging the effect
of term size profiling on some test case outputs. It is not strictly tied
to term size profiling, but turns out to be difficult to disentangle.
compiler/size_prof.m:
A new module implementing the source-to-source transform.
compiler/notes/compiler_design.html:
Mention the new module.
compiler/transform_hlds.m:
Include size_prof as a submodule of transform_hlds.
compiler/mercury_compile.m:
If term size profiling is enabled, invoke its source-to-source
transform.
compiler/hlds_goal.m:
Extend construction unifications with an optional slot for recording
the size of the term if the size is a constant, or the identity of the
variable holding the size, if the size is not constant. This is
needed by the source-to-source transform.
compiler/quantification.m:
Treat the variable reference that may be in this slot as a nonlocal
variable of construction unifications, since the code generator needs
this.
compiler/compile_target_code.m:
Handle the new grade components.
compiler/options.m:
Implement the options that control term size profiling.
doc/user_guide.texi:
Document the options and grade components that control term size
profiling, and the term_size mdb command. The documentation is
commented out for now.
Modify the wording of the 'u' HLDS dump flag to include other details
of unifications (e.g. term size info) rather than just unification
categories.
Document the new alternatives of the print and browse commands. Since
they are for developers only, the documentation is commented out.
compiler/handle_options.m:
Handle the implications of term size profiling grades.
Add a -D flag value to print HLDS components relevant to HLDS
transformations.
compiler/modules.m:
Import the new builtin library module that implements the operations
needed by term size profiling automatically in term size profiling
grades.
Switch the predicate involved to use state var syntax.
compiler/prog_util.m:
Add predicates and functions that return the sym_names of the modules
needed by term size profiling.
compiler/code_info.m:
compiler/unify_gen.m:
compiler/var_locn.m:
Reserve an extra slot in heap cells and fill them in in unifications
marked by size_prof.
compiler/builtin_ops.m:
Add term_size_prof_builtin.term_size_plus as a builtin, with the same
implementation as int.+.
compiler/make_hlds.m:
Disable warnings about clauses for builtins while the change to
builtin_ops is bootstrapped.
compiler/polymorphism.m:
Export predicates that generate goals to create type_infos and
type_ctor_infos to add_to_construct.m. Rewrite their documentation
to make it more detailed.
Make orders of arguments amenable to the use of state variable syntax.
Consolidate knowledge of which type categories have builtin unify and
compare predicates in one place.
Add code to leave the types of type_ctor_infos alone: instead of
changing their types to type_info when used as arguments of other
type_infos, create a new variable of type type_info instead, and
use an unsafe_cast. This would make the HLDS closer to being type
correct, but this new code is currently commented out, for two
reasons. First, common.m is currently not smart enough to figure out
that if X and Y are equal, then similar unsafe_casts of X and Y
are also equal, and this causes the compiler do not detect some
duplicate calls it used to detect. Second, the code generators
are also not smart enough to know that if Z is an unsafe_cast of X,
then X and Z do not need separate stack slots, but can use the same
slot.
compiler/type_util.m:
Add utility predicates for returning the types of type_infos and
type_ctor_infos, for use by new code in polymorphism.m.
Move some utility predicates here from other modules, since they
are now used by more than one module.
Rename the type `builtin_type' as `type_category', to better reflect
what it does. Extend it to put the type_info, type_ctor_info,
typeclass_info, base_typeclass_info and void types into categories
of their own: treating these types as if they were a user-defined
type (which is how they used to be classified) is not always correct.
Rename the functor polymorphic_type to variable_type, since types
such as list(T) are polymorphic, but they fall into the user-defined
category. Rename user_type as user_ctor_type, since list(int) is not
wholly user-defined but falls into this category. Rename pred_type
as higher_order_type, since it also encompasses functions.
Replace code that used to check for a few of the alternatives
of this type with code that does a full switch on the type,
to ensure that they are updated if the type definition ever
changes again.
compiler/pseudo_type_info.m:
Delete a predicate whose updated implementation is now in type_util.m.
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
Still treat type_infos, type_ctor_infos, typeclass_infos and
base_typeclass_infos as user-defined types, but prepare for when
they won't be.
compiler/hlds_pred.m:
Require interface typeinfo liveness when term size profiling is
enabled.
Add term_size_profiling_builtin.increase_size as a
no_type_info_builtin.
compiler/hlds_out.m:
Print the size annotations on unifications if HLDS dump flags call
for unification details. (The flag test is in the caller of the
modified predicate.)
compiler/llds.m:
Extend incr_hp instructions and data_addr_consts with optional fields
that allow the code generator to refer to N words past the start of
a static or dynamic cell. Term size profiling uses this with N=1.
compiler/llds_out.m:
When allocating memory on the heap, use the macro variants that
specify an optional offset, and specify the offset when required.
compiler/bytecode_gen.m:
compiler/dense_switch.m:
compiler/dupelim.m:
compiler/exprn_aux.m:
compiler/goal_form.m:
compiler/goal_util.m:
compiler/higher_order.m:
compiler/inst_match.m:
compiler/intermod.m:
compiler/jumpopt.m:
compiler/lambda.m:
compiler/livemap.m:
compiler/ll_pseudo_type_info.m:
compiler/lookup_switch.m:
compiler/magic_util.m:
compiler/middle_rec.m:
compiler/ml_code_util.m:
compiler/ml_switch_gen.m:
compiler/ml_unify_gen.m:
compiler/mlds.m:
compiler/mlds_to_c.m:
compiler/mlds_to_gcc.m:
compiler/mlds_to_il.m:
compiler/mlds_to_java.m:
compiler/modecheck_unify.m:
compiler/opt_debug.m:
compiler/opt_util.m:
compiler/par_conj_gen.m:
compiler/post_typecheck.m:
compiler/reassign.m:
compiler/rl.m:
compiler/rl_key.m:
compiler/special_pred.m:
compiler/stack_layout.m:
compiler/static_term.m:
compiler/string_switch.m:
compiler/switch_gen.m:
compiler/switch_util.m:
compiler/table_gen.m:
compiler/term_util.m:
compiler/type_ctor_info.m:
compiler/unused_args.m:
compiler/use_local_vars.m:
Minor updates to conform to the changes above.
library/term_size_prof_builtin.m:
New module containing helper predicates for term size profiling.
size_prof.m generates call to these predicates.
library/library.m:
Include the new module in the library.
doc/Mmakefile:
Do not include the term_size_prof_builtin module in the library
documentation.
library/array.m:
library/benchmarking.m:
library/construct.m:
library/deconstruct.m:
library/io.m:
library/sparse_bitset.m:
library/store.m:
library/string.m:
Replace all uses of MR_incr_hp with MR_offset_incr_hp, to ensure
that we haven't overlooked any places where offsets may need to be
specified.
Fix formatting of foreign_procs.
Use new macros defined by the runtime system when constructing
terms (which all happen to be lists) in C code. These new macros
specify the types of the cell arguments, allowing the implementation
to figure out the size of the new cell based on the sizes of its
fields.
library/private_builtin.m:
Define some constant type_info structures for use by these macros.
They cannot be defined in the runtime, since they refer to types
defined in the library (list.list and std_util.univ).
util/mkinit.c:
Make the addresses of these type_info structures available to the
runtime.
runtime/mercury_init.h:
Declare these type_info structures, for use in mkinit-generated
*_init.c files.
runtime/mercury_wrapper.[ch]:
Declare and define the variables that hold these addresses, for use
in the new macros for constructing typed lists.
Since term size profiling can refer to a memory cell by a pointer
that is offset by one word, register the extra offsets with the Boehm
collector if is being used.
Document the incompatibility of MR_HIGHTAGS and the Boehm collector.
runtime/mercury_tags.h:
Define new macros for constructing typed lists.
Provide macros for preserving the old interface presented by this file
to the extent possible. Uses of the old MR_list_cons macro will
continue to work in grades without term size profiling. In term
size profiling grades, their use will get a C compiler error.
Fix a bug caused by a missing backslash.
runtime/mercury_heap.h:
Change the basic macros for allocating new heap cells to take
an optional offset argument. If this is nonzero, the macros
increment the returned address by the given number of words.
Term size profiling specifies offset=1, reserving the extra
word at the start (which is ignored by all components of the
system except term size profiling) for holding the size of the term.
Provide macros for preserving the old interface presented by this file
to the extent possible. Since the old MR_create[123] and MR_list_cons
macros did not specify type information, they had to be changed
to take additional arguments. This affects only hand-written C code.
Call new diagnostic macros that can help debug heap allocations.
Document why the macros in this files must expand to expressions
instead of statements, evn though the latter would be preferable
(e.g. by allowing them to declare and use local variables without
depending on gcc extensions).
runtime/mercury_debug.[ch]:
Add diagnostic macros to debug heap allocations, and the functions
behind them if MR_DEBUG_HEAP_ALLOC is defined.
Update the debugging routines for hand-allocated cells to print the
values of the term size slot as well as the other slots in the relevant
grades.
runtime/mercury_string.h:
Provide some needed variants of the macro for copying strings.
runtime/mercury_deconstruct_macros.h:
runtime/mercury_type_info.c:
Supply type information when constructing terms.
runtime/mercury_deep_copy_body.h:
Preserve the term size slot when copying terms.
runtime/mercury_deep_copy_body.h:
runtime/mercury_ho_call.c:
runtime/mercury_ml_expand_body.h:
Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
that allocate cells also allocate space for the term size slot if
necessary.
Reduce code duplication by using a now standard macro for copying
strings.
runtime/mercury_grade.h:
Handle the two new grade components.
runtime/mercury_conf_param.h:
Document the C macros used to control the two new grade components,
as well as MR_DEBUG_HEAP_ALLOC.
Detect incompatibilities between high level code and profiling.
runtime/mercury_term_size.[ch]:
A new module to house a function to find and return term sizes
stored in heap cells.
runtime/mercury_proc_id.h:
runtime/mercury_univ.h:
New header files. mercury_proc_id.h contains the (unchanged)
definition of MR_Proc_Id, while mercury_univ.h contains the
definitions of the macros for manipulating univs that used to be
in mercury_type_info.h, updated to use the new macros for allocating
memory.
In the absence of these header files, the following circularity
would ensue:
mercury_deep_profiling.h includes mercury_stack_layout.h
- needs definition of MR_Proc_Id
mercury_stack_layout.h needs mercury_type_info.h
- needs definition of MR_PseudoTypeInfo
mercury_type_info.h needs mercury_heap.h
- needs heap allocation macros for MR_new_univ_on_hp
mercury_heap.h includes mercury_deep_profiling.h
- needs MR_current_call_site_dynamic for recording allocations
Breaking the circular dependency in two places, not just one, is to
minimize similar problems in the future.
runtime/mercury_stack_layout.h:
Delete the definition of MR_Proc_Id, which is now in mercury_proc_id.h.
runtime/mercury_type_info.h:
Delete the macros for manipulating univs, which are now in
mercury_univ.h.
runtime/Mmakefile:
Mention the new files.
runtime/mercury_imp.h:
runtime/mercury.h:
runtime/mercury_construct.c:
runtime/mercury_deep_profiling.h:
Include the new files at appropriate points.
runtime/mercury.c:
Change the names of the functions that create heap cells for
hand-written code, since the interface to hand-written code has
changed to include type information.
runtime/mercury_tabling.h:
Delete some unused macros.
runtime/mercury_trace_base.c:
runtime/mercury_type_info.c:
Use the new macros supplying type information when constructing lists.
scripts/canonical_grade_options.sh-subr:
Fix an undefined sh variable bug that could cause error messages
to come out without identifying the program they were from.
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade_options.sh-subr:
scripts/mgnuc.in:
Handle the new grade components and the options controlling them.
trace/mercury_trace_internal.c:
Implement the mdb command "term_size <varspec>", which is like
"print <varspec>", but prints the size of a term instead of its value.
In non-term-size-profiling grades, it prints an error message.
Replace the "proc_body" command with optional arguments to the "print"
and "browse" commands.
doc/user_guide.tex:
Add documentation of the term_size mdb command. Since the command is
for implementors only, and works only in grades that are not yet ready
for public consumption, the documentation is commented out.
Add documentation of the new arguments of the print and browse mdb
commands. Since they are for implementors only, the documentation
is commented out.
trace/mercury_trace_vars.[ch]:
Add the functions needed to implement the term_size command, and
factor out the code common to the "size" and "print"/"browse" commands.
Decide whether to print the name of a variable before invoking the
supplied print or browse predicate on it based on a flag design for
this purpose, instead of overloading the meaning of the output FILE *
variable. This arrangement is much clearer.
trace/mercury_trace_browse.c:
trace/mercury_trace_external.c:
trace/mercury_trace_help.c:
Supply type information when constructing terms.
browser/program_representation.m:
Since the new library module term_size_prof_builtin never generates
any events, mark it as such, so that the declarative debugger doesn't
expect it to generate any.
Do the same for the deep profiling builtin module.
tests/debugger/term_size_words.{m,inp,exp}:
tests/debugger/term_size_cells.{m,inp,exp}:
Two new test cases, each testing one of the new grades.
tests/debugger/Mmakefile:
Enable the two new test cases in their grades.
Disable the tests sensitive to stack frame sizes in term size profiling
grades.
tests/debugger/completion.exp:
Add the new "term_size" mdb command to the list of command completions,
and delete "proc_body".
tests/debugger/declarative/dependency.{inp,exp}:
Use "print proc_body" instead of "proc_body".
tests/hard_coded/nondet_c.m:
tests/hard_coded/pragma_inline.m:
Use MR_offset_incr_hp instead of MR_incr_hp to ensure that all places
that allocate cells also allocate space for the term size slot if
necessary.
tests/valid/Mmakefile:
Disable the IL tests in term size profiling grades, since the term size
profiling primitives haven't been (and probably won't be) implemented
for the MLDS backends, and handle_options causes a compiler abort
for grades that combine term size profiling and any one of IL, Java
and high level C.
Estimated hours taken: 1
Branches: main
Fix a bug which caused `mmc --make foo.o' to fail.
compiler/make.m:
compiler/make.util.m:
Avoid returning multiple possible file types for object files.
compiler/compile_target_code.m:
For the (in, out, in) mode of maybe_pic_object_file_extension,
always return `non_pic' if the platform doesn't need special
handling for PIC.
tests/mmc_make/Mmakefile:
tests/mmc_make/build_object:
Test case.
Estimated hours taken: 50
Branches: main
Remove Unix dependencies in the compiler.
Avoid calling passes_aux.invoke_shell_command, which
requires the presence of a Unix shell.
The implementation of fact tables still has dependencies
on Unix utilities (e.g. sort).
aclocal.m4:
Don't pass Unix style paths to MSVC.
configure.in:
Use `cygpath -m' rather than `cygpath -w'.
`cygpath -m' uses '/' as the directory separator,
so it doesn't cause quoting problems in shell
scripts.
Apply $CYGPATH to $PREFIX, $LIBDIR, $CONFIG_PREFIX
and $CONFIG_LIBDIR.
Don't pass `-lm' when linking with MSVC.
configure.in:
compiler/options.m:
scripts/Mercury.config.in:
Add extra configuration options to deal with differences
between linking with gcc and MSVC:
--linker-opt-separator
--linker-link-lib-flag
--linker-link-lib-suffix
--shlib-linker-link-lib-flag
--shlib-linker-link-lib-suffix
--linker-path-flag
NEWS:
doc/user_guide.texi:
compiler/options.m:
compiler/compile_target_code.m:
compiler/make.program_target.m:
Instead of substituting in an arbitrary shell script when
processing `--pre-link-command' and `--extra-init-command',
require that these options specify a command which will
be passed the name of the source file containing the main
module as the first argument, with the source files containing
the remaining modules following. This is simpler and avoids
dependencies on a shell.
Fix quote_arg to handle Windows paths better.
compiler/handle_options.m:
Don't attempt to use symlinks if they're not available.
compiler/compile_target_code.m:
Be more careful about quoting.
Don't call invoke_shell_command where invoke_system_command
would do.
Allow linking using MSVC.
compiler/modules.m:
Remove make_directory, which is now implemented by dir.m.
Use io.make_symlink rather than shell scripts.
Implement mercury_update_interface in Mercury.
compiler/llds_out.m:
compiler/make.program_target.m:
Use dir.make_directory, not modules.make_directory,
which has been removed.
compiler/make.module_target.m:
Invoke mercury_compiler directly, not through the
mmc script to avoid shell dependencies.
If we can't fork() child `mmc --make' processes,
pass the arguments to the child process using a
file to avoid overflowing system limits on Windows.
compiler/mercury_compile.m:
compiler/options_file.m:
Read argument files.
Handle backslash-newline in options files correctly.
compiler/passes_aux.m:
invoke_system_command shouldn't set the exit status --
the caller may be able to try something else.
compiler/process_util.m:
Export can_fork for use by make.module_target.m.
Remove hacks to work around bugs in the implementation
of zero-arity foreign procs.
compiler/prog_io.m:
Handle bizarre file names without aborting.
library/Mmakefile:
library/print_extra_inits:
Move code to find extra initialization functions into
print_extra_inits, due to the change to the handling
of the --extra-init-command option described above.
scripts/mmc.in:
Set the MERCURY_COMPILER environment variable if it is
not already set, so that the mercury_compile executable
knows where to find itself.
scripts/mercury.bat.in:
Make this actually work.
tools/bootcheck:
Set ANALYSIS_LIB_NAME.
Apply cygpath (-m not -w) to $root.
Link print_extra_inits into the stage2 and stage3
library directories.
util/mkinit.c:
Handle '\\' in path names.
Estimated hours taken: 120
Branches: main
Library changes required to make the compiler work on Windows
without Cygwin. (Compiler changes to come separately).
library/dir.m:
Handle Windows-style paths.
Change the determinism of dir.basename and dir.split_name.
dir.basename now fails for root directories (a new function
dir.basename_det calls error/1 rather than failing).
dir.split_name fails for root directories or if the pathname
passed doesn't contain a directory separator.
Add predicates dir.make_directory, dir.path_name_is_absolute
and dir.path_name_is_root_directory.
Add a multi predicate dir.is_directory separator which
returns all separators for the platform (including '/' on
Windows), not just the standard one.
Add a function dir.parent_directory (returns "..").
Add dir.foldl2 and dir.recursive_foldl2, to iterate through
the entries in a directory (and maybe its subdirectories).
Change '/' to correctly handle Windows paths of the form
"C:"/"foo" and "\"/"foo".
Don't add repeated directory separators in '/'.
library/io.m:
Add io.file_type and io.check_file_accessibility.
Add predicates to deal with symlinks -- io.have_symlinks,
io.make_symlink and io.follow_symlink.
Add io.file_id for use by dir.foldl2 to detect
symlink loops. This is a bit low level, so it's
not included in the user documentation.
Add io.(binary_)input_stream_foldl2_io_maybe_stop, which
is like io.(binary_)input_stream_foldl2_io, but allows
stopping part of the way through. This is useful for
implementing `diff'-like functionality to replace
mercury_update_interface.
Use Windows-style paths when generating temporary file
names on Windows.
Add versions of the predicates to generate error messages
to handle Win32 errors.
Add versions of the predicates to generate error messages
which take a system error code, rather than looking up
errno. This simplifies things where the error we
are interested in was not from the last system call.
library/exception.m:
Add a predicate finally/6 which performs the same function
as the `finally' clause in languages such as C# and Java.
Add predicates try_det, try_io_det and try_store_det,
which only have one mode so they are more convenient
to pass to promise_only solution.
library/Mmakefile:
Add dependencies on runtime/mercury_conf.h for files which
use the MR_HAVE_* macros.
library/string.m:
Add a function version of string__index.
NEWS:
Document the new predicates and functions and the change
of determinism of dir.split_name and dir.basename.
configure.in:
runtime/mercury_conf.h.in:
Test for lstat, mkdir, symlink and readlink.
runtime/mercury_conf_param.h:
Add a macro MR_BROKEN_ST_INO, which is true if the st_ino
field of `struct stat' is garbage. Currently defined iff
MR_WIN32 is defined.
compiler/compile_target_code.m:
compiler/modules.m:
compiler/options_file.m:
compiler/prog_io.m:
compiler/source_file_map.m:
Changes required by the change of determinism of
dir.split_name and dir.basename.
tests/hard_coded/Mmakefile:
tests/hard_coded/dir_test.{m,exp,exp2}:
Test case.
Estimated hours taken: 3
Branches: main
Reduce inappropriate dependencies on ll_backend modules. Except for
simplification of unnecessarily complicated logic in dependency_graph.m,
this change only moves functionality around.
compiler/llds_out.m:
compiler/c_util.m:
compiler/name_mangle.m:
Move predicates that are used by multiple backends from
ll_backend__llds_out to backend_libs__c_util and to a new module
backend_libs__name_mangle. Make the relevant ones functions,
and give some of them more meaningful names.
compiler/trace.m:
compiler/hlds_goal.m:
Move a backend-independent predicate from ll_backend__trace
to hlds__hlds_goal.
compiler/llds.m:
compiler/trace_params.m:
Move the definition of the trace_port type from ll_backend__llds
to libs__trace_params to avoid having libs__trace_params depend on
ll_backend.
compiler/exprn_aux.m:
compiler/globals.m:
Move the definition of the imported_is_constant from
ll_backend__exprn_aux to libs__globals to avoid having libs__globals
depend on ll_backend.
compiler/*.m:
Conform to the above changes. This removes many inappropriate
dependencies on the LLDS backend.
Estimated hours taken: 2
Branches: main
compiler/*.m:
Import only one compiler module per line. Sort the blocks of imports.
This makes it easier to merge in changes.
In a couple of places, remove unnecessary imports.
Estimated hours taken: 0.1
Branches: main
compiler/compile_target_code.m:
Fix a bug: the absence of a space between options could cause
two to run together, confusing the C compiler.
Estimated hours taken: 2
Branches: main
Ensure that in MLDS grades, arguments with arg_mode `top_unused' do not
get passed.
Previously, different parts of the compiler had different and inconsistent
ideas about if/how they should get passed, which caused problems,
including an internal error for tests/hard_coded/foreign_type2.m in grade
`java'. The comments in mlds.m said they should not get passed, the
code in ml_call_gen.m passed them as if they were output arguments, and
the code in ml_code_util declared them as if they were input arguments.
compiler/hlds_pred.m:
Add some detailed comments about the meaning of the `arg_mode' type.
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_code_gen.m:
Ensure that arguments with arg_mode `unused' do not get passed,
declared, or converted (respectively).
runtime/mercury_grade.h:
Bump the binary compatibility version number for MLDS grades.
This is needed because the calling convention for procedures
with `unused' mode arguments has changed.
Estimated hours taken: 3
Branches: main
Make sure the Java back-end puts class files in the right place with
`--use-subdirs' and properly cleans up all generated .class files.
mercury/compiler/compile_target_code.m:
mercury/scripts/Mmake.rules:
Tell to Java compiler to put generated .class files in the
`Mercury/classs' directory.
mercury/compiler/modules.m:
Clean up all generated .class files.
Estimated hours taken: 0.25
Branches: main
compiler/compile_target_code.m:
Use grade_directory_component rather than compute_grade when
working out the directory names for the installed libraries.
Estimated hours taken: 70
Branches: main
Add Java support to the foreign language interface.
mercury/compiler/compile_target_code.m:
mercury/compiler/make.module_target.m:
mercury/compiler/mercury_compile.m:
Pass `compile_java_file' a Java filename rather than a module name.
mercury/compiler/globals.m:
Add `java' as a `foreign_language'.
mercury/compiler/handle_options.m:
Allow Java as a back-end foreign language if the target language
is Java.
mercury/compiler/hlds_data.m:
Allow Java foreign_types.
mercury/compiler/intermod.m:
mercury/compiler/foreign.m:
mercury/compiler/make.util.m:
mercury/compiler/make_hlds.m:
mercury/compiler/mercury_compile.m:
mercury/compiler/mercury_to_mercury.m:
mercury/compiler/ml_code_gen.m:
mercury/compiler/mlds.m:
mercury/compiler/mlds_to_c.m:
mercury/compiler/mlds_to_il.m:
mercury/compiler/mlds_to_ilasm.m:
mercury/compiler/mlds_to_java.m:
mercury/compiler/pragma_c_gen.m:
mercury/compiler/prog_data.m:
mercury/compiler/prog_io_pragma.m:
Add or modify existing code to support `java' as a `foreign_language'
and Java `foreign_type's.
mercury/compiler/mlds_to_java.m:
Nicely indent the generated code that unboxes arguments from
return-argument arrays which are used for methods with multiple
return arguments.
Estimated hours taken: 25
Branches: main
Implement the ml and c2init scripts in the compiler to
reduce dependencies on Cygwin.
compiler/compile_target_code.m:
Implement the functionality of ml and c2init, rather than
calling those scripts.
Handle all compiler dependencies using options, rather than
testing for particular compilers here.
compiler/options.m:
NEWS:
doc/user_guide.texi:
Add options which implement functionality which is part
of ml, c2init or mgnuc when using Mmake:
--warn-target-code, --output-link-command,
--output-shared-lib-link-command, --ansi-c,
--no-strip, --no-demangle, --no-main,
--allow-undefined, --use-readline, --runtime-flags,
--extra-inits.
Add options to describe the C compiler and linker, for
use by configure/mmc.
The `--ml-flags' (`--link-flags') option has been removed.
compiler/options_file.m:
Remove the MLFLAGS variable.
compiler/handle_options.m:
`--target-debug' implies `--no-strip'.
Add the path to the GC libraries to the library search paths.
compiler/mercury_compile.m:
Handle --output-link-command and --output-shared-lib-link-command.
compiler/passes_aux.m:
Add a variant of invoke_shell_command which takes a second
command to process the first command's output. This is used
by compile_target_code.m to invoke the demangler.
configure.in:
scripts/mmc.in:
Handle extra default options.
scripts/c2init.in:
scripts/ml.in:
Document that the code here is duplicated in
compiler/compile_target_code.m.
Mmake.workspace:
browser/Mmakefile:
compiler/Mercury.options:
compiler/Mmakefile:
library/Mmakefile:
Pass `-R' options pointing to the installation directories
to mmc, as we already do for ml.
Estimated hours taken: 20
Branches: main
Allow reconfiguration of existing installations, for example
to use a different C compiler. The reconfiguration works
by making a new copy of the scripts and mercury_conf.h,
and storing them in a partial installation directory tree
which uses the libraries and executables from the existing
installation.
Use this method to configure binary distributions, rather
than using a cut down version of the configuration script,
to avoid code duplication and to handle the case where the
C compiler in use on the installation machine is different
than that used to build the binary distribution.
This is more robust than the previous method of using a different
C compiler, which was to set the MERCURY_C_COMPILER variable and
hope the different C compilers were compatible enough.
Mmakefile:
runtime/Mmakefile:
scripts/Mmakefile:
Modify the `install' targets to store files needed to create
a new configuration in $INSTALL_LIBDIR/reconf.
runtime/Mmakefile:
Install mercury_conf.h in $INSTALL_LIBDIR/conf, rather than
$INSTALL_LIBDIR/inc, so that it can be overridden by a
different configuration.
scripts/mercury_config.in:
Create a new configuration, by creating part of a Mercury
source tree from the files stored in $INSTALL_LIBDIR/reconf,
running configure, then copying the files into a partial
installation tree.
scripts/Mmake.vars.in:
Define ENABLE_DEEP_PROFILER, for use by bindist/bindist.Makefile.
Define variables INSTALL_CONF_DIR (contains the files describing
the configuration) and INSTALL_RECONF_DIR (contains files needed
to reconfigure an installation).
configure.in:
Add an option `--enable-reconfigure', for use by
mercury_config.in.
Don't look for runtime/mercury_wrapper.c when checking
for the sources -- it isn't present when reconfiguring.
Look for scripts/mmc.in instead.
Look for the runtime headers in the installation hierarchy
rather than the `runtime/' and `trace/' directories when
reconfiguring.
Output the help message for the `configure' script to
`configure.help'. This is included in the help message
for `mercury_config'.
Add new configuration variables CONFIG_PREFIX and CONFIG_LIBDIR,
which are like PREFIX and LIBDIR except that they point
to the configuration files, not the library files.
In the normal case PREFIX and CONFIG_PREFIX will be the same.
bindist/bindist.INSTALL.in:
bindist/bindist.Makefile.in:
Use mercury_config to configure binary distributions.
bindist/Mmakefile:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
Remove bindist.configure.in and bindist.build_vars.in.
compiler/options.m:
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
doc/user_guide.texi:
Add an option `--mercury-config-dir', and an environment
variable MERCURY_CONFIG_DIR, which tell the compiler and
scripts where to find the configuration files for the
installation.
MERCURY_CONFIG_DIR is not documented because it should
only be used by the scripts.
compiler/compile_target_code.m:
Pass `--mercury-config-dir' to the scripts.
compiler/handle_options.m:
Add `--c-include-directory $MERCURY_CONFIG_DIR/conf'.
library/getopt.m:
Handle `maybe_string_special' options.
doc/user_guide.texi:
Update the "Using a different C compiler" chapter.
NEWS:
Document the changes.
Estimated hours taken: 20
Branches: main
Make it easier to use shared libraries on x86 with
`mmc --make'.
There is now a third kind of object file, `.lpic_o'.
These files are compiled with `--pic-reg' but not with
CFLAGS_FOR_PIC, so they can be linked with shared Mercury
libraries.
On x86, executables which are linked with shared Mercury
libraries now depend on $(main_module.lpic_os), not
$(main_module.os).
This doesn't work with Mmake because ml doesn't know
which libraries are Mercury libraries, so it can't
link with the static versions of those libraries if
MERCURY_LINKAGE is set to "static".
configure.in:
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
Work out whether `.lpic_o' files are needed.
compiler/modules.m:
Add `.lpic_o' to the list of grade or architecture
dependent files.
NEWS:
README.Linux:
compiler/options.m:
doc/user_guide.texi:
Document MERCURY_LINKAGE, LINKAGE, --linkage,
--mercury-linkage and -R.
compiler/options_file.m:
compiler/make.program_target.m:
Handle LINKAGE and MERCURY_LINKAGE variables.
Allow LIBGRADES, LINKAGE and MERCURY_LINKAGE to be target-specific.
scripts/mmc.in:
Set up the default linkage using the MERCURY_LINKAGE
variable.
compiler/compile_target_code.m:
Build `.lpic_o' files.
Work out which type of object files to link with.
When linking statically with Mercury libraries,
find the absolute pathname for the `.a' file
for each Mercury library, and pass that to ml,
rather than just using `-lname'.
Pass `-R' options to ml for each `-R' option to mmc.
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/mercury_compile.m:
Specify which type of object files to build.
compiler/make.program_target.m:
compiler/make.module_target.m:
Make sure all generated object files are cleaned up.
compiler/prog_io.m:
Add a better message for files which can't be found.
compiler/make.util.m:
Add `.lpic_o' to the list of extensions.
compiler/Mmakefile:
profiler/Mmakefile:
deep_profiler/Mmakefile:
Pass `--linkage shared' to mmc (`--shared' is in MLFLAGS).
tests/Mmakefile:
tests/mmc_make/Mmakefile:
tests/mmc_make/Mercury.options:
tests/mmc_make/complex_test.{m,exp}:
tests/mmc_make/hello.{m,exp}:
Test `mmc --make'.
tests/lib/complex*.m:
The complex numbers library from the extras distribution,
for use in the mmc_make tests.
Estimated hours taken: 28
Branches: main
Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.
This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.
Various fixes were also added so that `mmc --make --grade il' could make
an executable.
compiler/compile_target_code.m:
Change il_assemble so that we always build a .dll version
irrespective of whether it contains main or not, as MC++ or C#
code may refer to the dll.
Add Mercury/dlls to the search path for the C# and MC++
compilers.
s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
understand / as a directory seperator.
Add the referenced dlls to the C# compilers command line.
Export maybe_pic_object_file_extension.
compiler/handle_options.m:
Fix a bug where copmute_grade incorrectly generated `hl.il'
instead of `il' as the grade name because we weren't always
considering the --target option.
compiler/make.m:
Add to the compilation_task_type type the alternatives
foreign_code_to_object_code and fact_table_foreign_code_file.
Add to the module_target_type type the alternatives
foreign_asm, foreign_object and factt_object.
compiler/make.dependencies.m:
Add code to handle the new module_target_type alternatives.
Add code to build the new alternatives to
compilation_task_type.
compiler/make.module_target.m:
Add rules to build the foreign_code_to_object_code and
fact_table_code_to_object_code.
compiler/make.program_target.m:
Determine the targets needed to be built for all the external
foreign files and add them to build target list.
compiler/make.util.m:
Add code to handle the new module_target_type alternatives.
Change write_target_file to output the correct name when
building the foreign_asm and foreign_object targets.
compiler/modules.m:
Move referenced_dlls into the interface for use by
`compile_target_code.m'.
Don't place dlls in a sub-directory because on the IL backend
the dlls are `part' of the executable file.
Add a `MkDir' argument to fact_table_file_name which
optionally creates a directory to store the generated
file_name in.
tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
Add a test case.
Estimated hours taken: 28
Branches: main
Change `mmc --make' so that it no longer builds the external foreign
object files at the same time as it builds the target object file.
This allows one to build on the IL backend where building an external
foreign file assembly depends on having all the imported Mercury
assemblies built first.
Various fixes were also added so that `mmc --make --grade il' could make
an executable.
compiler/compile_target_code.m:
Change il_assemble so that we always build a .dll version
irrespective of whether it contains main or not, as MC++ or C#
code may refer to the dll.
Add Mercury/dlls to the search path for the C# and MC++
compilers.
s,/,\\\\,g in the C# filename as the MS C# compiler doesn't
understand / as a directory seperator.
Add the referenced dlls to the C# compilers command line.
Export maybe_pic_object_file_extension.
compiler/handle_options.m:
Fix a bug where copmute_grade incorrectly generated `hl.il'
instead of `il' as the grade name because we weren't always
considering the --target option.
compiler/make.m:
Add to the compilation_task_type type the alternatives
foreign_code_to_object_code and fact_table_foreign_code_file.
Add to the module_target_type type the alternatives
foreign_asm, foreign_object and factt_object.
compiler/make.dependencies.m:
Add code to handle the new module_target_type alternatives.
Add code to build the new alternatives to
compilation_task_type.
compiler/make.module_target.m:
Add rules to build the foreign_code_to_object_code and
fact_table_code_to_object_code.
compiler/make.program_target.m:
Determine the targets needed to be built for all the external
foreign files and add them to build target list.
compiler/make.util.m:
Add code to handle the new module_target_type alternatives.
Change write_target_file to output the correct name when
building the foreign_asm and foreign_object targets.
compiler/modules.m:
Move referenced_dlls into the interface for use by
`compile_target_code.m'.
Don't place dlls in a sub-directory because on the IL backend
the dlls are `part' of the executable file.
Add a `MkDir' argument to fact_table_file_name which
optionally creates a directory to store the generated
file_name in.
tests/hard_coded/foreign_proc_make.exp:
tests/hard_coded/foreign_proc_make.m:
tests/hard_coded/foreign_proc_make2.m:
Add a test case.
Estimated ours taken: 0.5
Branches: main, release
compiler/compile_target_code.m:
Fix bug where `mmc --target asm --pic' was not naming the output
file as `.o' rather than `.pic_o'.
Estimated hours taken: 0.75
Branches: main, release
compiler/compile_target_code.m:
Fix bugs where `mmc --target asm --pic' was not passing the
correct options to gcc.
Estimated hours taken: 0.5
Branches: main, release
compiler/compile_target_code.m:
Fix bugs in the code to link executables and libraries
created with `--use-grade-subdirs' into the user's
directory.
tests/grade_subdirs/Mmakefile:
Check that building libraries with `--use-grade-subdirs'
works.
Estimated hours taken: 1
Branches: main, release
scripts/Mmake.rules:
compiler/compile_target_code.m:
Be consistent about using `-' rather than `/' for options to cl.
Use `-o ' rather than `-link -out:'.
Ensure that `-o' comes before $(MS_CL_LIBS).
Resynchronize the release branch with the main branch.
Estimated hours taken: 0.5
Branches: main
Fix a bug in my previous change to fix a bug in fjh's previous change.
Revert back to using '/out:', and instead add the flag '/link' so that '/out:'
is passed to the linker instead to avoid problems compiling the library.
scripts/Mmake.rules:
compiler/compile_target_code.m:
Add '/link' before the '/out:'.
scripts/Mmake.rules:
Also add fjh's change for /LD to other rules building .dlls.
Estimated hours taken: 0.25
Branches: main, release
compiler/compile_target_code.m:
Apply a patch to the MSVC command line for compiling
Managed C++, which Fergus previous applied in Mmake.rules -
s/-link -noentry mscoree.lib -dll/\/LD/
Fill in the options for debugging for .NET compilers.
Fix missing spaces in command lines.
Estimated hours taken: 2.5
Branches: main
Improve the handling of `--use-grade-subdirs' so that it can
be documented.
compiler/compile_target_code.m:
With `--use-grade-subdirs', link or copy executables
and libraries into the user's directory.
compiler/make.program_target.m:
compiler/modules.m:
Move code to create a symlink into modules.m, next to
the code to create directories (all of this should really
go in the standard library).
Add a predicate to copy a file (which should also go
in the standard library).
compiler/make.program_target.m:
Make the realclean target delete the symlinks or copies
of executables and libraries.
NEWS:
library/io.m:
Add io__binary_input_stream_foldl, etc. for use in copying files.
NEWS:
compiler/options.m:
doc/user_guide.texi:
Document `--use-grade-subdirs'.
tests/Mmakefile:
tests/grade_subdirs:
tests/grade_subdirs/Mmakefile:
tests/grade_subdirs/Mercury.options:
tests/grade_subdirs/hello.{m,exp}:
Test case.
Estimated hours taken: 1
Branches: main
Make --c-debug work correctly when using MSVC as your C compiler.
compiler/compile_target_code.m:
scripts/mgnuc.in:
Use /Zi when --c-debug is enabled and we are using MSVC for
our C compiler.
scripts/ml.in:
Pass /DEBUG to the linker when --c-debug is enabled and we
are using MSVC for our C compiler.
runtime/Mmakefile:
Pass --c-debug to mgnuc rather than passing -g through to the
underlying C compiler.
Estimated hours taken: 2
Branches: main
Add a new grade component, .decldebug. It is as proposed on mercury-developers,
minus the implications about I/O tabling. Those will come later.
compiler/options.m:
Add a new option, --decl-debug, that switches on declarative debugging.
compiler/trace_params.m:
The procedure that converts strings representing trace levels to trace
levels themselves now has an extra argument, which gives the value of
the --decl-debug option. If set, it raises the minimum trace level,
and turn explicitly specifying trace levels `shallow' and `deep'
into errors (since they are not sufficient for declarative debugging).
compiler/handle_options.m:
Pass the value of the --decl-debug option to trace_params, and handle
the errors that may result. Handle the implications of --decl-debug
and the .decldebug grade component.
compiler/compile_target_code.m:
Define MR_DECL_DEBUG when invoking the C compiler if --decl-debug is
set.
runtime/mercury_conf_param.h:
Document MR_DECL_DEBUG, which is defined iff the grade is a .decldebug
grade.
runtime/mercury_grade.h:
Take MR_DECL_DEBUG into account when computing the grade component
related to debugging.
Update the list of places that need to be modified when adding new
grade components.
doc/user_guide.texi:
Document --decl-debug and the .decldebug grade component.
Document the events used by declarative debugging, since Mark didn't.
Fix some minor unrelated omissions.
scripts/init_grade.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/final_grade.sh-subr:
scripts/canonical_grade.sh-subr:
scripts/mgnuc.in:
scripts/ml.in:
Add a new shell variable, decl_debug, to represent the value of
MR_DECL_DEBUG, and handle it as appropriate.
tests/debugger/Mmakefile:
Do not execute shallow traced tests in .decldebug grades, since we
don't support shallow tracing in such grades.
Specify --trace decl instead of --trace deep in .decldebug grades
when compiling the other tests, since we don't support --trace deep
in .decldebug grades.
Estimated hours taken: 2
Branches: main
Fix bugs in `--rebuild'.
compiler/compile_target_code.m:
Always recompile the `module_init.c' file with `--rebuild'.
compiler/handle_options.m:
The code to make `--rebuild' imply `--make' was after some
uses of the value of `--make', in particular the code to
make `--make' imply `--use-subdirs'.
compiler/make.dependencies.m:
compiler/make.program_target.m:
compiler/make.module_target.m:
Add a sanity check to make sure that all files that should
have been produced when building a target have been produced,
and reporting a proper error message if they have not.
Estimated hours taken: 20
Branches: main
Add support for interfacing Mercury with the MPS garbage collector.
This change is broken into three parts:
1. Import version 1.100.1 of the MPS kit into the Mercury
CVS repository, in the directory `mps_gc'.
2. Make some changes to the MPS kit for Mercury,
to support fully-conservative collection and tagged pointers,
and to wrap it in an interface that is similar to that of
the Boehm collector.
3. Modify the rest of the Mercury implementation
to support linking with the MPS kit instead
of the Boehm collector. This involved defining
`mps' as a new GC method and a new grade component.
This is part 3 of 3.
Mmake.workspace:
Include the MPS directories in the header file and library search
paths.
tools/bootcheck:
Link the mps_gc directory into the stage2 and stage3 directories.
Mmake.workspace:
runtime/Mmakefile:
scripts/ml.in:
For *.mps grades, link in mps.a.
(XXX ml.in is linking in libmps.a, which is wrong.)
runtime/Mmakefile:
trace/Mmakefile:
In the rule for `check_headers', which checks macro namespace
cleanliness, allow names to start with `MPS_' or `mps_'.
runtime/RESERVED_MACRO_NAMES:
Add `mercury_mps_h', which is used by mps_gc/code/mercury_mps.h
for its header guard. (Normally it would be better to use
uppercase for header guard macro names, but that would be
inconsistent with the coding style used in mps_gc/code.)
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
Handle the new `mps' GC method and grade component.
compiler/globals.m:
compiler/options.m:
doc/user_guide.texi:
Replace gc_method `conservative' with two alternatives
`boehm' and `mps'. ("--gc conservative" is still allowed,
and treated as equivalent to "--gc boehm".)
Add new function `gc_is_conservative' to globals.m.
compiler/mercury_compile.m:
compiler/handle_options.m:
Use `gc_is_conservative' rather than `= conservative'.
compiler/handle_options.m:
Handle the "mps" grade component.
(XXX need to document this in options.m and user_guide.texi)
compiler/compile_target_code.m:
Pass the appropriate C defines for the new GC methods.
compiler/mercury_compile.m:
Wrap the work-around for a Boehm GC bug inside `#ifndef MR_MPS_GC'.
library/array.m:
Use GC_FREE() rather than GC_free().
This is needed for two reasons:
- so that it works with MPS, which only defines GC_FREE
- so that it works with then Boehm collector when
GC debugging is enabled
library/benchmarking.m:
Output GC statistics for the MPS collector.
runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
If MR_MPS_GC is defined, use mercury_mps.h rather than gc.h.
runtime/mercury_conf_param.h:
Add configuration macros MR_BOEHM_GC and MR_MPS_GC.
Set MR_CONSERVATIVE_GC if either of these is set.
Default to MR_BOEHM_GC if only MR_CONSERVATIVE_GC is set.
runtime/mercury_context.h:
runtime/mercury_deep_copy.h:
runtime/mercury_engine.h:
runtime/mercury_float.h:
runtime/mercury_heap.h:
Explictly #include "mercury_conf.h", so that
MR_CONSERVATIVE_GC will be set properly before it is tested.
runtime/mercury_grade.h:
Handle the .mps grade component.
runtime/mercury_memory.c:
runtime/mercury_wrapper.c:
runtime/mercury_memory_handlers.c:
Move the call to MR_setup_signals() earlier in the
initialization sequence, so that the MPS signal handlers
get installed after our signal handlers. This is needed
because our signal handlers assume that any signals that
they can't handle are fatal errors, which interfere's
with MPS's use of signal handlers for memory barriers.
runtime/mercury_wrapper.c:
Add code to initialize the MPS collector.
Put code which is specific to the Boehm collector inside
#ifdef MR_BOEHM_GC rather than #ifdef MR_CONSERVATIVE_GC.
runtime/mercury_wrapper.h:
Update a comment.
Estimated hours taken: 2
Branches: main
Fix quoting of arguments to commands invoked by mmc.
compiler/compile_target_code.m:
compiler/make.module_target.m:
Quote arguments passed to commands.
compiler/options_file.m:
Pass each word in the value of CFLAGS (MLFLAGS, etc) as a
separate `--cflag' option so it can be quoted correctly.
NEWS:
compiler/options.m:
doc/user_guide.texi:
For each `--Xflags' option, add a `--Xflag' option which
quotes its argument if necessary then adds it to
the `--Xflags' option.
Estimated hours taken: 12
Branches: main
Optimize shallow traced modules by not adding calls to MR_trace to shallow
traced procedures which cannot be called from a deep traced environment.
A shallow traced procedure can be optimized in this way if it is neither
exported from its defining module nor has its address taken.
The main purpose of this optimization is not the avoidance of the cost of the
MR_trace calls as much as it is the restoration of tail recursion optimization.
Previously, compiling a program in a debug grade would disable all tail
recursion in the program (since debug grades require at least shallow tracing
every module). This was a problem because it limited the sizes of the inputs
the debugged program could process before running out of memory. As long as
the procedures that recurse on the input are in the implementation section
of a shallow traced module, this should no longer happen.
compiler/trace_params.m:
Introduce the concept of a procedure's effective trace level. This is
identical to the global trace level, except if the procedure is not
exported and doesn't have its address taken, and the global trace level
is shallow. In that case, we say that the procedure's effective trace
level is none.
Computing a procedure's effective trace level requires its proc_info
and its parent pred_info, so require callers to supply these as
parameters.
compiler/code_info.m:
Store the current pred_info as well as the current proc_info, for
trace parameter lookups.
compiler/continuation_info.m:
compiler/code_gen.m:
Record the required trace parameters of a procedure in its layout
structure, since it can no longer be computed from the global trace
level.
compiler/stack_layout.m:
Use the trace parameters in procedures' layout structures, instead of
trying to compute them from the global trace level.
compiler/inlining.m:
compiler/liveness.m:
compiler/stack_alloc.m:
compiler/store_alloc.m:
compiler/trace.m:
Use procedures' effective trace level instead of the global trace level
where relevant.
compiler/llds.m:
Record the required trace parameter of a procedure in its c_procedure
representation, since it can no longer be computed from the global
trace level.
Delete an obsolete field.
compiler/optimize.m:
compiler/jumpopt.m:
Use a required trace parameter of a procedure in its c_procedure
representation, since it can no longer be computed from the global
trace level.
compiler/compile_target_code.m:
compiler/handle_options.m:
compiler/llds_out.m:
compiler/mercury_compile.m:
Trivial changes to conform to updated interfaces.
compiler/stack_opt.m:
Use the option opt_no_return_calls, instead of approximating it
with the trace level. (The old code was a holdover from before the
creation of the option.)
tests/debugger/shallow.m:
tests/debugger/shallow2.m:
tests/debugger/shallow.{inp,exp*}:
Divide the old test case in shallow.m in two. The top level predicates
stay in shallow.m and continue to be shallow traced. The two bottom
predicates move to shallow2.m and are now deep traced.
The new test input checks whether the debugger can walk across the
stack frames of procedures in shallow traced modules whose effective
trace level is "none" (such as queen/2).
Estimated hours taken: 1.5
Branches: main
Fix the code to add extra initialization functions to library/mer_std.init.
compiler/options.m:
doc/user_guide.texi:
compiler/compile_target_code.m:
Rename the `--make-init-file-command' as `--extra-init-command'.
This should now only generated the extra entries in the `.init'
file, not the whole file.
scripts/Mmake.vars.in:
compiler/modules.m:
Allow $(EXTRA_INIT_COMMAND) as the Mmake equivalent
of `--extra-init-command'. Append the output of
$(EXTRA_INIT_COMMAND) to the `.init' file.
library/Mmakefile:
Set EXTRA_INIT_COMMAND rather than overriding the
libmer_std.init rule.
Estimated hours taken: 0.5
Branches: main
Clean up the handling of the exit status in the compiler.
This doesn't fix any known bugs, but may prevent new ones.
compiler/passes_aux.m:
Don't set the exit status to 1 if a system command fails. That
should be done by a caller if the failed command means that the
compilation as a whole fails.
Add a predicate maybe_set_exit_status to set the exit status
to 1 if the boolean argument representing the success or failure
of a command is `no'.
compiler/compile_target_code.m:
Don't set the exit status if a compilation fails -- leave
that the mercury_compile.m.
compiler/mercury_compile.m:
Call maybe_set_exit_status to check the result of target
code compilations.
Estimated hours taken: 0.1
Branches: main
compiler/passes_aux.m:
compiler/compile_target_code.m:
compiler/mercury_compile.m:
Back out my last change. I thought I had sent it for
review, but I can't find the message in the archive.
Estimated hours taken: 0.5
Branches: main
Clean up the handling of the exit status. This doesn't fix any
known bugs, but may prevent new ones.
compiler/passes_aux.m:
Don't set the exit status to 1 if a system command fails. That
should be done by a caller if the failed command means that the
compilation as a whole fails.
Add a predicate maybe_set_exit_status to set the exit status
to 1 if the boolean argument representing the success or failure
of a command is `no'.
compiler/compile_target_code.m:
Don't set the exit status if a compilation fails -- leave
that the mercury_compile.m.
compiler/mercury_compile.m:
Call maybe_set_exit_status to check the result of target
code compilations.
Estimated hours taken: 2.5
Branches: main
Recently I changed the interactive query facility in the debugger
to use `mmc --make' to build the shared library containing the query.
There were two problems with this. The entire program was included in
the shared library, not just the query module. Also, invoking
`mmc --make query.realclean' cleaned up the user's files.
compiler/options.m:
compiler/compile_target_code.m:
Add an option `--compile-to-shared-lib', which causes
mmc to package the modules on the command line into
a shared library, not an executable. This option is
intended only for use by browser/interactive_query.m,
so it isn't documented.
browser/interactive_query.m:
Use `mmc --compile-to-shared-lib', not `mmc --make'
to build the query shared library.
Name the query source file mdb_query.m rather than query.m
to reduce the chance of overwriting a user's file.
tests/debugger/Mmakefile:
Use `lmc' to compile the query if `WORKSPACE' is set,
rather than using a Mercury.options file to set up
for the workspace.
tests/debugger/interactive.exp:
Update expected output.
Estimated hours taken: 1
Branches: main
Handle LDFLAGS and LD_LIBFLAGS with `mmc --make'.
compiler/options.m:
doc/user_guide.texi:
Add `--ml-flags' as a synonym for `--link-flags'.
Add `--ld-flags' and `--ld-libflags', which are the
options corresponding to the LDFLAGS and LD_LIBFLAGS
Mmake variables.
Add a comment that the `--output-file' option is
ignored with `mmc --make'.
compiler/options_file.m:
Handle LDFLAGS and LD_LIBFLAGS.
Handle MLLIBS correctly. MLLIBS contains `-l' options
(which can be handled by mmc), not flags for ml.
The value of LIBRARIES (which contains Mercury libraries
to link with) now comes before MLLIBS, because Mercury
libraries depend on C libraries, but C libraries usually
don't depend on Mercury libraries.
compiler/compile_target_code.m:
Pass the value `--ldflags' or `--ld-libflags' to ml.
scripts/Mmake.vars.in:
Add LDFLAGS and LD_LIBFLAGS to the options file
passed to the options file passed to `mmc --make'
on standard input.
Estimated hours taken: 3
Handle `mmc --make lib<module>' target, which builds all the files
required to use a library in the current grade.
compiler/make.m:
Check for `lib<module>' when attempting to classify a target.
compiler/make.program_target.m:
compiler/compile_target_code.m:
Make `.init' files when building the `.a' file.
Invoke the command given by `--pre-link-command' before linking.
compiler/make.module_target.m:
compiler/make.util.m:
Move find_oldest_timestamp into make.util.m for
use by make.program_target.m.
compiler/options.m:
doc/user_guide.texi:
Add an option `--make-init-file-command', to specify an
alternative command to make the `.init' file. This is needed
for the standard library.
Add an option `--pre-link-command', which specifies a
command to be run before linking. This is useful if there
are foreign files which depend on headers produced by
the Mercury compiler.
Estimated hours taken: 0.1
Branches: main
compiler/compile_target_code.m:
- % Are we generating position indepedent code (for use in a
+ % Are we generating position independent code (for use in a
Estimated hours taken: 2.5
Branches: main
Complete the support for building libraries with `mmc --make'.
compiler/make.m:
compiler/make.module_target.m:
compiler/mercury_compile.m:
compiler/compile_target_code.m:
Generate the `.pic_o' files needed to build shared libraries.
scripts/mmc.in:
Add `--pic-object-extension', `--create-archive-command'
`--create-archive-command-output-flag',
`--create-archive-commandflags' and `--ranlib-command'
options to DEFAULT_MCFLAGS.
Allow DEFAULT_MCFLAGS to be overridden in the environment,
for consistency with the other *FLAGS variables.
Estimated hours taken: 0.25
Branches: main
compiler/compile_target_code.m:
compiler/make.program_target.m:
compiler/make.util.m:
Put the `lib' prefix on the filenames for `.a' and `.so' files.
Estimated hours taken: 6
Branches: main
Allow alternative locations for the standard library files
to be specified using options to the various Mercury scripts
rather than environment variables. This change is necessary
to allow the compiler to be compiled using `mmc --make', because
`mmc --make' does not support the environment variables.
All of the Mercury scripts now accept an option
`--mercury-standard-library-directory' to specify the installed
library to use, or `--no-mercury-standard-library-directory' to
disable the use of the installed library. The location
of the alternate files to use can then be specified
using ordinary options to the scripts.
There is a new environment variable MERCURY_STDLIB_DIR, which has
the same effect as the `--mercury-standard-library-directory' option.
scripts/parse_ml_options.sh-subr.in:
scripts/mgnuc.in:
scripts/mmc.in:
scripts/mmake.in:
scripts/Mmake.vars.in:
scripts/Mmake.rules:
Handle MERCURY_STDLIB_DIR and `--mercury-standard-library-directory'.
Remove support for the MERCURY_C_INCL_DIR, MERCURY_MOD_LIB_DIRS
and MERCURY_TRACE_LIB_DIRS environment variables -- they aren't
used anywhere. MERCURY_C_INCL_DIR is being removed because the
assumption it makes (that all header files are installed into
a single directory) will not hold for much longer because the
generated header files for hl* grades are grade dependent.
compiler/options.m:
compiler/compile_target_code.m:
Add an option `--trace-init-file', used to specify `.init'
files which should only be used when tracing is enabled,
such as browser/mer_browse.init.
Allow `--mercury-stdlib-dir' as an abbreviation for
`--mercury-standard-library-directory'.
tools/lmc:
Use options rather than environment variables.
doc/user_guide.texi:
Document MERCURY_STDLIB_DIR, MERCURY_TRACE_LIB_MODS
and the `--trace-init-file' mmc option.
Remove documentation for the no longer used MERCURY_C_INCL_DIR,
MERCURY_MOD_LIB_DIRS, MERCURY_TRACE_LIB_DIRS and
MERCURY_NC_BUILTIN environment variables.
The main aim of this change is to make the overall, high-level structure
of the compiler clearer, and to encourage better encapsulation of the
major components.
compiler/libs.m:
compiler/backend_libs.m:
compiler/parse_tree.m:
compiler/hlds.m:
compiler/check_hlds.m:
compiler/transform_hlds.m:
compiler/bytecode_backend.m:
compiler/aditi_backend.m:
compiler/ml_backend.m:
compiler/ll_backend.m:
compiler/top_level.m:
New files. One module for each of the major components of the
Mercury compiler. These modules contain (as separate sub-modules)
all the other modules in the Mercury compiler, except gcc.m and
mlds_to_gcc.m.
Mmakefile:
compiler/Mmakefile:
Handle the fact that the top-level module is now `top_level',
not `mercury_compile' (since `mercury_compile' is a sub-module
of `top_level').
compiler/Mmakefile:
Update settings of *FLAGS-<modulename> to use the appropriate
nested module names.
compiler/recompilation_check.m:
compiler/recompilation_version.m:
compiler/recompilation_usage.m:
compiler/recompilation.check.m:
compiler/recompilation.version.m:
compiler/recompilation.version.m:
Convert the `recompilation_*' modules into sub-modules of the
`recompilation' module.
compiler/*.m:
compiler/*.pp:
Module-qualify the module names in `:- module', `:- import_module',
and `:- use_module' declarations.
compiler/base_type_info.m:
compiler/base_type_layout.m:
Deleted these unused empty modules.
compiler/prog_data.m:
compiler/globals.m:
Move the `foreign_language' type from prog_data to globals.
compiler/mlds.m:
compiler/ml_util.m:
compiler/mlds_to_il.m:
Import `globals', for `foreign_language'.
Mmake.common.in:
trace/Mmakefile:
runtime/Mmakefile:
Rename the %.check.c targets as %.check_hdr.c,
to avoid conflicts with compiler/recompilation.check.c.