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: 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/process_util.m:
Fix an ISO C conformance error: C global variables need to be
declared as `extern' in the pragma foreign_decl, to avoid
multiple definition errors on some systems (e.g. with tcc)
if the foreign_decls get duplicated.
Estimated hours taken: 20
Branches: main
Various bug fixes for the `il' grade.
These get us closer to bootstrapping on .NET.
Mmake.workspace:
Set MERC_C_INCL_DIR and MERC_DLL_DIR, since these are needed
when building in grade `il'.
library/Mmakefile:
Fix the dependencies for `mercury.dll' to avoid relinking it
every time `mmake' gets invoked.
library/io.m:
- Implement io__rename_file in C#.
- Change io__file_modification_time so that on .NET it returns
an error rather than throwing an exception.
- Fix some bugs in the MC++ code for mercury_getchar():
- add a missing "break" statement
- update the line count correctly when reading a character
after it has been put back by io__putback_char.
- compute line numbers correctly even for text files formatted
differently than the environment expects, e.g. those that use
Unix-style bare LF rather than Windows-style CR-LF.
trace/Mmakefile:
Ensure that in `il' grade we don't build anything in this directory.
compiler/Mmakefile:
Conditionalize some dependencies that were bogus for the `il' grade.
Add a work-around for the lack of Mmake support for
`--transitive-intermodule-optimization'.
compiler/bytecode_data.m:
Provide Mercury clauses (that just call sorry/1) as an alternative
to C foreign_proc code for `float_to_float64_bytes'.
compiler/process_util.m:
Fix a mode error and a missing import that only showed up in `il'
grade, since they occured in Mercury clauses which are only used
on back-ends which don't support the C interface.
Estimated hours taken: 0.5
Branches: main, release
compiler/process_util.m:
Avoid possible misaligned memory accesses by using
`:- pragma foreign_type' for the signal_action type
instead of c_pointer. It's now up to the compiler
and runtime to get the alignment correct.
Estimated hours taken: 1.5
Branches: main, release
Fix bugs in the handling of signals with `mmc --make'.
compiler/process_util.m:
Reset the signal handlers in the child to the defaults
so that SIGTERM is not ignored.
Don't infinitely loop if the child ignores SIGTERM.
runtime/mercury_signal.{c,h}:
Add a function MR_init_signal_action() which initializes a
MR_signal_action suitable for passing to MR_set_signal_action().
runtime/mercury_std.h:
Fix a #include in the wrong place which caused MR_is_eintr
to always fail.
Estimated hours taken: 1
Branches: main
Only refer to EINTR if it is defined.
runtime/mercury_std.h:
Add a macro MR_is_eintr which tests whether its
argument is EINTR, or returns false if EINTR
not undefined.
trace/mercury_trace_internal.c:
compiler/process_util.m:
Use MR_is_eintr.
Estimated hours taken: 12
Branches: main
Until now, programmers could add `tabled_for_io' annotations to foreign_procs
that do I/O, which asks the compiler to make those foreign_procs idempotent,
i.e. ensures that they are performed at most once even in the presence of a
retry operation in the debugger. This change adds a compiler option,
--trace-table-io-require, which generates an error if a foreign_proc that does
I/O does not have this annotation. Specifying this option thus ensures
that all I/O done by the program is idempotent.
In the future, we may want to have this option turned on in all debugging
grades. Until we decide about, the new option is not yet documented.
compiler/options.m:
Add the new option --trace-table-io-require.
compiler/handle_options.m:
Make --trace-table-io-require imply --trace-table-io.
compiler/table_gen.m:
If --trace-table-io-require is enabled, require all I/O primitives
to have the tabled_for_io annotation.
compiler/mercury_compile.m:
Pass I/O states to table_gen.m, since it can now generate error
messages.
trace/mercury_trace_util.h:
trace/mercury_trace_vars.c:
When calling Mercury code from the trace directory, disable I/O
tabling, since any I/O actions executed by Mercury code in the browser
directory (or by library code called from there) should not be tabled,
not being part of the user program.
Due to the depth of nesting, make mercury_trace_vars.c use four-space
indentation.
browser/collect_lib.m:
browser/declarative_debugger.m:
browser/declarative_execution.m:
browser/dl.m:
browser/io_action.m:
browser/mdb.m:
browser/name_mangle.m:
browser/util.m:
compiler/gcc.m:
compiler/mercury_compile.m:
compiler/passes_aux.m:
compiler/process_util.m:
compiler/stack_layout.m:
library/io.m:
library/time.m:
tests/debugger/declarative/tabled_read_decl.m:
Add a whole lot of tabled_for_io annotations, to enable the compiler to
bootstrap with --trace-table-io-require enabled.
In many cases, this required turning old-style pragma c_code into
pragma foreign_proc. While doing that, I standardized the layouts
of pragma foreign_procs.
browser/util.m:
Turn an impure semidet predicate into a pure det predicate with I/O
states, to allow it to be tabled. Make it return a Mercury bool
to indicate success or failure.
library/bool.m:
Add functions that allow C code to get their hands on the constants
`yes' and `no', for communication with Mercury code.
library/table_builtin.m:
Add debugging code to the main primitive of I/O tabling. This is
controlled both by the macro for retry debugging and a boolean global.
library/mercury_trace_base.[ch]:
Add the boolean global variable to switch the new debugging code in
table_builtin.m on and off.
library/mercury_trace_internal.c:
When starting I/O tabling with retry debug enabled, turn on the switch.
tests/debugger/queens.exp3:
New expected output file that applies when the library is compiled with
--trace-table-io-require.
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.
Estimated hours taken: 1.5
Branches: main
Rearrange some code after the `--make' change. This was not done
as part of that change for ease of reviewing.
compiler/mercury_compile.m:
compiler/compile_target_code.m:
compiler/make.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
Move code to compile the generated code into compile_target_code.m.
compiler/make.util.m:
compiler/passes_aux.m:
compiler/process_util.m:
Move process and signal handling functionality into process_util.m.
compiler/Mmakefile:
Compile process_util.c with `--no-ansi' so that the declarations
of `struct sigaction' and `kill' are available on Linux.
compiler/notes/compiler_design.html:
Document compile_target_code.m and process_util.m.
Move timestamp.m into the "Miscellaneous" section (it's
used by make as well as smart recompilation).
Fix the documentation of options_file.m.