Estimated hours taken: 0.25
Branches: main
compiler/handle_options.m:
scripts/final_grade_options.sh-subr:
Make `--target il' imply `--high-level-data'.
This is needed to ensure that the `--il' and `--target il'
options select the `il' grade, which uses high-level data,
rather than the `ilc' grade, which uses low-level data and
which is no longer documented because it is not useful;
high-level data is better for both efficiency and
interoperability and for IL there are no advantages to
low-level data.
Estimated hours taken: 8
Branches: main
Have the configure script decide whether to install the Java grade.
configure.in:
Add Java to the list of library grades to install by default,
if the Java SDK is installed.
Add the option to disable the Java grade.
aclocal.m4:
Detect whether the Java SDK is installed. Currently this is done
by checking for javac, java and jar, then testing whether a program
can be compiled which confirms the version is recent enough.
scripts/Mmake.vars.in:
Add JAVAC, JAVA_INTERPRETER and JAR to the generated make variables.
Add JAR_CREATE_FLAGS make variable, set as "cf"
scripts/Mercury.config.in:
scripts/Mercury.config.bootstrap.in:
Define environmental variables MERCURY_JAVA_COMPILER and
MERCURY_JAVA_INTERPRETER.
Have the configure script set the default java compiler and interpreter
as part of DEFAULT_MC_FLAGS.
library/Mmakefile:
Use "$(JAR) $(JAR_CREATE_FLAGS)" instead of "jar cf"
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: 3
Branches: main
New rules for installing the Mercury standard library in grade Java.
library/Mmakefile:
Added new target 'jars' which creates a jar file for the library
classes and a jar file for the runtime classes.
Modified target 'install_library' so that it adds these jar files to
a new directory in the install path.
To use these jar files, the CLASSPATH environment variable must be set
to:
<library_path>/mer_std.jar:<library_path>/mer_std.runtime.jar:.
scripts/Mmake.vars.in:
Added variable INSTALL_JAVA_LIBRARY_DIR to define where the above jar
files will be installed.
Estimated hours taken: 0.25
Branches: main
scripts/mtags:
Apply a review comment from Peter Moulder: use "foo()" rather than
"&foo", since the latter disables prototype-checking.
Estimated hours taken: 1
Branches: main
scripts/mtags:
Change the way that mtags gets invoked so that it passes `-w'
to perl, to enable warnings, and fix the resulting warnings:
- use "&foo" instead of the deprecated "do foo" notation for
calling subroutines
- use uppercase for file handle variables, instead of lowercase
(which could overlap with future keywords)
- s/shift(ARGV)/shift(@ARGV)/g
- add underscore prefixes to singleton variables
($_cmd, $_running_under_some_shell).
- use 'exec perl ... ${1+"$@"}' instead of "exec perl $*".
This is necessary for correct handling of command-line arguments
that contain spaces.
Estimated hours taken: 0.25
Branches: main
scripts/ml.in:
Fix a bug in Zoltan's previous change to add the mdbcomp library:
mdbcomp was missing from the list of libraries to link with when
when tracing and static linking are both enabled.
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: 0.2
Branches: main
Fix bugs in the binary distribution.
configure.in:
Move the code to work out the arguments to pass
when reconfiguring before macro calls which clobber
the argument list.
scripts/mercury_config.in:
Don't abort because tools/lmc.in and tools/dotime.in
when configuring the binary distribution.
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: 0.1
Branches: main
scripts/c2init.in:
Document why this file includes canonical_grade_options.sh-subr
without including the other files (init_grade_options.sh-subr,
parse_grade_options.sh-subr and final_grade_options.sh-subr)
that canonical_grade_options.sh-subr depends on.
Estimated hours taken: 1
Branches: main
Don't create symlinks when installing with a Win32 version
of the compiler. The compiler won't know how to follow the
symlinks.
configure.in:
scripts/Mmake.vars.in:
scripts/Mercury.config.in:
compiler/modules.m:
When using `gcc -mno-cygwin' or MS Visual C++ to
build the compiler, don't create symlinks when installing.
compiler/options.m:
Add an option `--no-use-symlinks'.
Estimated hours taken: 0.25
Branches: main
compiler/modules.m:
Always pass ALL_GRADEFLAGS to mmc, even when building the
interface files. This avoids spurious "debugging is
available only in low-level C grades" errors when
the default grade is hlc.gc.
Zoltan did this for scripts/Mmake.rules but not modules.m.
scripts/Mmake.rules:
Pass ALL_GRADEFLAGS when errorchecking and converting to Mercury.
Estimated hours taken: 0.5
Branches: main
Make it easier to boostrap the addition of new configuration
options.
scripts/Mercury.config.bootstrap.in:
A version of Mercury.config.in that does not contain
any options which are not understood by the installed
compilers. This is used when building the stage1 compiler.
Mercury.config is used to build the stage2 and stage3
compilers, and when running the tests. Mercury.config is
installed by `mmake install'.
Mercury.config.bootstrap.in is currently the same
as Mercury.config.in.
Mmake.workspace:
tools/bootcheck:
tools/binary_step:
tools/lmc.in:
Work out which configuration file to use.
configure.in:
scripts/Mmakefile:
scripts/mercury_config.in:
Handle Mercury.config.bootstrap.
Estimated hours taken: 0.2
Branches: main
scripts/Mercury.config.in:
Remove quotes which caused problems if the configured
C compiler command consisted of multiple words,
e.g. gcc --no-cpp-precomp.
Estimated hours taken: 0.1
Branches: main
Fix bugs in my change to the handling of environment variables.
scripts/mgnuc.in:
Fix a sh syntax error which broke .hl(c) grades.
scripts/mmc.in:
Fix the list of environment variables.
Estimated hours taken: 0.5
Branches: main
Clean up the handling of environment variables.
scripts/Mmake.rules:
scripts/c2init.in:
scripts/mgnuc.in:
scripts/ml.in:
scripts/mmc.in:
scripts/parse_ml_options.sh-subr.in:
scripts/binary_step.in:
Remove support for the environment variables which were
previously used to override the location of the standard
library (MERCURY_ALL_C_INCL_DIRS, MERCURY_ALL_MC_C_INCL_DIRS,
MERCURY_INT_DIR, MERCURY_C_LIB_DIR, MERCURY_MOD_LIB_MODS,
MERCURY_TRACE_LIB_MODS).
scripts/Mercury.config.in:
Fix syntax errors.
Set the DEFAULT_MERCURY_LINKAGE variable here rather
than in the mmc script.
scripts/mmc.in:
Setting DEFAULT_MCFLAGS is no longer required -- mmc
now reads its configuration information from the
Mercury.config file. This also fixes a bug which
caused failures in the `mmc --make' tests in
debugging grades on mundroo -- `mmc --make' wasn't
including /usr/local/lib and /usr/local/include in
the search paths for libraries and headers.
configure.in:
Check that the installed compiler is capable of
reading the Mercury.config file.
Bootstrap tag: bootstrap_20030413_read_config_file.
NEWS:
doc/user_guide.texi:
Document the change.
Estimated hours taken: 0.2
Branches: main
scripts/Mmake.rules:
Pass $(ALL_GRADEFLAGS) to all invocations of the compiler, since
the compiler now has sanity checks on option values that could be
tripped with the default grade that may not be tripped with the actual
desired grade.
library/Mmakefile:
Delete my previous "fix" for this problem, since it is not needed
anymore.
Estimated hours taken: 20
Branches: main
Move the setting of configuration options from mmc.in to
an options file Mercury.config. This has a few advantages:
- reduces the duplication between mmc and mercury.bat
- reduces the chance of running out of environment space
on crappy operating systems (although we probably exceed
the command line length limits on those systems anyway).
- makes it easier to bootstrap changes which add new
configuration options.
Always read the options files, even without `--make',
to avoid inconsistent behaviour.
scripts/Mercury.config.in:
New file containing the configuration code from mmc.in.
configure.in:
Create scripts/Mercury.config.
bindist/Mmakefile:
Make sure Mercury.config.in goes in the binary distribution.
Mmakefile:
bindist/Mmakefile:
Mmake.common.in:
Make sure we get the correct setting of INSTALL_PREFIX
when building the binary distribution.
scripts/Mmakefile:
scripts/mercury_config.in:
bindist/bindist.Mmakefile.in:
Install Mercury.config.
compiler/options.m:
doc/user_guide.texi:
Add documentation for the `--config-file' option, which gives
the name of the configuration file to read.
Add an option `read-config-file-2003-03-01' which will be
used in configure.in to test whether the compiler is up
to date after the configuration code is removed from mmc.in
(after this change is installed everywhere).
Add `--mercury-config-dir' as an abbreviation for
`--mercury-configuration-directory'.
Mmake.workspace:
Use the configuration file in scripts/Mercury.config.
browser/Mmakefile:
compiler/Mmakefile:
scripts/Mmake.vars.in:
Always pass ALL_MCFLAGS to mmc so that mmc will
use the configuration file specified in the options.
compiler/handle_options.m:
Handle the default value of `--config-file'.
compiler/mercury_compile.m:
Read the configuration file.
Always read the options files, even without `--make',
to avoid inconsistent behaviour.
compiler/make.m:
Pass the variable settings from the configuration file
to make__process_args.
The options files have already been read in mercury_compile.m,
so don't read them again here.
compiler/make.util.m:
Add a version of build_with_module_options which doesn't
need a make_info, for use by mercury_compile.m.
compiler/options_file.m:
Export a predicate to read a single options file.
Make the predicates to read options files add to an initial
options_variables map, rather than always creating a new one.
Allow MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR
to be set in the options file or environment.
scripts/mmc.in:
Set MERCURY_STDLIB_DIR and MERCURY_CONFIG_DIR in
mercury_compile's environment.
Estimated hours taken: 0.25
Branches: main
Fix `mmc --make' test failures in debugging grades on mundroo
(it wasn't finding the readline library).
aclocal.m4:
scripts/mmc.in:
Pass `-L/usr/local/lib' and `--c-include-directory /usr/local/include'
to mmc if those directories exist.
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.1
Branches: main
scripts/Mmake.vars.in:
Don't pass MLFLAGS to `mmc --make' -- it's ignored
now that ml is implemented in the compiler.
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: 0.5
Branches: main
If $(EXT_FOR_EXE) is not empty, add a phony target
`main_module' which depends on `main_module'$(EXT_FOR_EXE)
With this change, the command used to build an executable
is consistent across platforms.
compiler/make.m:
Assume that a target on the command line which doesn't match
any other file type is an executable, even if $(EXT_FOR_EXE)
is not empty.
compiler/modules.m:
Add the rule.
scripts/Mmake.vars.in:
Add the name of each of the $(MERCURY_MAIN_MODULES) to
the list of targets which should be made by `mmc --make'
if mmake was invoked wih `--use-mmc-make'.
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: 80
Branches: main
A first implementation of the inter-module analysis framwork.
Currently only unused argument analysis is supported.
The current inter-module analysis scheme using `.trans_opt' files
has some major limitations. The compilation dependencies introduced
by `.trans_opt' files are too complicated for Mmake without major
limitations on which modules can use the contents of which `.trans_opt'
files. Also, the `.trans_opt' file system only computes greatest fixpoints,
which is often too weak to find opportunities for optimization.
A better solution is to provide a library which manually handles
the dependencies introduced by inter-module analysis, and can deal with
the complications introduced by cyclic module dependencies.
TODO:
- support other analyses, e.g. termination, type specialization
- dependency tracking and invalidation after source modifications
- garbage collection of unused versions
- least fixpoint analyses
analysis/Mmakefile:
analysis/mer_analysis.m:
analysis/analysis.m:
analysis/analysis.file.m:
The analysis library.
analysis/README:
Description and design documentation.
Mmake.workspace:
Mmakefile:
compiler/Mmakefile:
tools/bootcheck:
Link the analysis library into mercury_compile.
compiler/hlds_module.m:
Store analysis information in the module_info.
compiler/options.m:
doc/user_guide.texi:
Add an option `--intermodule-analysis'.
compiler/mercury_compile.m:
Call the analysis library to write the gathered
information at the end of a compilation.
compiler/unused_args.m:
Call the analysis library to retrieve information
about imported procedures. This replaces code which
used the `.opt' files.
Change the names created for unused arguments procedures
to include the arguments removed, rather than a sequence
number. I think Zoltan is working on a change to name
mangling, so I haven't updated the demangler.
compiler/prog_util.m:
Generate the new predicate names for unused_args.m.
library/std_util.m:
Add a polymorphic version of unit, which is useful
for binding type variables.
compiler/modules.m:
scripts/Mmake.vars.in:
Clean up files created by the analysis framework
in `mmake realclean'.
util/mdemangle.c:
profiler/demangle.m:
Document the change in the name mangling of procedures with
unused arguments.
configure.in:
Check for state variables and fixes for some typeclass bugs.
tests/warnings/Mmakefile:
tests/warnings/unused_args_analysis.{m,exp}:
Test case.
Estimated hours taken: 2
Branches: main
scripts/canonical_grade.sh-subr:
Fix a bug where passing il or java as the argument to
./canonical_grade --grade <grade> was returning "hl".
Estimated hours taken: 1
Branches: main, release
scripts/gud.el:
Fix the regexp which matches a procedure specification so that
it matches procedures which are contained in sub-modules.
Estimated hours taken: 0.25
Branches: main
scripts/Mmakefile:
Fix a bug introduced in Zoltan's recent change to the main branch:
delete a reference to the "install_cgi_scripts" target, since that
target no longer exists.
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: 1
Branches: main, release
Search /usr/local/lib for shared libraries. This fixes
problems linking debugging executables on mundroo.
configure.in:
aclocal.m4:
Check for /usr/local/lib.
scripts/ml.in:
Document why we don't default to static linking for
all libraries on Solaris/x86.
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.5
Branches: main
Fix a bug in fjh's previous change where we are passing the linker
flag for naming the output file to the C compiler, not the C compiler
flag.
scripts/Mmake.rules:
'-o' is the flag for naming the output file for the C compiler.
Estimated hours taken: 0.5
Branches: main
scripts/Mmake.rules:
When invoking $(MS_CL) to create DLLs, use the option "/LD" which
is documented in the help message, rather than the (undocumented?)
options "-link -noentry mscoree.lib -dll".
Estimated hours taken: 0.25
Branches: main
Fix "cygpath: command not found" errors with `mmake --use-mmc-make'.
configure.in:
bindist/bindist.configure.in:
scripts/Mmake.vars.in:
Check that `cygpath' exists, rather than hard-coding
it in Mmake.vars.in.