Estimated hours taken: 0.5
Improve efficiency on SPARCs, by replacing calls to save_transient_registers()
with calls to save_transient_hp() where appropriate -- the latter is defined
to do nothing for conservative GC.
runtime/mercury_regs.h:
Add save_transient_hp() and restore_transient_hp() macros
which only guarantee to save/restore the heap pointer.
runtime/mercury_deep_copy.c:
runtime/mercury_deep_copy.h:
runtime/mercury_heap.h:
runtime/mercury_layout_util.c:
runtime/mercury_string.h:
runtime/mercury_tabling.h:
runtime/mercury_type_info.c:
Use save_transient_hp() instead of save_transient_regs()
and restore_transient_hp() instead of restore_transient_regs().
runtime/mercury_trail.c:
runtime/mercury_trail.h:
Comment out a pair of calls to save/restore_transient_regs(),
add a similar pair, also commented out, and document why
neither pair is needed.
runtime/mercury_type_info.c:
Add some comments.
Estimated hours taken: 60
Changes required to get the samples directory to compile using lcc in
the grade `none.gc'.
compiler/llds_out.m:
Add a pass to make sure that the constants are all declared (with
a complete type) before they are initialised. We can't just
forward declare each constant immediately before it is used in an
initializer, as was done previously, because at that point we don't
know the type of the constant, and ANSI C doesn't allow forward
declarations of static variables with incomplete types.
Also change data_ptr to type (Word *). This is because (Word *) is
a superset of (const Word *) and it is a non-trivial task to get the
consts output in the correct places. Hopefully consts will be
output when I get the compiler to bootstrap using lcc.
scripts/mgnuc.in:
Don't warn about casts which remove the const. ie (const char *) to
(char *)
runtime/mercury_string.h:
Get rid of a cast.
runtime/mercury_tags.h:
Get rid of some of the const casts.
util/mkinit.c:
Make mkinit compile using lcc.
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: 20
Use stack layout tables to transmit information to the tracer, to allow
the tracer to print the names and values of variables at CALL and EXIT ports.
Extend stack layout tables to permit this.
For the time being the tables do not contain information about how to fill
in pseudo-typeinfos, so printing only works for monomorphic procedures.
compiler/llds.m:
Allow space for variable names in the information we gather about live
variables at given labels.
compiler/llds_out.m:
Print out variable names in the information we gather about live
variables at given labels in comments.
compiler/continuation_info.m:
Include variable names in the information we gather about live
variables at given labels.
Record the determinism of each procedure, not its code model.
compiler/{call_gen,code_gen,code_info}.m:
Include the names of variables in the data given to
continuation_info.m.
compiler/options.m:
Add a new developer-only option, --procid-stack-layout, whose effect
is to extend stack_layout structures with static info identifying the
procedure. This is used by execution tracing, and could (should) be
used by stack tracing and profiling.
Rename --alternate-liveness as --typeinfo-liveness. This is more
expressive. Later we should add a new option --trace-liveness, which
preserves every variable until the end of the clause for use by
the trace debugger.
compiler/handle_options.m:
Handle the option implications of --procid-stack-layout.
compiler/stack_layout.m:
Include the encoded determinism instead of the code model in stack
layout tables.
Include variable names in the live data section of stack layout tables
if they are available.
Include procedure identification information in the stack layout tables
if --procid-stack-layout is set.
compiler/trace.m:
Use the new interface to MR_trace.
compiler/*.m:
Trivial changes following from the renaming of --alternate-liveness.
runtime/mercury_accurate_gc.h:
Add macros to decode encoded determinisms.
Define structs for accessing the stack layout tables.
runtime/mercury_regs.h:
Define a macro similar to virtual_reg, except in that it can refer
to an arbitrary memory area, not just fake_reg.
runtime/{mercury_string,mercury_types}.h:
Move the typedefs of Char, UnsignedChar, String and ConstString
from mercury_string.h to mercury_types.h to avoid problems with
circular #includes.
runtime/mercury_trace.[ch]:
Revise the interface to MR_trace so that it takes the layout table
of the procedure as an argument. From the layout table, we can get
to the module name, predicate name, arity, mode number, and
determinism of the procedure, so we don't need to pass these any more,
reducing parameter passing overhead. We can also get to information
about where the input and output arguments are. We now use this
information to allow the user to print out the value of the arguments
at the CALL and EXIT ports.
Change the prompt to a less intrusive "mtrace> ".
runtime/mercury_wrapper.[ch]:
Add a new global variable, MR_library_trace_browser. We reserve space
for this variable in mercury_wrapper.c. It will be initialized by the
automatically generated xxx_init.c file to point to the procedure
that the tracer will invoke to let the user browse the values of
variables. This mechanism allows the runtime to maintain its current
ignorance about the contents of the standard library.
util/mkinit.c:
Generate additional code in the xxx_init.c files to fill in the value
of MR_library_trace_browser.
tests/misc_tests/debugger_test.{inp,exp}:
Add a few printing commands into the input for this test case, and
update the expected output.
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
NEWS
Document the ODBC interface.
runtime/engine.h
runtime/engine.mod
Add wrappers around longjmp and setjmp which save and restore
some state in engine.c and the Mercury registers.
runtime/mercury_trail.h
Add a macro MR_IF_USE_TRAIL which evaluates to its argument
if MR_USE_TRAIL is defined, or to nothing otherwise.
runtime/mercury_string.h
Add a macro make_aligned_string_copy to copy a C string
onto the Mercury heap.
runtime/misc.c
Avoid a seg-fault when printing out info about the nondet stack
in a debug grade.
extras/odbc/Mmakefile
extras/odbc/odbc.m
The interface.
extras/odbc/odbc_test.m
A simple test.
support them because NU-Prolog couldn't support them.)
This required two main changes:
(a) eliminating places where we explicitly assumed that character codes
ranged from 1 to 127.
(b) making sure that all conversions from `Char' to `Integer' are done
by first explicitly casting to `UnsignedChar'. This is necessary
to avoid potential problems on C compilers for which `char' is signed.
library/char.m:
library/char.nu.nl:
Replace the implementation of char__to_int as a big table
with an implementation using pragma c_code, so that it doesn't
assume that character codes range from 1 to 127.
Move the old implementation into a new file char.nu.nl,
since it's still needed for Prolog support.
Add new predicates char__min_char_value/1 and char__max_char_value/1.
library/Mmakefile:
Add char.nu.nl to the list of files needed for Prolog support.
library/lexer.m:
Rewrite io__get_token_[12] in the original (less efficient) way
that they were written before conway's change in revision 1.17,
to avoid assuming anything about the range of character codes.
(Once this change has bootstrapped, it might be worth going back
to the efficient version, modified of course to assume that
character codes range from 0..255 rather than 1..127.
However, at least for bootstrapping we need to use the less
efficient version.)
runtime/mercury_string.h:
Add `UnsignedChar' typedef.
library/string.m:
In string__to_int_list, make sure that the conversion from
`Char' to `Integer' is done by first explicitly casting to
`UnsignedChar'.
Also a few other minor fixes:
- remove an old XXX by using make_aligned_string()
- use `size_t' rather than `Word' for a string length;
- add a missing `const'
- remove an unnecessary cast to (char)
- change a `while (--p >= Str) { ...' to
`while (p > Str) { p--; ...', because pointing to
one before the start of an array is not strictly
ANSI-conformant.
compiler/switch_detection.m:
compiler/dense_switch.m:
Use char__min_char_value and char__max_char_value to avoid
assuming 7-bit chars. (We still don't get cross-compilation
between platforms with different size characters right yet,
but that's not a major issue right now.)
compiler/export.m:
Make sure that conversions from `Char' to `Word'
are done by first explicitly casting to `UnsignedChar'.
NEWS:
Mention that we now support 8-bit characters.
Mention the new predicates char__min_char_value/1 and
char__max_char_value/1, as well as int__int_min, int__int_max,
int__bits_per_int (which were added previously, with different
names, but not mentioned in the NEWS file).
Also make minor cleanups to a few of the other messages.
Estimated hours taken: 1
Some improvements to const-correctness in the string handling code.
runtime/mercury_string.h:
Change make_aligned_string() so that the first (target)
argument is of type `ConstString' (const char *)
rather than of type `String' (char *), since it should
be const, because it can point to a string literal.
Also improve the documentation.
library/std_util.m:
Change the code so that it matches the new definition
of make_aligned_string.
Also make the `functor' field of expand_info a `ConstString'
rather than a `String', since it can point to a string literal.
library/io.m:
Change a call to make_aligned_string so that it matches the new
definition.
Estimated hours taken: 6
A general cleanup of the code in the runtime directory, aimed at
formulating a more coherent header file inclusion policy. This change
fixes a couple of bugs that prevented the runtime from compiling in
certain configurations (e.g. on muse) due to missing #includes, and
also fixes a few minor unrelated things such as the use of `size_t'
instead of `unsigned'.
Our header file inclusion policy is that every header file should
#include any other header files needed by the declarations or by the
macros it defines. Cyclic interface dependencies, where two header
files each #include the other, must be avoided (by splitting up header
files into smaller indepdent units, if necessary).
At some stage in the future we should rename all the header files to
`mercury_*.h', to avoid any possible name clashes with system or user
header files.
runtime/Mmake:
Add a new target `check_headers' to check that each
header file is syntactically valid in isolation.
runtime/imp.h:
runtime/mercury_float.h:
runtime/mercury_string.h:
runtime/mercury_types.h:
runtime/calls.h:
Move the code in "imp.h" into new header files.
"imp.h" now contains nothing but #includes.
runtime/conf.h.in:
runtime/*.h:
runtime/{label,prof,prof_mem}.c:
runtime/*.mod:
Update the #includes to reflect the new header file structure.
Add some missing header guards. Add some comments.
Put the correct years in most of the copyright notices.
runtime/heap.h:
Fix a bug: add #include "context.h", needed for
min_heap_reclamation_point.
runtime/context.h:
Fix a bug: add #include "memory.h", needed for MemoryZone.
Move the general description comment to the top of the file.
Fix the indentation of some comments. Add a couple of new comments.
runtime/context.mod:
Delete a couple of unnecessary declarations.
runtime/wrapper.mod:
Change the type used for memory sizes from `unsigned' to `size_t'.
Change the `-p' (primary cache size) option so that it is always
a size in kilobytes, rather than being schitzophrenic about
whether it is bytes or kilobytes.
runtime/regorder_base.h:
Removed, since it not used (and constitutes a
double-maintenance problem).