Estimated hours taken: 32
Branches: main
Move toward the proposed structures for representing type class information at
runtime by adding code for generating the structures corresponding to
base_typeclass_infos. The structures corresponding to typeclass_infos will
be added in a later change.
Register the new data structures in a table at runtime.
Add four new mdb developer commands for checking the contents of the new
type class table, as well as the contents of the existing type constructor
table: class_decl, type_ctor, all_class_decls and all_type_ctors.
compiler/rtti.m:
Add the data types required to represent the new runtime data
structures that will eventually replace base_typeclass_infos
inside the compiler.
Add the required function symbols to the data types representing both
the new RTTI data structures themselves and those representing
references to them.
Make the required changes to the predicates operating on the modified
data types, and add some required new predicates.
compiler/rtti_out.m:
Add code to write out the new data structures for the LLDS backend.
Make some changes in existing predicates to allow them to be used
in the new code.
compiler/layout_out.m:
Factor out some code that is now common with rtti_out.m.
compiler/type_class_info.m:
A new module to generate the new RTTI data structures.
compiler/backend_libs.m:
Include the new module.
compiler/options.m:
Add a new option, --new-type-class-rtti, to control whether we
invoke the top level predicate of type_class_info.m to generate
the new type class RTTI structures. We still generate and use
base_typeclass_infos regardless of the value of this option.
compiler/mercury_compile.m:
Invoke the code of the new module if --new-type-class-rtti is given.
compiler/opt_debug.m:
Add code to dump descriptions of the new rtti_ids.
compiler/mlds_to_gcc.m:
compiler/rtti_to_mlds.m:
Handle the new alternatives in the rtti data types, mostly by throwing
exceptions. The actual code should be written later by Fergus.
compiler/pseudo_type_info.m:
Module qualify the names of builtin types when generating
pseudo-typeinfos for them. This makes the naming scheme more regular.
compiler/base_typeclass_info.m:
compiler/notes/type_class_transformation.html:
Document the impending obsolescence of these files.
compiler/notes/work_in_progress.html:
List type class RTTI as work in progress.
library/list.m:
Add a utility predicate for use by compiler/rtti_out.m.
runtime/mercury_typeclass_info.h:
Make some changes in the C data types representing type class
information that I discovered to be necessary or advantageous
in the process of generating values of those types automatically.
Rename some types to make their names be better documentation.
Change some arrays of pointers to structures into arrays of structures,
where the structures at different array indexes are the same size.
Removing consts that rtti_out.m supplies automatically avoids
duplicate const errors from the C compiler.
Add #includes to make the file namespace clean.
Protect against multiple inclusion.
runtime/mercury_typeclass_info_example.c:
Remove this file. After the changes to mercury_typeclass_info.h, its
contents are no longer correct examples of the structures in
mercury_typeclass_info.h, and since the compiler can now generate
those structures automatically, hand-written examples no longer serve
any useful pupose.
runtime/mercury_types.h:
Add a new type, MR_CodePtr, for use in mercury_typeclass_info.h.
The compiler predicate tc_rtti_name_type wants single-word names
for types.
runtime/mercury_imp.h:
#include mercury_typeclass_info.h.
runtime/mercury_type_tables.[ch]:
Add functions to register and to look up type class declarations and
type class instances.
Add the functions and data structures required to look up all type
constructors and all type classes. The debugger uses these to support
the commands that let the programmer check the contents of these
tables.
Eventually, we should be able to use the type class tables to test
whether a vector of types is a member of a given type class.
runtime/mercury_wrapper.c:
runtime/mercury_type_info.[ch]:
Move the array of type_ctor_rep names from the mercury_wrapper module
to the mercury_type_info module, and make it always-defined and public;
the debugger also needs access to it now.
runtime/Mmakefile:
Add mercury_typeclass_info.h to the list of header files that other
files depend on.
trace/mercury_trace_internal.c:
Add four new mdb commands: class_decl, type_ctor, all_class_decls
and all_type_ctors.
Make some existing code follow our coding conventions.
doc/user_guide.texi:
doc/mdb_categories:
Document the four new mdb commands.
doc/reference_manual.texi:
Document (in a comment) the compiler's reliance on each type in an
instance declaration containing exactly one type constructor.
tests/debugger/class_decl.{m,inp,exp}:
A new test case to test the new mdb commands.
tests/debugger/Mmakefile:
tests/debugger/Mercury.options:
Add the new test case.
tests/debugger/completion.exp:
Expect the new commands to appear in the command name completion.
tests/debugger/mdb_command_test.inp:
Test the documentation of the new mdb commands.
Expect the new commands to appear in the command name completion.
Estimated hours taken: 0.5
Branches: main, release
compiler/notes/work_in_progress.html:
- Delete the entry for the native code back-end,
since that is mentioned in NEWS file;
instead, just mention the gcc_3_3 branch work.
- Provide a bit more information on a couple of the other entries.
Estimated hours taken: 0.5
Branches: main
Make the "work in progress" file appear on the web site.
compiler/notes/work_in_progress.html:
compiler/notes/Mmakefile:
Add a a htmlized version of WORK_IN_PROGRESS.
WORK_IN_PROGRESS:
Removed.
Mmakefile:
Generate WORK_IN_PROGRESS and TODO from the files
in compiler/notes.
w3/information/include/developer.inc:
Add the "work in progress" file to the developer documentation.