Estimated hours taken: 3
Prefix everything defined in runtime/mercury_{stacks,tags}.h MR_.
In the process, get rid of the grade component MR_DEBUG_NONDET_STACK,
since this makes the update to mercury_stacks.h simpler and its use is
long obsolete.
runtime/mercury_tags.h:
Put MR_ prefixes in front of everything defined here.
runtime/mercury_stacks.h:
Put MR_ prefixes in front of everything defined here.
Remove support for MR_DEBUG_NONDET_STACK. Replace most of the
lost functionality by calling an updated mkframe_msg.
Remove the definitions of push() and pop(). Their use conflicts with
the idea that everything on the det stack is part of a frame, which
the RTTI stuff depends on.
runtime/mercury_bootstrap.h:
Add backward compatibility macros for the old names in the above two
files.
Remove some old entries in this file which are no longer needed.
runtime/mercury_wrapper.c:
Remove the only uses of push() and pop().
Put MR_ in front of some things that need them.
runtime/mercury_engine.c:
Put MR_ in front of some things that need them.
runtime/mercury_misc.[ch]:
Make mkframe_msg get the name of the procedure that owns the stack
frame from an explicitly passed argument, rather than the prednm slot
(which no longer exists). This actually improves low-level debugging
support without MR_DEBUG_NONDET_STACK.
Remove unnecessary return statements.
runtime/mercury_debug.h:
Pass on the new arg of mkframe_msg.
Fix long lines.
runtime/mercury_conf_param.h:
Remove the documentation of MR_DEBUG_NONDET_STACK.
runtime/mercury_grade.h:
Remove the grade component of MR_DEBUG_NONDET_STACK.
doc/reference_manual.texi:
Document the MR_ prefixed versions of list_empty, list_cons etc.
library/io.m:
library/std_util.m:
library/string.m:
Add prefixes to some references to the runtime.
Estimated hours taken: 6
Fix some bugs in tabling, to enable the boyer test case to work.
runtime/mercury_tabling.h:
Add a new set of macros that optionally print debugging info at
tabling actions. Debugging recquires compilation with -DMR_TABLE_DEBUG
and -dT in MERCURY_OPTIONS.
runtime/mercury_table_any.c:
Use the debugging macros. Fix two bugs, one found with their help.
One is that a tagged pointer to the table giving information about
remote secondary tags did not have its tag stripped before use.
The other is that the extraction of local secondary tags from words
was done by subtracting the tag, and not by shifting out the tag,
leaving the secondary tag value too high by a factor of 4 or 8.
runtime/mercury_table_any.[ch]:
runtime/mercury_table_enum.[ch]:
Change the order of some function arguments to be consistent with
the orders in the macros that call these functions.
runtime/mercury_table_enum.c:
Add an optional sanity check that detects the second bug above.
runtime/mercury_engine.[ch]:
Add a new debug flag, MR_tabledebug. Rename the flags so they always
start with MR_.
runtime/mercury_wrapper.c:
Allow -dT in MERCURY_OPTIONS to set MR_tabledebug.
runtime/*.[ch]:
Trivial changes for the new names of the debug flags.
runtime/Mmakefile:
Reimpose alphabetical order on the list of C files.
library/private_builtin.m:
Use the new debugging macros in the C code that does tabling.
Expose the equivalence between ml_table, ml_subgoal_table_node etc
and c_pointer. The reason is
% These equivalences should be local to private_builtin. However,
% at the moment table_gen.m assumes that it can use a single variable
% sometimes as an ml_table and other times as an ml_subgoal_table_node
% (e.g. by giving the output of table_lookup_insert_int as input to
% table_have_all_ans). The proper fix would be for table_gen.m to
% use additional variables and insert unsafe casts. However, this
% would require significant work for no real gain, so for now
% we fix the problem by exposing the equivalences to code generated
% by table_gen.m.
library/mercury_builtin.m:
Delete the contents of this obsolete file, leaving only a pointer
to builtin.m and private_builtin.m.
tests/tabling/Mmakefile:
Enable the boyer benchmark, since we now pass it.
Estimated hours taken: 30
Extend the new failure handling method to optionally preserve an invariant
required by accurate gc: always being able to tell with respect to what MR_sp
or MR_curfr to interpret the stackvars and framevars referred to by the label
whose address is the redoip slot of a nondet stack frame. This basically
requires limitations on the hijacking of redoip/redofr slot pairs.
compiler/notes/failure.html:
Describe the new extension.
Change the terminology to conform to what is used in the code.
compiler/llds.m:
For each temporary frame on the nondet stack, specify the native
stack of the procedure that created it. This is so that we know
whether the temporary frame ought to have the fourth slot that
specifies the right value of MR_sp. (The fourth slot is included
only in temporary nondet stack frames created procedures that live
on the det stack; procedures that live on the nondet stack never
have any of their variables on the det stack.)
Remove the modframe llds instruction, since it does not specify
what frame's redoip slot it is assigning to. This is error-prone
(see peephole.m below). We were not using modframe much anyway.
compiler/llds_out.m:
compiler/opt_debug.m:
Emit either mktempframe or mkdettempframe depending on the new
field in temp_frame.
compiler/code_info.m:
Add a fourth item to the failure state, which states whether
the top frame of the nondet stack may be hijacked. Initialize
it from the option --allow-hijacks. If about to do a hijack
but the failure state says no, create a temporary frame instead.
Separate out the code for creating temporary frames, since it
is now called from more than one place. Generalize the code
to handle the new type of temp frame.
compiler/code_info.m:
compiler/ite_gen.m:
Simplify the way we transmit information about the location
of the address of the nondet stack frame in which the soft cut
is performed from the start of the condition to its end.
Remove the predicate code_info__maybe_push_temp_frame;
its functionality is now achieved in code_info.m by disabling
and restoring --allow-hijacks around the generation of code
for the condition. This also allows us to get rid of the code
that finds out whether the condition can do any hijacking.
compiler/opt_util.m:
Rename next_modframe as next_assign_to_redoip, and add an additional
argument that says which frame's redoip we are after.
compiler/peephole.m:
Use the new argument of opt_util__next_assign_to_redoip to fix a bug
where a mkframe of a temporary frame (which leaves curfr unchanged)
that was followed a modframe (which assigns to the redoip of curfr)
was incorrectly optimized (the assignment to the redoip slot was
applied to the temporary frame, not the ordinary one).
compiler/*.m:
Minor changes to accommodate the disappearance of modframe.
runtime/mercury_stacks.h:
Add macros to support four-word temp frames on the nondet stack.
Make the macros that access nondet stack frame slots start with MR_,
while keeping (redefined) macros needed for backward compatibility.
Remove the modframe macro.
Fix a dangling reference to PREDNM instead of MR_PREDNM.
runtime/mercury_stack_trace.c:
Modify the stack tracing code to allow for the new four-word temp
frames.
Use the new MR_ prefixed variants of the macros.
runtime/mercury_debug.h:
runtime/mercury_misc.[ch]:
Remove references to modframe.
tests/general/complex_failure.{m,exp}:
A new test case to tickle the various ways of handling nested
disjunctions and if-then-elses in the new code generator.
tests/general/Mmakefile:
Enable the new test case.
tests/{general,hard_coded}/space.{m,exp}:
Move this test case from general to hard_coded. Although NU-Prolog
can execute it, it does not give the same answers as Mercury due to
a different default ordering and a difference in integer size (26-bit
integers in NU-Prolog) that changes the behavior of the pseudo
random-number generator.
tests/hard_coded/cycles2.exp:
Add the missing .exp file for this existing test case.
tests/hard_coded/Mmakefile:
Enable the old test cases cycles, cycles2 and space, since
we now pass them.
Estimated hours taken: 4
Clean up the handling of configuration macros in the runtime.
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
Move the code to set configuration parameters based on
the values of other configuration parameters from
mercury_conf.h.in to a new file mercury_conf_param.h,
because otherwise autoconf munges the code in undesirable ways
(it replaces all `#undef <foo>' statements with `/* #undef <foo> */').
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
runtime/*.h:
runtime/*.c:
Use more meaningful names, starting with the usual `MR_' prefix,
for various configuration parameters:
- replace the existing configuration macros SPEED with
three new macros MR_CHECK_OVERFLOW, MR_LOWLEVEL_DEBUG,
and MR_DEBUG_NONDET_STACK;
- rename DEBUG_GOTOS as MR_DEBUG_GOTOS, and make it
implied by MR_LOWLEVEL_DEBUG;
- rename DEBUG_LABELS as MR_CHOOSE_ENTRY_POINT.
(But there are still many configuration parameters that don't
start with `MR_', I'm afraid.)
runtime/CFLAGSFILE:
runtime/mercury_conf_param.h:
Removed CFLAGSFILE. The documentation there was had rotted badly.
I moved most of it to mercury_conf_param.h where hopefully
it will stand a better chance of being kept up-to-date.
I added documentation for the configuration parameters added in
the last year or so. The documentation here now covers
every configuration parameter that we use; please keep it that way!
runtime/mercury_debug.h:
Fix a bug: there was a misplaced "#endif".
runtime/mercury_stack_trace.c:
Fix yet another misspelling of "deterministic".
Estimated hours taken: 0.5
runtime/mercury_debug.h:
runtime/mercury_misc.h:
runtime/mercury_misc.c:
Fix a name clash: the code here and in mercury_heap.h
were using the name `incr_hp_msg' to mean two different things.
The reason this wasn't picked up earlier is that the
code here is only included conditionally, if DEBUG is defined.
To fix it, I renamed the one here as `incr_hp_debug_msg'.
Estimated hours taken: 1
runtime/*.h:
runtime/*.c:
runtime/mercury_conf.h.in:
Remove old .h files.
Update #includes to refer to mercury_*.h
Update #ifdef MODULE_H to be #ifdef MERCURY_MODULE_H
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.