Estimated hours taken: 0.5
runtime/wrapper.mod:
In mercury_main(), use `exit(mercury_exit_status)' rather than
`return mercury_exit_status'. This avoids problems with
returning to code that was compiled without global register
variables without restoring the values of those registers.
(It might be better to actually save/restore the registers,
but this change was simpler.)
Estimated hours taken: 8
Added a new option, -L, for loading the label table at the start, and thus
being warned about duplicate labels then. (I thought this might be the
problem causing the segmentation violations described in Fergus's mail.)
Estimated hours taken: 0.5
wrapper.{h,mod}:
When reporting statistics, print the total time elapsed so far,
as well as the time elapsed since the last statistics.
memory.c:
When a stack or the heap overflows, print the value of the PC.
Estimated hours taken: 0.5
Add a global variable to hold the time recorded at the last call to
report_stats, and add code to initialize this variable by calling the
timer routine at startup,
Estimated hours taken: 1 summer studentship
This is the implementation of the constraint solver interface runtime stuff.
We maintain a stack of tickets, accessible via mercury_solver_sp.
runtime/aux.[ch]
Introduce a new memory allocation function, checked_malloc(). This is
similar to newmem(), except that it always uses malloc(), not
GC_malloc(), regardless of the grade. This is useful when allocating
memory for the ticket stack as the garbage collector needn't know
about the ticket stack - it never contains pointers into gc'ed memory.
runtime/imp.h
Include mercury_solver_backtrack.h if we are in an appropriate grade.
runtime/wrapper.mod
Initialise the ticket stack, call the solver initialisation macro.
runtime/mercury_solver_backtrack.h
Implement the ticket macros, and the solver initialisation macro. This
file is currently specific to the CLP(R) solver; to interface to a
different solver, only the macros etc. in this file need be altered.
Estimated hours taken: 1
library/io.m:
Moved the profiling initialisation code so that it sits around
the call to main/2(0). Thus the profiler will now begin all it's
profiles from main not from call_engine.
profiler/read.m:
The profiler now expects that it's address are written out in decimal.
read.m now assumes that an address is a decimal, but if it can't parse
it, it will then read it in as a hexadecimal. Thus the profiler will
still be able to read it's old files.
NB. A possible bug with this is that two numbers will get converted to
the same number if one is treated as hex and the other decimal.
profiler/.cvsignore:
Some more files to ignore.
runtime/{engine, wrapper}.mod:
Remove the profiling initialisation code.
runtime/imp.h:
Add a new call macro noprof_call() which doesn't record an arc
in the call graph for profiling ever. This is used to ignore some
of the initial system set-up calls.
runtime/prof.c:
Output integers instead of hexs for the addresses.
Estimated hours taken: 0.5
Fix things so that there are no circular dependencies amoungst the
libraries, so that shared libraries work better (e.g. they can
use QuickStart on Irix 5). The dependencies are linear again:
program -> library -> runtime -> boehm_gc. (This property was
broken by my recent changes which moved lots of stuff from the
Mercury runtime to pragma(c_code) in the Mercury library.)
rutime/init.h:
Change the set of address variables used for communication
between the main program, the Mercury library, and the Mercury
runtime. Remove address_of_io__init_state_2_0, since it is no
longer needed, and add address_of_mercury_init_io, since it is.
Rename entry_point as library_entry_point, and rename
address_of_main_2_0 as program_entry_point.
rutime/wrapper.mod:
Rename entry_point as library_entry_point, and add new `-m' option
to set program_entry_point. Add definitions of the address variables
(I had moved these defitions to ../library/io.m, but that created
a backwards dependency.)
runtime/{Mmake,io_rt.h,wrapper.mod,init.h}
Remove io_rt.h, since io_rt.mod was removed.
The declaration for mercury_init_io() in it has been moved to init.h.
init.h, wrapper.h:
Move declaration for do_init_modules() from init.h to wrapper.h.
wrapper.h:
Fix indentation.
init.h, io_rt.mod, wrapper.mod:
Make sure that there are no undefined external references
when building the shared libraries, so that we can use
`ld -no_unresolved' on Irix 5. This means the shared libraries
can be Quickstarted, which improves startup time.
The way it was done was by changing all calls to external
references to instead call indirectly via global variables.
c2init now generates a main() which initializes these
global variables and then calls mercury_main().
dlist.{c,h}:
Rename a function to avoid a naming clash with the C library.
init.h, wrapper.mod:
Replace the `default_entry' and `which' (which _what_?)
variables with a single variable `entry_point'.
Move the check for NULL to just before entry_point is used,
so that it comes after the call to do_init_modules().
XXX The `-w' (entry-point) option still doesn't work.
wrapper.mod, label.c:
Don't call do_init_entries() from do_init_modules();
instead, call it only if and when necessary.
runtime/goto.h:
Use an empty inline asm statement rather than an assignment
to a global volatile variable to stop gcc from optimizing
away labels which are only referenced via the inline asm
entry points. This is better, because empty inline asm
statements don't result in any object code, whereas assignments
to global volatile registers do.
wrapper.h, wrapper.mod:
Various stylistic improvements. Clean up some old junk and some
new junk, and fix a few misspellings. Rearrange a few things.
imp.h, engine.mod, io_rt.mod:
Reorder #include lines so that "regs.h" gets included
before any of the system header files (other than <stddef.h>).
This is necessary because on some systems, the system header files
contain inline functions, and the global register variable
declarations must precede these.
regs.h:
Add case for i386, since global register variables now work
on the 386 (the problem was just that we needed -fno-builtin).
label.c, wrapper.mod:
Add #include of <string.h> for strcmp().
(These missing #include were not previously noted because gcc has
a builtin-declaration for strcmp() - it only caused a warning
when I compiled with `-fno-builtin'.)
regorder.h:
Change the register allocation order so that `sp' gets
allocated first, since for the compiler, 36% of all Mercury
register references are to `sp'.
memory.c:
With `-dm', if we're using CONSERVATIVE_GC, don't output the
size etc. for the heap, since they will all be zero - the
heap gets allocated by the Boehm collector.
wrapper.mod:
Fix a bug: do_init_modules was getting called too late in the
processing of -w options. Of course, -w doesn't work for most
grades anyway anymore.
label.c, label.h, wrapper.mod:
Don't allocate space for the label table unless it is needed.
This reduces startup time, significantly improving performance
on the `hello world' benchmark:
before after
statically linked 0.25s 0.14s
dynamically linked 0.68s 0.58s
runtime/{engine.h,engine.mod,memory.c,wrapper.mod}:
Add a new option `-dt' for use with the modes that
don't use gcc non-local gotos. If this option is
enabled, the runtime system will use the slow driver
loop rather than the unrolled one, and if a seg fault
occurs it will print out the last 40 locations.
(This is most useful in combination with -DDEBUG_LABELS,
otherwise you'll just get hex addresses.)
runtime/aux.c:
Make oldmem() call GC_FREE() if CONSERVATIVE_GC is defined.
Improve the error messages from fatal_error().
runtime/{imp.h,label.c}
Use `Unsigned' rather than `Uinteger'.
runtime/dlist.c:
Fix incorrect comment.
runtime/memory.c:
Various portability fixes for the Alpha, mostly to do with
mixing integers and pointers of different sizes.
Also make sure we only use PC_INDEX if it is defined.
runtime/prof.c:
Another portability fix for the Alpha: use `sysconf(_SC_CLK_TCK)'
if `HZ' is not available.
Also a major clean-up:
Tidy up the code. Avoid memory leaks. Remember to close files.
Tidy up the error messages for when fopen() fails.
Check the return values from fclose().
(XXX still need to check return values of signal() and setitimer().)
runtime/regs.h:
Add alpha_regs.h.
runtime/Mmake:
Use a date-stamp to avoid attempting to remake conf.h all the time.
Pass --no-ansi to mgnuc, since there doesn't seem to be any
other reliable, portable way of getting the necessary definitions
from the system header files (sigh).
Invoke mgnuc as ../scripts/mgnuc.
runtime/{memory.c,wrapper.h,wrapper.mod}:
Use `unsigned' rather than `uint', since `uint' requires
<sys/types.h> and !defined(_POSIX_C_SOURCE), which would reduce
portability.
runtime/memory.c:
Some minor reorganizations to avoid the use of runtime/ext_signal.h.
runtime/ext_{signal,stdlib}.h:
Removed, since they is no longer needed.
wrapper.mod:
Ensure the loading of the label table if a -w entry_point option is
specified. Without the table, we cannot find the address of the entry
point.
wrapper.mod:
Add an option -a to print all solutions of main/2. This is strictly
for benchmarks. Also reordered the arms of the switch in process_args
to follow alphabetical order.
wrapper.mod:
Call do_init_modules if any of the profiling flags on. Need label info
for all types of profiling.
Executes code to begin time profiling if flag defined.
wrapper.mod:
Only return the first solution to main/2, rather than all solutions.
table.c:
Remove unnecessary assert(), since it caused a warning,
and since the condition it checks for is already checked
for in newmem().
CFLAGSFILE, PORTABILITY:
Minor changes.
wrapper.mod:
Call init_entries even if we are not populating the table at the
start. This avoids references to an unallocated table later in debug
mode.
Mmake:
Separated out the handwritten .c files from those generated from .mods.
Added a rule for invoking ctags.
engine.c:
Remove the label do_reset_framevar0_fail, an anachronism. Some
formatting changes.
io_rt.mod:
Flush stdout when processing error/1.
memory.c:
Print out the PC in the SIGBUS handler as well as the SIGSEGV handler.
Some formatting changes.
stacks.h:
Cast pointers to nondet frames to (Word *) before use. If they are
stored in e.g. detstackvars, their native type is just Word.
table.c:
Strengthened debugging capability. A check for whether the hash value
is within bounds is now turned on by default. Later we can turn it off
again.
wrapper.mod:
Changed initialization code to always allocate space for the label
table, even if init_modules does not need to be called. This avoids
a crash in some situations.
memory.c:
Now memory diagnostics are printed on stderr.
wrapper.mod, memory.c:
Convert whens to cases and ors to else ifs.
other files:
copyright notices.
wrapper.mod:
Add an option to disable garbage collection.
(It doesn't work perfectly, since we have already
allocated memory and done a couple of mini-garbage collections
before we even get to the option processing.)
label.c, label.h, wrapper.mod:
Don't allocate space for the label table unless and until we are
actually going to use it.
Add a new `-sl' option to specify the size of the label table.
scripts/mod2init.sh, runtime/{wrapper.mod,init.h}:
Due to a bug in the Solaris linker, we need to call the GC_INIT()
macro from some statically linked part of the code.
So I've modified mod2init to add an init_gc() function to the init
file, and I've modified wrapper.mod to call it.
Cakefile:
If the chmod fails, don't worry about it.
ext_signal.h:
Comment out most of the file if __sgi is defined.
It didn't seem to work on the sgi.
wrapper.mod:
Fix a serious bug with the -w option.
io.mod:
Change io__run/0 so that it works even if main/2 is nondet.
We need this (until we have implemented solutions/2) for the
benchmarks.
memory.c, wrapper.h, wrapper.mod:
Fix yet another serious modulus-on-signed-int bug.
This stopped things working if you used shared libraries,
since the address of fake_regs was negative, which confused
the init_memory() function.
Cakefile:
Don't include the default definition of main/2 in the library.
ext_stdlib.h:
Remove most of the stuff here, since it was causing problems
compiling on Irix.
ext_signal.h:
Remove definition of MINSIGSTKSZ.
io.mod:
Line numbers start from 1, not 0.
io.mod, wrapper.mod, wrapper.h:
Implement io__{set,get}_exit_status.
prof.h:
Add declaration of prof_current_proc.
examples/Mercury:
Add new grades asm_*.
wrapper.mod:
Add a new -h (help) option.
Change the behaviour of the -l option:
Exit after printing the labels
Don't use popen("sort -n"), since it's an unnecessary OS
dependency and the user can do it anyway.
[And because we weren't checking whether the call
succeeded, and I didn't want to add checking code...]
io.mod, init.h, wrapper.mod, label.c:
Remove support for automatically calling *_input.
Optimize things so that we only call init_modules() if we
are going to need the label names.