Estimated hours taken: 50
This change introduces interface tracing, and makes it possible to successfully
bootstrap the compiler with tracing (either interface or full).
compiler/options.m:
Change the bool options --generate-trace into a string option --trace
with three valid values: minimal, interface and full. The last two mean
what they say; the intention is that eventually minimal will mean
no tracing in non-tracing grades and interface tracing in tracing
grades.
compiler/globals.m:
Add a new global for the trace level.
compiler/handle_options.m:
Convert the argument of --trace to a trace level.
Use only consistent 4-space indentation in the deeply nested
if-then-else.
compiler/trace.m:
Implement interface tracing.
Rename trace__generate_depth_reset_code as trace__prepare_for_call,
since it does more than reset the depth if this module is compiled
with interface tracing.
Do not check whether tracing is enabled before calling MR_trace;
let MR_trace make the check. This trades increased non-tracing
execution time for a substantial code size reduction (which may
in turn benefit execution time).
compiler/call_gen.m:
Call trace__generate_depth_reset_code by its new name.
compiler/code_info.m:
Fix a bug in the handling of non/semi commits. When entering a commit,
we used to push a clone of whatever the top failure continuation was.
However, the resume setup for this continuation could have started
with a label that assumed that the resume vars were in their original
locations (which are often registers), whereas the method of
backtracking to that point only guarantees the survival of stack slots,
not registers.
(This bug caused two lines of incorrect code to be generated among
the approx 30 million lines of code in the stage 2 compiler when
compiled with tracing.)
Fix another bug (previously untriggered as far as I know) in the
handling of multi/det commits. This one was breaking the invariant
that the resume vars set of each entry on the failure continuation
stack included the resume vars set of every other entry below it,
which meant that the values of these resume vars were not guaranteed
to be preserved.
compiler/stack_layout.m:
Make layout structures local to their module. They are not (yet)
referred to by name from other modules, and by declaring them
to be global we caused their names to be included even in stripped
executables, adding several megabytes to the size of the binary.
(The names are not stripped because a dynamically linked library
may want to refer to them.)
Change the mercury_data__stack_layout__ prefix on the names of
generated globals vars to just mercury_data__layout__. It is now
merely too long instead of far too long.
Include the label number in the label layout structure and the number
of typeinfo variables in a var_info structure only with native gc.
Their only use is in debugging native gc.
Fix some documentation rot.
compiler/llds.m:
Add a new field to the pragma_c instruction that says whether the
compiler-generated C code fragments access any stack variables.
compiler/frameopt.m:
Use the new field in pragma_c's to avoid a bug. Because frameopt was
assuming that the pragma_c instruction that filled in the stack slots
containing the call sequence number and depth did not access the stack,
it moved the pragma_c before the incr_sp that allocates the frame
(it was trying to get it out of the loop).
compiler/*.m:
Minor changes to set or ignore the extra field in pragma_c, to refer
to layout structures via the new prefix, or to handle the --trace
option.
doc/user_guide.texi:
Update the documentation for --trace.
runtime/mercury_types.h:
Add the type Unsigned.
runtime/mercury_goto.h:
Use the shorter layout prefix.
runtime/mercury_stack_layout.h:
Use the shorter layout prefix, and include the label number only with
native gc.
runtime/mercury_trace.[ch]:
runtime/mercury_trace_internal.[ch]:
runtime/mercury_trace_external.[ch]:
runtime/mercury_trace_util.[ch]:
Divide the old mercury_trace.[ch] into several components, with one
module for the internal debugger, one for the interface to the
external debugger, one for utilities needed by both. Mercury_trace.c
now has only the top-level stuff that steers between the two
debuggers.
runtime/mercury_trace.[ch]:
Add the new global variable MR_trace_from_full. Before each call,
the calling procedure assigns TRUE to this variable if the caller
is fully traced, and FALSE otherwise. Interface traced procedures
generate trace events only if this variable is TRUE when they are
called (fully traced callee procedures ignore the initial value of
the variable).
Make MR_trace return immediately without doing anything unless
tracing is enabled and a new extra argument to MR_trace is TRUE.
This extra argument is always TRUE for trace events in fully traced
procedures, while for trace events from interface traced procedures,
its value is set from the value of MR_trace_from_full at the time
that the procedure was called (i.e. the event is ignored unless the
interface traced procedure was called from a fully traced procedure).
runtime/mercury_trace.[ch]:
runtime/mercury_trace_internal.[ch]:
For global variables that are stored in stack slots, make their type
Word rather than int.
Use a new function MR_trace_event_report instead of calling
MR_trace_event with a NULL command structure pointer to indicate
that the event is to be reported but there is to be no user
interaction.
Use %ld formats in printfs and casts to long for better portability.
runtime/mercury_trace_internal.c:
Save trace-related globals across calls to Mercury library code
in the debugger, since otherwise any trace events in this code
could screw up e.g. the event number or the call number sequence.
Create separate functions for printing port names and determinisms.
runtime/mercury_wrapper.h:
Disable the tracing of the initialization and finalization code
written in Mercury.
runtime/Mmakefile:
Update for the new source and header files.
tests/debugger/{debugger_regs,interpreter,queens}_lib.{m,inp,exp}:
One new copy of each existing test case. These ones are intended
to be used when the stage 2 library is compiled with tracing, which
affects the tests by adding events for the library procedures called
from the test programs.
The .m files are the same as before; one of the .inp files is a bit
different; the .exp files reflect the correct output when the library
is compiled with full tracing.
tests/debugger/Mmakefile:
Provide separate targets for the new set of test cases.
Use --trace full instead of --generate-trace.
tests/debugger/runtests:
Try both the new set of test cases if the old set fails, and report
failure only if both sets fail. This is simpler than trying to figure
out which set should be really tested, and the probability of a false
positive is negligible.
Estimated hours taken: 250
Add support for tabling.
This change allows for model_det, model_semidet and model_non memoing,
minimal model and loop detection tabling.
compiler/base_type_layout.m:
Update comments to reflect new runtime naming standard.
compiler/det_analysis.m:
Allow tabling to change the result of det analysis. This is
necessary in the case of minimal model tabling which can
turn a det procedure into a semidet one.
compiler/det_report.m:
compiler/hlds_data.m:
Add code to report error messages for various non compatible
tabling methods and determinism.
compiler/hlds_out.m:
compiler/modules.m:
Remove reference to the old memo marker.
compiler/hlds_pred.m:
Create new type (eval_method) to define which of the available
evaluation methods should be used each procedure.
Add new field to the proc_info structure.
Add several new predicates relating to the new eval_method type.
compiler/inlining.m:
compiler/intermod.m:
Make sure only procedures with normal evaluation are inlined.
compiler/make_hlds.m:
Add code to process new tabling pragmas.
compiler/mercury_compile.m:
Call the tabling transformation code.
compiler/modes.m:
Make sure that all procedures with non normal evaluation have
no unique/partially instantiated modes. Produce error messages
if they do. Support for partially instantiated modes is currently
missing as it represents a large amount of work for a case that
is currently not used.
compiler/module_qual.m:
compile/prog_data.m:
compiler/prog_io_pragma.m:
Add three new pragma types:
`memo'
`loop_check'
`minimal_model'
and code to support them.
compiler/simplify.m:
Don't report infinite recursion warning if a procedure has
minimal model evaluation.
compiler/stratify.m:
Change the stratification analyser so that it reports cases of
definite non-stratification. Rather than reporting warnings for
any code that is not definitely stratified.
Remove reference to the old memo marker.
compiler/switch_detection.m:
Fix a small bug where goal were being placed in reverse order.
Call list__reverse on the list of goals.
compiler/table_gen.m:
New module to do the actual tabling transformation.
compiler/notes/compiler_design.html:
Document addition of new tabling pass to the compiler.
doc/reference_manual.texi:
Fix mistake in example.
library/mercury_builtin.m:
Add many new predicates for support of tabling.
library/std_util.m:
library/store.m:
Move the functions :
ML_compare_type_info
ML_collapse_equivalences
ML_create_type_info
to the runtime.
runtime/mercury_deep_copy.c:
runtime/mercury_type_info.h:
runtime/mercury_type_info.c:
Move the make_type_info function into the mercury_type_info module
and make it public.
runtime/Mmakefile:
runtime/mercury_imp.h:
Add references to new files added for tabling support.
runtime/mercury_string.h:
Change hash macro so it does not cause a name clash with any
variable called "hash".
runtime/mercury_type_info.c:
runtime/mercury_type_info.h:
Add three new functions taken from the library :
MR_compare_type_info
MR_collapse_equivalences
MR_create_type_info.
runtime/mercury_table_any.c:
runtime/mercury_table_any.h:
runtime/mercury_table_enum.c:
runtime/mercury_table_enum.h:
runtime/mercury_table_int_float_string.c:
runtime/mercury_table_int_float_string.h:
runtime/mercury_table_type_info.c:
runtime/mercury_table_type_info.h:
runtime/mercury_tabling.h:
New modules for the support of tabling.
Estimated hours taken: 5
More cleanup of the memory management code.
This time we clean up the signal handler setup code.
runtime/Mmakefile:
Add new files.
runtime/mercury_memory.c:
Rename setup_signal() to setup_signals().
runtime/mercury_memory_handlers.c:
runtime/mercury_memory_handlers.h:
Clean up signal handling.
Use MR_setup_signal to setup signal handlers.
Define bus_handler and segv_handler signal handlers, the
old signal handlers are just one or the other (or both).
runtime/mercury_prof.c:
Use MR_setup_signal to setup signal handler.
runtime/mercury_signal.c:
runtime/mercury_signal.h:
New files -- a standard interface for setting up signal
handlers (a porting base, if you like).
Estimated hours taken: 5
Split mercury_memory.{c,h} into several files. Added a few
comments about functions whose declarations have been moved into
the header files, otherwise the content is unchanged.
runtime/Mmakefile:
Add new files.
runtime/mercury_context.c:
Add a #include "mercury_memory_handlers.h" as this module
creates new zones using default_handler.
runtime/mercury_memory.c:
runtime/mercury_memory.h:
Other code (mostly code to set up the actual memory
zones we use in the Mercury runtime).
runtime/mercury_memory_handlers.c:
runtime/mercury_memory_handlers.h:
Signal handlers for memory access violations.
runtime/mercury_memory_zones.c:
runtime/mercury_memory_zones.h:
The implementation MemoryZone data type.
Estimated hours taken: 1
Fix some Mmakefile errors that were diagnosed by `--warn-undefined-variables'.
Also, make a small fix to mmake.in and add empty definitions for various
Mmake variables to avoid spurious warnings.
scripts/mmake.in:
Add ` dep*' to the patterns for which we do not
pass `--warn-undefined-variables'; previously it
matched "$@" against `dep*', which did not catch the
case of `mmake -k depend'.
^^^
scripts/Mmake.vars.in:
Add definition for `ds_subdir'.
Define `MLLIBS' as `$(EXTRA_MLLIBS)' rather than empty,
and add empty definition for `EXTRA_MLLIBS'.
Add empty definition for `MAIN_TARGET'.
Mmakefile:
Fix misspelling: `deps_subdir' not `dep_subdir'.
Add empty definitions for `PREINSTALL_HACK', `POSTINSTALL_HACK',
and `MMAKEFLAGS'.
boehm_gc/Mmakefile:
Add empty definition for `PROF'.
runtime/Mmakefile:
Add empty definition for `DLL_CFLAGS'.
library/Mmakefile:
Add empty definition for `CHECK_TERM_OPTS'.
compiler/Mmakefile:
Add empty definition for `MTAGSFLAGS'.
Estimated hours taken: 0.75
scripts/mmake.in:
Pass `--warn-undefined-variables', except when making dependencies.
runtime/Mmakefile:
scripts/Mmake.vars.in:
Add empty definitions of a few variables, to avoid warnings with
`--warn-undefined-variables'.
Estimated hours taken: 12
Add support for stack dumps, do a stack dump from error/1.
compiler/Mmakefile:
library/Mmakefile:
profiler/Mmakefile:
runtime/Mmakefile:
Insert EXTRA_MGNUCFLAGS before CFLAGS or EXTRA_CFLAGS
becasue mgnuc stops processing its options when it
encounters a non-mgnuc option.
library/require.m:
Call MR_dump_stack if error is called.
runtime/Mmakefile:
runtime/mercury_imp.h:
Add #includes of new files.
runtime/mercury_type_info.h:
Remove conditional definition of MR_STATIC_CODE_ADDRESSES
(moved into mercury_conf.h.in).
runtime/mercury_accurate_gc.h:
Remove stack_layout stuff, leave this file for accurate
GC specific definitions.
runtime/mercury_conf.h.in:
Add conditional definitions of MR_INSERT_LABELS,
MR_USE_STACK_LAYOUTS, MR_NEED_INITIALIZATION_CODE and
MR_STATIC_CODE_ADDRESSES, depending on various other options.
runtime/mercury_goto.h:
Insert labels into label table if MR_INSERT_LABELS is defined,
rather than NATIVE_GC.
util/mkinit.c:
Initialize if MR_NEED_INITIALIZATION_CODE is defined, rather than
NATIVE_GC.
runtime/mercury_stack_layout.h:
All the old stack layout definitions from mercury_accurate_gc.h.
Add code for MR_DETISM_DET_CODE_MODEL.
runtime/mercury_stack_trace.c:
runtime/mercury_stack_trace.h:
Implement MR_dump_stack which just provides a dump of the stack
as far as possible.
Set MR_INSERT_LABELS and MR_USE_STACK_LAYOUTS if MR_STACK_TRACE
is set.
runtime/mercury_grade.h:
Add _strce if stack tracing is enabled in the grade. This
might not be a permanent change.
runtime/mercury_ho_call.c:
Remove unused label declarations.
scripts/mgnuc.in:
Add --stack-trace and --no-stack-trace options.
Consolidate some duplicate code.
Estimated hours taken: 40 (+ unknown time by Zoltan)
Add support for memory profiling.
(A significant part of this change is actuallly Zoltan's work. Zoltan
did the changes to the compiler and a first go at the changes to the
runtime and library. I rewrote much of Zoltan's changes to the runtime
and library, added support for the new options/grades, added code to
interface with mprof, did the changes to the profiler, and wrote the
documentation.)
[TODO: add test cases.]
NEWS:
Mention support for memory profiling.
runtime/mercury_heap_profile.h:
runtime/mercury_heap_profile.c:
New files. These contain code to record heap profiling information.
runtime/mercury_heap.h:
Add new macros incr_hp_msg(), tag_incr_hp_msg(),
incr_hp_atomic_msg(), and tag_incr_hp_atomic_msg().
These are like the non-`msg' versions, except that if
PROFILE_MEMORY is defined, they also call MR_record_allocation()
from mercury_heap_profile.h to record heap profiling information.
Also, fix up the indentation in lots of places.
runtime/mercury_prof.h:
runtime/mercury_prof.c:
Added code to dump out memory profiling information to files
`Prof.MemoryWords' and `Prof.MemoryCells' (for use by mprof).
Change the format of the `Prof.Counts' file so that the
first line says what it is counting, the units, and a scale
factor. Prof.MemoryWords and Prof.MemoryCells can thus have
exactly the same format as Prof.Counts.
Also cleaned up the interface to mercury_prof.c a bit, and did
various other minor cleanups -- indentation changes, changes to
use MR_ prefixes, additional comments, etc.
runtime/mercury_prof_mem.h:
runtime/mercury_prof_mem.c:
Rename prof_malloc() as MR_prof_malloc().
Rename prof_make() as MR_PROF_NEW() and add MR_PROF_NEW_ARRAY().
runtime/mercury_wrapper.h:
Minor modifications to reflect the new interface to mercury_prof.c.
runtime/mercury_wrapper.c:
runtime/mercury_label.c:
Rename the old `-p' (primary cache size) option as `-C'.
Add a new `-p' option to disable profiling.
runtime/Mmakefile:
Add mercury_heap_profile.[ch].
Put the list of files in alphabetical order.
Delete some obsolete stuff for supporting `.mod' files.
Mention that libmer_dll.h and libmer_globals.h are
produced by Makefile.DLLs.
runtime/mercury_imp.h:
Mention that libmer_dll.h is produced by Makefile.DLLs.
runtime/mercury_dummy.c:
Change a comment to refer to libmer_dll.h rather than
libmer_globals.h.
compiler/llds.m:
Add a new field to `create' and `incr_hp' instructions
holding the name of the type, for heap profiling.
compiler/unify_gen.m:
Initialize the new field of `create' instructions with
the appropriate type name.
compiler/llds_out.m:
Output incr_hp_msg() / tag_incr_hp_msg() instead of
incr_hp() / tag_incr_hp().
compiler/*.m:
Minor changes to most files in the compiler back-end to
accomodate the new field in `incr_hp' and `create' instructions.
library/io.m:
Add `io__report_full_memory_stats'.
library/benchmarking.m:
Add `report_full_memory_stats'. This uses the information saved
by runtime/mercury_heap_profile.{c,h} to print out a report
of memory usage by procedures and by types.
Also modify `report_stats' to print out some of that information.
compiler/mercury_compile.m:
If `--statistics' is enabled, call io__report_full_memory_stats
at the end of main/2. This will print out full memory statistics,
if the compiler was compiled with memory profiling enabled.
compiler/options.m:
compiler/handle_options.m:
runtime/mercury_grade.h:
scripts/ml.in:
scripts/mgnuc.in:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
Add new option `--memory-profiling' and new grade `.memprof'.
Add `--time-profiling' as a new synonym for `--profiling'.
Also add `--profile-memory' for more fine-grained control:
`--memory-profiling' implies both `--profile-memory' and
`--profile-calls'.
scripts/mprof_merge_runs:
Update to handle the new format of Prof.Counts and to
also merge Prof.MemoryWords and Prof.MemoryCells.
profiler/options.m:
profiler/mercury_profile.m:
Add new options `--profile memory-words' (`-m'),
`--profile memory-cells' (`-M') and `--profile time' (`-t').
Thes options make the profiler select a different count file,
Prof.MemoryWords or Prof.MemoryCells instead of Prof.Counts.
specific to time profiling.
profiler/read.m:
profiler/process_file.m:
profiler/prof_info.m:
profiler/generate_output.m:
Update to handle the new format of the counts file.
When reading the counts file, look at the first line of
the file to determine what is being profiled.
profiler/globals.m:
Add a new global variable `what_to_profile' that records
what is being profiled.
profiler/output.m:
Change the headings to reflect what is being profiled.
doc/user_guide.texi:
Document memory profiling.
Document new options.
doc/user_guide.texi:
compiler/options.m:
Comment out the documentation for `.proftime'/`--profile-time',
since doing time and call profiling seperately doesn't work,
because the code addresses change when you recompile with a
different grade. Ditto for `.profmem'/`--profile-memory'.
Also comment out the documentation for
`.profcalls'/`--profile-calls', since it is redundant --
`.memprof' produces the same information and more.
configure.in:
Build a `.memprof' grade. (Hmm, should we do this only
if `--enable-all-grades' is specified?)
Don't ever build a `.profcalls' grade.
Estimated hours taken: 0.2
Fix a bug in the change to clean up the runtime.
runtime/Mmakefile:
Add mercury_grade.h to the list of headers. Without this,
it doesn't get installed.
Estimated hours taken: 2
Cleaned up runtime directory.
runtime/*.c:
- Renamed all .c files as mercury_*.c
Some have been renamed to make their purpose clearer.
call.mod -> mercury_ho_call.c
runtime/*.h:
- Moved contents of .h files to mercury_*.h
- *.h now contain #include mercury_*.h. They be removed later.
- Updated references to conf.h -> mercury_conf.h
runtime/conf.h.in:
- Renamed conf.h.in as mercury_conf.h.in.
Didn't leave a forwarding header for this one, as conf.h was
never part of the repository anyway.
runtime/Mmakefile:
- Convert lists to one-per-line lists.
- Add mercury_accurate_gc.h to HDRS.
- Remove all .mod files
- Make sure runtime.init uses the ORIG_CS not MOD_CS.
- Fix the rules for "clean_o" and "clean_mod_c", which used
wildcards like "*.o" to remove files. The one that removed
all .c files corresponding with *.mod, instead of using MOD_CS
was particularly vicious.
- Cope with the file renamings.
configure.in:
- Cope with the file renamings.
Estimated hours taken: 0.5
Fix a bug that broke grades `*.gc.prof.tr'.
runtime/Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
When deciding whether to link with -lgc or -lgc_prof,
match against `*.gc*.prof*' rather than `*.gc*.prof'.
^
Estimated hours taken: 7
First implementation of the generation of traces for Opium-style trace
analysis.
In this initial implementation, there are only three ports: call, exit
and fail. Later versions will add ports that indicate entry to an arm
of a switch or disjunction and to the then or else part of an if-then-else.
compiler/options.m:
Add a new option, --generate-trace.
compiler/handle_options.m:
When --generate-trace is on, turn off HLDS->HLDS optimizations
that would change the behavior of the trace.
compiler/code_info.m:
Add a new field in code_into for storing information that is
needed when generating trace code. (At the moment, this info is
the identity of two stack slots storing the sequence number and
depth of the current procedure call.) This info must be in the
code_info structure, because it is used not only by code_gen.m
but also by call_gen.m, and later by switch_gen.m, disj_gen.m and
ite_gen.m.
compiler/code_gen.m:
Add code to initialize the tracing info in code_info and to add
trace statements to procedure prologs and epilogs if --generate-trace
is on.
compiler/call_gen.m:
Clean up the generation of code for calls, merging the three
predicates for det, semi and non procedures into one, and factoring
out some common code between the generation of code for normal calls
and higher order calls. Add code to reset the call depth just before
each (normal or higher-order) call if --generate-trace is on.
compiler/trace.m:
New file responsible for the generation of trace statements in the
C file output by the compiler. Code in code_gen.m and call_gen.m
calls trace.m; so will code in switch_gen.m, disj_gen.m and ite_gen.m.
compiler/mercury_compile.m:
When --generate-trace is on, include mercury_trace.h at the top
of generated C files.
runtime/mercury_trace.[ch]:
The new runtime tracing module. The proper version will be written
in Rennes, this is just for initial testing.
runtime/Mmakefile:
Include the new module in the runtime library.
doc/user_guide.texi:
Document --generate-trace.
compiled with different grades.
runtime/mercury_grade.h:
Define a macro MR_GRADE_VAR, which is set to MR_grade_<gr>,
where <gr> is one of asm_fast, asm_fast_gc_prof_tr, etc.
Declare MR_GRADE_VAR as a variable.
runtime/mercury_grade.c:
Define the MR_GRADE_VAR variable.
runtime/Mmakefile:
Add references to mercury_grade.[hc].
compiler/llds_out.m:
Include a reference to MR_GRADE_VAR in the generated C file.
This ensures that when the file is compiled,
the object file will contain a reference to MR_grade_<gr>.
Estimated hours taken: 1
boehm_gc/Makefile:
boehm_gc/Mmakefile:
library/Mmakefile:
runtime/Mmakefile:
Fix some bugs in the stuff for building windows DLLs.
runtime/Mmakefile:
library/Mmakefile:
compiler/Mmakefile:
profiler/Mmakefile:
Match $(GRADE) against `*.gc*' rather than `*.gc', so that it
will link in the GC library for grades such as `asm_fast.gc.tr'.
Estimated hours taken: 1
Changes to installation to ease package creation for Debian.
Mmake.common.in:
Add a FINAL_INSTALL_PREFIX variable (and various other
FINAL_INSTALL_* variables).
The FINAL variables should be used for any hardcoded paths
that will be used in the installation process, so that
the installation can be put into a temporary directory,
(by overriding INSTALL_PREFIX on the command line)
then moved into its final destination later.
In particular, shared library paths need to be treated this
way.
library/Mmakefile:
runtime/Mmakefile:
Use FINAL_INSTALL_* variables for shared library paths.
Estimated hours taken: 24
Implement support for DLLs on Windows.
The changes consisted of
1. Adding `Makefile.DLLs', which is a file I wrote contains
GNU Make rules for building DLLs. Making sure that
the various Mmakefiles include that one.
2. Making sure we #include the "libfoo_dll.h" header file
generated by `Makefile.DLLs' before every place that
references a global variable.
3. Making sure that code which defines the DLLs is
compiled with -Dlibfoo_DEFINE_DLL.
5. Changing various places to explicitly register the data
segment as a root set with the conservative garbage collector.
This was necessary to get GC working with DLLs under Windows
(there doesn't seem to be any way of automatically finding
the data segments of DLLs under win32).
6. Changing the way names are mangled to ensure that the assembler
names always contain a leading underscore, since `dlltool'
on gnu-win32 requires this.
TODO:
- Document how users can create their own DLLs.
- Add support for that to Mmake.
configure.in:
Mmake.common.in:
Add USE_DLLS variable. (Most of the Makefile changes below are
conditionalized on this variable.)
boehm_gc/Makefile:
Add dependency $(OBJS) : libgc_dll.h.
Add `-DGC_DEFINE_DLL' to CFLAGS.
Include Mmakefile.DLLs.
Add new targets `dll' and `test_dll'.
boehm_gc/Mmakefile:
Add stuff to install libgc_dll.h and libgc_globals.h.
boehm_gc/gc.h:
For __CYGWIN32__, #include "libgc_dll.h".
This is necessary to handle global variables in DLLs on Windows.
For __CYGWIN32__, define GC_INIT() to add the
data segment of the current DLL or executable as
a new root set.
library/Mmakefile:
Add stuff needed for building DLLs.
runtime/wrapper.mod:
library/io.m:
Add call to GC_INIT() to register the root set for
libmer.dll and libmercury.dll respectively.
In wrapper.mod, move the call to GC_is_visible
_after_ the calls to GC_INIT().
runtime/Mmakefile:
Add stuff needed for building DLLs.
runtime/init.h:
runtime/imp.h:
runtime/dummy.c:
runtime/label.c:
runtime/memory.c:
runtime/table.c:
For __CYGWIN32__, make sure we #include "libmer_dll.h".
before defining global variables.
This is necessary to handle global variables in DLLs
on Windows.
runtime/goto.h:
util/mdemangle.c:
prof/demangle.m:
Change the way names are mangled to ensure that the assembler
names always contain a leading underscore, since `dlltool'
on gnu-win32 requires this.
util/mkinit.c:
For __CYGIN32__, when using DLLs, make sure we initialize the
_impure_ptr of the DLLs that we're using.
library/Mmake:
runtime/Mmake:
Compile with -Dlibfoo_USE_DLL options.
Add code to install libfoo_dll.h and libfoo_globals.h.
Include Mmakefile.DLLs.
Estimated hours taken: 8
Generalize the current support for trailing.
Previously, the trail was hardwired, either for interfacing to CLP(R),
or (in my alternative not-checked-in version) for backtrackable destructive
arrays. But it couldn't handle both of these at the same time and it
couldn't be extended. So we have replaced this with a more generic
trail. The trail has two sorts of entries, value trail entries and
function trail entries.
runtime/mercury_trail.h:
runtime/mercury_trail.c:
New files. They provide macros MR_trail_value(),
MR_trail_function(), etc. which are the new interface to
the Mercury trail. (All the trailing stuff is done inside
`#ifdef MR_USE_TRAIL'.)
These files also implement the save_ticket(), restore_ticket(),
and discard_ticket() macros that are used in the C code that
the Mercury compiler generates, except that I've renamed them
and changed the interface slightly.
These files also define the trail memory zone MR_trail_zone,
and the new virtual machine registers MR_trail_ptr and
MR_ticket_counter. (Perhaps these should instead be in memory.c
and regs.h respectively?)
runtime/mercury_solver_backtrack.h:
Deleted, since this file has been replaced by mercury_trail.h.
runtime/imp.h:
#include "mercury_trail.h" rather than "mercury_solver_backtrack.h"
runtime/Mmakefile:
Add mercury_trail.c and mercury_trail.h.
Remove mercury_solver_backtrack.h.
runtime/context.h:
Add new fields to the Context struct to hold MR_trail_zone,
MR_trail_ptr and MR_ticket_counter. Add code to handle these
in save_context()/load_context().
runtime/context.mod:
Add code to new_context() to initialize the trail.
runtime/wrapper.h:
runtime/wrapper.mod:
runtime/memory.c:
Add code to handle setting the trail size via the
MERCURY_OPTIONS environment variable.
Remove old stuff to support the solver_stack.
runtime/wrapper.mod:
runtime/regs.h:
runtime/regorder.h:
Count the usage of the new virtual machine registers
MR_trail_ptr and MR_ticket_counter.
(Currently they are implemented just as global variables,
not registers.)
Estimated hours taken: 5
Allow the names of higher order types to be generated.
LIMITATIONS:
Document limitations introduced by this change.
compiler/polymorphism.m:
Map higher order predicates to pred/0 and functions to func/0.
library/mercury_builtin.m:
Move base_type_* for pred/0 out of library (into runtime).
library/std_util.m:
Check for pred/0 and func/0 when comparing type infos.
Create different ctor_infos for higher order preds, decode them
correctly for args and functors when needed.
Print functions nicely (eg func(foo) = bar).
Fix ML_create_type_info so it works correctly with higher order
types.
runtime/type_info.h:
Define macros to deal with new representation of higher order
ctor_infos.
runtime/deep_copy.c:
Fix make_type_info so it works correctly with higher order
types.
runtime/Mmakefile:
runtime/type_info.mod:
Add definitions for pred/0 and func/0 in runtime, they are
needed by deep copy.
tests/hard_coded/Mmake:
tests/hard_coded/higher_order_type_manip.exp:
tests/hard_coded/higher_order_type_manip.m:
Test case for this change.
They weren't working because Linux requires the `-rpath' option
be specified when linking the shared libraries, as well as when
linking executables. Previously we only passed `-rpath' option
when linking executables.
configure.in:
Mmake.common.in:
bindist/bindist.build_vars.in:
Add new configuration variables for handling `-rpath' or `-R' options:
EXE_RPATH_OPT, EXE_RPATH_SEP, SHLIB_RPATH_OPT, and SHLIB_RPATH_SEP.
scripts/ml.in:
Rewrite the system-specific code for handling rpaths
to instead use the new rpath configuration variables.
library/Mmakefile:
runtime/Mmakefile:
When linking shared libraries that depend on other shared libraries,
pass appropriate rpath options using the rpath configuration variables.
Estimated hours taken: 0.1
runtime/Mmakefile:
Replace the body of the `conf.h : conf.h.date' rule,
which used to be blank, with `@true', because recent
versions of GNU Make don't handle the blank rule the
way we want them to (they don't recheck the file's timestamp).
Estimated hours taken: 4
Add new predicate `float__hash' to the standard library for computing a
non-negative integer hash value for a float.
Add a C function to the runtime to do the actual hashing. This
function is in the runtime so that it can be called from both
the library and from C code generated for `pragma fact_table'
indexing.
library/float.m
Add a new predicate `float__hash' that calls the runtime
function `hash_float()'.
runtime/mercury_float.h
Add a declaration for `hash_float()'.
runtime/mercury_float.c
Add new file mercury_float.c for runtime code related to
floats.
Add a new function `hash_float()' for hashing floats.
Estimated hours taken: 0.1
runtime/.cvsignore:
Ignore context.c (since it's automatically generated from context.mod).
runtime/Mmakefile:
In the rule for check_headers, remove the temp file when we've
finished.