Estimated hours taken: 0.1
runtime/imp.h:
Fix a problem with the definition of float_to_word and word_to_float
for the case of USE_SINGLE_PREC_FLOAT; gcc didn't like the cast
from Integer to union FloatWord - it wanted a cast from Integer
to Word first.
Estimated hours taken: 24
Add inline assembler hacks for restoring the $gp register on the alpha,
to make the `asm_fast.gc' grade work on the alpha.
runtime/goto.h:
For the alpha, change the GOTO macro so that it sets up
register $27 (the "procedure value" register) to contain the
address to which you are going to jump, and change the
Define_{entry,local,static} macros so that they have a `ldgp'
instruction after the label which restores the gp register from
$27.
runtime/call.mod:
For the alpha, change the call macro so that it uses a `ldgp'
instruction to restore the gp register on return from a call.
Add new call_localret macro, for the case when the continuation
label is a local label (this is like the inverse of the localcall
macro), because a call_localret is two instructions cheaper
than the equivalent call would be.
runtime/engine.mod:
In call_engine(), we need to use `Define_label(engine_done)'
rather than just `engine_done:', so that it works on the alpha.
These changes improve the speed of the compiler by about 21%,
and cut executable size by about 24%.
There's still a fair bit of room for improving efficiency by
avoiding moves to $27 and `ldgp' instructions in situations
where they aren't needed.
Estimated hours taken: 0.25
Fix a problem noticed by Andreas Kuehlmann.
runtime/{imp.h,aux.c}:
Define hash_string() as a function in aux.c unconditionally,
even if we're not using gcc. This avoids trouble when linking
programs compiled with cc with a runtime library that was
compiled with gcc.
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
imp.h, prof.h:
Fix the byzantine inclusion relationship between prof.h and imp.h.
prof.c:
Fix the hashing function for code addresses so that it doesn't waste
three quarters of the hash table.
In each hash slot, use a binary search tree instead of an unordered
list of entries. This can be expected to handle high loads better,
which is necessary because the hash table size is not adaptive.
(Making it adaptive would be a better fix.)
Instead of turning signals off and on in the handler of profiling
signals, simply set a volatile variable to detect cases when two
profiling signals arrive too closely.
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.75
runtime/imp.h:
Fix a bug in the code for float_to_word() in non-gc grades:
the part which was supposed to ensure correct alignment
of floats allocated on the heap was not working correctly.
to inside pragma(c_code) declarations in the `library' directory sources.
runtime/{Mmake,{math,io}_rt.mod}:
Remove math_rt.mod and io_rt.mod, since the code has been moved
into `.m' files in the library directory.
runtime/main.mod:
Remove this file, since it wasn't used.
runtime/imp.h:
Add SUCCESS_INDICATOR as a macro for r1, for use by
pragma_c_code.
Also a few minor unrelated changes:
runtime/imp.h:
Avoid code duplication in hash_string macros.
runtime/tags.h:
Use sizeof(Word) rather than WORD_SIZE (in this old code, the
extra level of indirection only obfuscated things).
runtime/{aux.c,aux.h,prof.c}:
Add some more #ifdefs to avoid including debugging/profiling
code in the non-debugging/non-profiling version of the library.
Estimated hours taken: 0.5
Fix problem on Linux where global register declarations occur after
inline function definitions in system header files.
runtime/imp.h:
Make sure that "reg.h" is the first header file included.
Estimated hours taken: 0.25
runtime/imp.h:
Suppress a spurious warning about `cast from pointer to integer
of different size' when compiling in a non-gc grade on the alpha.
runtime/imp.h:
When not using conservative GC, ensure appropriate alignment of
floating point constants. Also fix a couple of missing
parentheses in the float_to_word macro.
runtime/imp.h:
Add #include of <string.h> for strcmp().
(This missing #include was not previously noted because gcc has
a builtin-declaration for strcmp() - it only caused a warning
when compiled with `-fno-builtin'.)
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.
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.
aux.c, label.c:
Changed format fields to use %ld in most cases of printing integers.
imp.h:
Added a new type Uinteger.
list.c:
This has been renamed dlist.c a long time ago.
conf.h.in:
Set up the type of Word at configuration time.
imp.h:
Changed definition of Word. Also gathered two of the three
definitions of hash_string into one place, defining a macro
for use by aux.c.
aux.c:
Use the macro in imp.h for the body of hash_string.
engine.mod:
Minor formatting change.
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.
checking for higher-order preds, though, so the compiler doesn't
diagnose errors correctly - if you use the wrong mode you will probably
just get a core dump.)
imp.h:
Add incr_hp_atomic macro, which for USE_CONSERVATIVE_GC
invokes GC_MALLOC_ATOMIC() rather than GC_MALLOC().
io.mod:
Use the new incr_hp_atomic() macro for allocating strings.
Add implementations of string__index/2, string__length/2,
and string__append/3.
Note - these changes sped up the compiler by nearly 40%!
CFLAGSFILE:
Added an option to turn time and call profiling on seperately.
imp.h:
Added macro 'update_prof_current_proc'. Also removed stack
implementation of time profiling.
engine.mod:
Added all the init and finish code for time profiling.
label.*:
Changed option from USE_PROFILING to PROFILE_CALLS
prof.*:
Added all the neccesary code to do time profiling.
imp.h:
Redefined the tailcall macro's to include the Caller address for
profiling, and to call the profile function.
*.mod:
Changed all the handwritten tailcall's to conform to the new tailcall.
Need to add makelocalentry macro so that I can save all the handwritten
label names and they can be looked up by mprof.
prof.*:
Added some more comment's.
.gdbinit:
Don't source .gdbinit.arch, since it seems to have suffered
software rot.
aux.c, std.h, imp.h, access.c, iface.mod, prof.c:
Make sure that all memory allocation goes through
newmem(), resizemem() and oldmem().
Fix those functions so that they work with conservative
garbage collection.
imp.h:
D'oh! Change the call to GC_MALLOC() so that it allocates
`count * sizeof(Word)' bytes rather than just `count' bytes.
(How could I make such a beginner's mistake?
I hate manual memory management.)
Cakefile :
Included prof.c and prof.h in the compile
CFLAGSFILE:
Added the USE_PROFILING flag.
engine.mod:
Added calls so that all the profiling info is dumped to a file
prof.*:
Added some comments.
imp.h:
Modified the call and localcall macros so that they save the
callee-caller address pair if USE_PROFILING defined.
*.mod:
Added the extra argument to all calls and local calls for the
handwritten mod files.
imp.h:
Define `Integer' to be a signed type the same size as `Word'.
imp.h, io.mod:
Replace incr_hp/1 macro with incr_hp/2.
list.c, std.h:
Various minor cleanups.
tags.h:
Replace all the casts to `unsigned' and `uint' with cases
to `Word'.