Estimated hours taken: 0.25
Fix a bug that broke grades `*.gc.prof.tr'.
(This change was previously applied to the Mmakefiles
in the runtime, library, compiler, and profiler directories,
but I missed the `bytecode' directory.)
bytecode/Mmakefile:
When deciding whether to link with -lgc or -lgc_prof,
match against `*.gc*.prof*' rather than `*.gc*.prof'.
^
Estimated hours taken: 0.1
bytecode/static_data.c:
bytecode/static_data.h:
This module is no longer necessary since I've put similar data
in the "machine" module.
Estimated hours taken: 0.1
bytecode/mdb.m:
Simple Mercury driver for the bytecode interpreter.
The driver allows us to initialise the Mercury runtime
engine and various modules in libmercury without having
to duplicate code from the runtime.
This really is overkill and it would make sense to rewrite
parts of the runtime so that initialisation and startup of
compiled Mercury code are not so tightly coupled. May revisit
this later.
Estimated hours taken: 0.1
bytecode/Mmakefile
- Removed "-static" from link line since we can't use
dlopen and so on with statically linked binaries.
- Added -DDEBUGGING as C compile flag. Turn it off when
the bytecode interpreter is working.
- Added "dict" module, a dictionary ADT.
Estimated hours taken: 0.1
bytecode/disasm.h:
bytecode/mem.h:
bytecode/util.h:
Added #includes for the headers that these headers depend upon.
I'm still not convinced of the wisdom of having #includes inside
headers. Tracking down the location of a declaration by using
preprocessed source files is bad enough when nested #include
is forbidden.
Estimated hours taken: 2
Added a dictionary abstract data type. Currently it's implemented as
a dirt-simple ordered list, but it should later be reimplemented using a
hash table. Note that C has only very poor support for ADTs
and private data must be included in the header. We trust clients
of the ADT not to use the private data.
bytecode/dict.h:
Interface of dictionary ADT.
bytecode/dict.c:
Implementation of dictionary ADT.
Estimated hours taken: 1
bytecode/Mmakefile:
Add new targets libmbi.{a,so}.
In profiling grades, link with -lgc_prof rather than -lgc.
bytecode/mbi.c:
Rename the main() function as BC_mbi_main().
bytecode/mbi_main.c:
New file, whose main() function just calls BC_mbi_main().
Estimated hours taken: 2
More cleanup of the bytecode stuff; in particular, add a `MB_' prefix
to most names.
bytecode/*:
- Prefix all names defined in header files with `MB_'
(except for `TRUE', `FALSE', `DEBUGGING', and `XXXdebug').
- Add macros `MB_new', `MB_new_array', and `MB_resize_array',
and use those instead of using `MB_malloc' and `MB_resize'
(formerly `mem_malloc' and `mem_resize') or malloc() and realloc()
directly. Uncomment the definition of MB_strdup() now that it
calls MB_malloc().
- Delete the definitions of `uchar', `uint', `ushort', `ulong'
(just spell them out, its clearer and more portable that way).
- Fix the indentation in a few places I missed on my previous pass.
- Add a `README' file.
Estimated hours taken: 2
A cleanup of the bytecode stuff.
bytecode/*:
Various changes to make it conform to our C coding standard.
In particular:
- fix indentation and layout, particularly of switch
statements;
- use `#include "..."' rather than `#include <...>'
for user-defined header files
bytecode/Mmakefile:
Avoid the use of `$^' in hard-coded rules, since it is
not portable to non-GNU makes (many makes only allow the
use of variables such as $*, $^, etc. in suffix rules),
and since it is easy to avoid.
Also add an XXX comment, since the header dependency handling
is done twice.
bytecode/bytecode.c:
s/BIG_ENDING/MR_BIG_ENDIAN/ and s/LITTLE_ENDING/MR_LITTLE_ENDIAN/,
to match my recent change to runtime/conf.h.in.
In fact every identifier in the bytecode directory ought to be
prefixed with `MB_', but I haven't done that in this change.
Estimated hours taken: 3
A number of changes:
- Changes to support portable numeric constants in the
bytecode file.
- read_int() now returns a Mercury `Integer', which is platform
dependent. However it actually reads a portable, 64-bit,
big-endian, 2's complement integer from the bytecode stream.
- read_float() now returns a Mercury `Float', which is platform
dependent.
- Comment-style changed to agree with C coding standard.
- malloc and realloc are now used instead of mem_malloc and
mem_realloc. Need to look at memory-management in a lot
more depth when the bytecode interpreter starts linking
in Mercury shared objects.
- Removed Bytecode-doc since it's now an HTML file in
the developer documentation directory of the Mercury web pages.
- Removed the Makefile since we're now using an Mmakefile.
bytecode/
bytecode.c
bytecode.h
Changes to read_int(), read_float() and others.
disasm.c
disasm.h
machine.c
machine.h
mbi.c
mbi.h
mdis.c
mdis.h
mem.c
mem.h
static_data.c
static_data.h
template.c
template.h
util.c
util.h
Divers changes as described above.
Bytecode-doc
Mmakefile
Removed as described above.
Estimated hours taken: 0.1
Small changes to Mmakefile.
bytecode/Mmakefile:
Now linking with libmer and libgc. Added $(MERCURY_DIR)/runtime
to link path.