runtime/machdeps/aarch64_regs.h:
runtime/mercury_regs.h:
Define global registers for aarch64.
configure.ac:
Compile with -fomit-frame-pointer on aarch64. (Doing so frees
up register x29.)
Compile with -fPIC instead of -fpic on aarch64-*-linux* systems
in order to avoid size limits on the global offset table.
Discussion of these changes can be found on the Mercury developers
mailing list archives from June 2018.
COPYING.LIB:
Add a special linking exception to the LGPL.
*:
Update references to COPYING.LIB.
Clean up some minor errors that have accumulated in copyright
messages.
For picreg, this is only the first half of the change; it deletes code
that generates references to this grade component. When this diff has been
installed on all our machines, will come the second half, which will delete
the code that understands references to picreg. The delay is needed because
your current installed compiler is still generating such references.
runtime/mercury_grade.h:
Remove both regparm and picreg as grade components.
doc/user_guide.texi:
Remove the (commented out) documentation of picreg; regparm had
no documentation to delete.
runtime/mercury_std.h:
Remove the small bit of code that implemented regparm.
runtime/mercury_conf_param.h:
Don't define MR_PIC_REG.
runtime/machdeps/i386_regs.h:
runtime/mercury_conf_bootstrap.h:
Remove references to picreg.
scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/mgnuc.in:
scripts/parse_grade_options.sh-subr:
Keep in place the code that accepts picreg grade components,
but make them do nothing. Mark such do-nothing code so that
it can be deleted when this first-half diff has been bootstrapped.
configure.ac:
Delete the autoconfigured variable EXT_FOR_LINK_WITH_PIC_OBJECTS,
which could be set to either 'lpic_o' or just 'o', because it is now
*always* the latter.
scripts/Mercury.config.bootstrap.in:
scripts/Mercury.config.in:
Remove code that transmitted the value of EXT_FOR_LINK_WITH_PIC_OBJECTS
to the compiler via the --link-with-pic-object-file-extension option.
compiler/options.m:
Keep the --link-with-pic-object-file-extension and --pic-reg options,
but mark them for deletion in the second half of this change.
compiler/compile_target_code.m:
Change the code that dealt with the value of the
--link-with-pic-object-file-extension and --pic-reg options to assume
that the former is always the same as the non-pic file extension,
and that --pic-reg is never needed. The former means that we don't need
to handle link_with_pic as a separate category of object files from
just plain non_pic.
compiler/compute_grade.m:
Keep accepting picreg grades, but mark the code that does this
for deletion.
compiler/make.program_target.m:
compiler/make.module_target.m:
compiler/make.program_target.m:
compiler/make.util.m:
Conform to the changes above.
Estimated hours taken: 1
Branches: main
As discussed on mercury-developers, reduce the number of registers that
are reserved for use as gcc global register variables on x86 machines
for non-PIC Mercury code from three to two.
This change should reduce the frequency of register allocation problems
occurring with gcc on x86 machines, at the cost of increasing execution
time for non-PIC by about 2.2%. (That figure is based on our standard
benchmark.)
runtime/machdeps/i386_regs.h:
Do not reserve an extra register for use as a global register
variable for non-PIC on x86.
configure.in:
Conform to the new number of global register variables.
Define EXT_FOR_LINK_WITH_PIC_OBJECTS as .o rather than .lpic_o
on x86. (The latter should only be used when MR_PIC_REG has
some meaning.)
compiler/compile_target_code.m:
Update a comment: MR_PIC_REG no longer has an effect on x86
machines.
Estimated hours taken: 4.5
Branches: main, release
Add support for shared libraries on x86-64 Linux.
configure.in:
Enable for support for shared libraries on x86-64 Linux ELF
systems.
runtime/machdeps/x86_64_regs.h:
Add an explanation of a problem with our use of r15 as a global
register and PIC with the medium and large code models. (We
don't encounter this problem because we currently use the small
code model.)
Fix the comments attached to the register variable declarations.
We do not have three different versions of succip.
runtime/mercury_goto.h:
Add x86_64 specific hacks.
scripts/mgnuc.in:
Conform to the above changes.
Estimated hours taken: 0.5 by me (+ unknown by Sergey Khorev)
Branches: main, release
Commit Sergey Khorev's patch to port Mercury to the ARM architecture.
configure.in:
runtime/mercury_regs.h:
runtime/machdeps/arm_regs.h:
Global registers for ARM.
runtime/Mmakefile:
Add arm_regs.h to the list of machine dependent headers.
runtime/machdeps/ARM_REGS:
Add documentation from the gcc source code on what registers
can be used.
runtime/machdeps/arm_regtest:
Test what registers we can use on ARM.
Estimated hours taken: 0.1 (+ unknown time by hawkinsp)
Branches: main
Commit Peter Hawkins' patch for global registers on x86_64.
(The actual registers we use may need some finessing but we can
do that later when we have more experience with this architecture.)
runtime/mercury_regs.h:
runtime/machdeps/x86_64_regs.h:
Global registers for x86_64.
runtime/Mmakefile:
Add x86_64_regs.h to the list of machine dependent
headers.
runtime/machdeps/README:
Mention that the above Mmakefile needs to be updated
when adding a new architecture.
Estimated hours taken: 0.25 (plus phawkins work)
Add contributions from Peter Hawkins to support hppa, ia64 and s390
architectures.
config.guess:
config.sub:
Upgrade to newer versions.
configure.in:
Update to support the hppa64, ia64 and s390 architectures.
runtime/mercury_regs.h:
runtime/machdeps/ia64_regs.h:
Add support for ia64.
Estimated hours taken: 2
Branches: main
Ensure that in MLDS grades, arguments with arg_mode `top_unused' do not
get passed.
Previously, different parts of the compiler had different and inconsistent
ideas about if/how they should get passed, which caused problems,
including an internal error for tests/hard_coded/foreign_type2.m in grade
`java'. The comments in mlds.m said they should not get passed, the
code in ml_call_gen.m passed them as if they were output arguments, and
the code in ml_code_util declared them as if they were input arguments.
compiler/hlds_pred.m:
Add some detailed comments about the meaning of the `arg_mode' type.
compiler/ml_call_gen.m:
compiler/ml_code_util.m:
compiler/ml_code_gen.m:
Ensure that arguments with arg_mode `unused' do not get passed,
declared, or converted (respectively).
runtime/mercury_grade.h:
Bump the binary compatibility version number for MLDS grades.
This is needed because the calling convention for procedures
with `unused' mode arguments has changed.
Estimated hours taken: 0.25
Branches: main
Fix the setting of NUM_REAL_R_REGS for PowerPC.
(This should hopefully improve performance on Macs a little.)
configure.in:
Treat powerpc-* the same as rs6000-* with regard to registers.
This is needed because powerpc is just a variant of rs6000.
runtime/machdeps/rs6000_regs.h:
Mention that this file is used for PowerPC, as well as for RS/6000.
Estimated hours taken: 4
Branches: main
Add MR_ prefixes to the remaining non-prefixed symbols.
This change will require all workspaces to be updated
The compiler will start generating references to MR_TRUE,
MR_bool, etc., which are not defined in the old runtime
header files.
runtime/mercury_std.h:
Add MR_ prefixes to bool, TRUE, FALSE, max, min,
streq, strdiff, strtest, strntest, strneq, strndiff,
strntest, NO_RETURN.
Delete a commented out definition of `reg'.
runtime/mercury_tags.h:
Add an MR_ prefix to TAGBITS.
configure.in:
runtime/mercury_goto.h:
runtime/machdeps/i386_regs.h/mercury_goto.h:
Add an MR_ prefix to PIC.
runtime/mercury_conf_param.h:
Allow non-prefixed PIC and HIGHTAGS to be defined on
the command line.
runtime/mercury_bootstrap.h:
Add backwards compatibility definitions.
RESERVED_MACRO_NAMES:
Remove the renamed macros.
compiler/export.m:
compiler/ml_code_gen.m:
Use MR_bool rather than MR_Bool (MR_Bool is
meant to be for references to the Mercury type
bool__bool).
runtime/mercury_types.h:
Add a comment the MR_Bool is for references to
bool__bool.
*/*.c:
*/*.h:
*/*.m:
Add MR_ prefixes.
Estimated hours taken: 2.5
Branches: main
Add MR_ prefixes to uses of configuration macros.
Bootcheck now succeeds with MR_NO_CONF_BACKWARDS_COMPAT.
Mmake.common.in:
Define MR_NO_CONF_BACKWARDS_COMPAT when checking
for namespace cleanliness.
RESERVED_MACRO_NAMES:
Remove the configuration macros.
runtime/mercury_conf_bootstrap.h:
Remove a duplicate definition of BOXED_FLOAT.
configure.in:
*/*.c:
*/*.h:
*/*.m:
Add MR_ prefixes.
Estimated hours taken: 16
Add some Mmake rules to the runtime and some code to tools/bootcheck
so that we automatically check that the namespace remains clean.
Also add some `MR_' prefixes that Zoltan missed in his earlier change.
tools/bootcheck:
Add an option, which is enabled by default, to
build the check_namespace target in the runtime.
runtime/RESERVED_MACRO_NAMES:
New file. Contains a list of the macros names that
don't start with `MR_' or the like.
runtime/Mmakefile:
Change the rule for `check_headers' so that it checks for macros
that don't occur in the RESERVED_MACRO_NAMES files, as well as not
starting with `MR_' prefixes, and reports errors for such macros.
Also add a rule for check_objs that checks whether the object
files define any global symbols that don't have the right prefixes,
and a rule `check_namespace' that does both of the above.
runtime/mercury_bootstrap.h:
#include "mercury_types.h" and "mercury_float.h",
to ensure that this header file is self-contained.
Also make sure that all the old names are disabled if you
compile with `-DMR_NO_BACKWARDS_COMPAT'.
runtime/mercury_context.c:
runtime/mercury_thread.h:
runtime/mercury_thread.c:
Use `bool' rather than `MR_Bool' for the argument to
MR_check_pending_contexts() and the return type of
MR_init_thread(), since these are C bools, not Mercury
bools, and there's no requirement that they have the
same size as MR_Integer.
runtime/mercury_type_info.h:
runtime/mercury_deep_copy_body.h:
runtime/mercury_tabling.c:
library/std_util.m:
trace/mercury_trace_declarative.c:
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
tests/hard_coded/existential_types_test.m:
Add MR_ prefixes to UNIV_OFFSET_FOR_TYPEINFO and UNIV_OFFSET_FOR_VALUE.
trace/mercury_trace_external.c:
trace/mercury_trace_internal.c:
trace/mercury_trace_tables.c:
Add MR_ prefixes to do_init_modules().
runtime/mercury_tabling.h:
runtime/mercury_tabling.c:
runtime/mercury_overflow.h:
runtime/mercury_debug.h:
Add MR_ prefixes to table_*.
runtime/mercury_overflow.h:
runtime/mercury_debug.h:
Add MR_ prefixes to IF().
runtime/mercury_context.h:
Add MR_ prefixes to IF_MR_THREAD_SAFE().
runtime/mercury_engine.h:
Add MR_ prefixes to IF_NOT_CONSERVATIVE_GC().
runtime/mercury_engine.h:
runtime/mercury_engine.c:
library/exception.m:
extras/aditi/aditi.m:
Add MR_ prefixs to do_fail, do_redo, do_not_reached, etc.
compiler/trace.m:
compiler/fact_table.m:
compiler/llds_out.m:
Add MR_ prefixes to the generated code.
Estimated hours taken: 10
Make everything in the runtime use MR_ prefixes, and make the compiler
bootstrap with -DMR_NO_BACKWARDS_COMPAT.
runtime/mercury_*.[ch]
Add MR_ prefixes to all functions, global variables and almost all
macros that could pollute the namespace. The (intentional) exceptions
are
1. some function, variable, type and label names that already start
with MR_, mercury_, Mercury or _entry;
2. some standard C macros in mercury_std.h;
3. the macros used in autoconfiguration (since they are used in scripts
as well as the runtime, the MR_ prefix may not be appropriate for
those).
In some cases, I deleted things instead of adding prefixes
if the "things" were obsolete and not user visible.
runtime/mercury_bootstrap.h:
Provide MR_-less forms of the macros for bootstrapping and for
backward compatibility for user code.
runtime/mercury_debug.[ch]:
Add a FILE * parameter to a function that needs it.
compiler/code_info.m:
compiler/export.m:
compiler/fact_table.m:
compiler/llds.m:
compiler/llds_out.m:
compiler/pragma_c_gen.m:
compiler/trace.m:
Add MR_ prefixes to the C code generated by the compiler.
library/*.m:
Add MR_ prefixes to handwritten code.
trace/mercury_trace_*.c:
util/mkinit.c:
Add MR_ prefixes as necessary.
extras/concurrency/semaphore.m:
Add MR_ prefixes as necessary.
Estimated hours taken: 4
Add MR_ prefixes to the types used when generating C code.
This means types such as Word, String, Bool, Float become MR_Word,
MR_String, MR_Bool, MR_Float. Also define MR_Box for both the LLDS and
MLDS backends so we can use it uniformly.
This is very important in environments where String or Bool have already
been used as system types (for example, managed C++). And besides, we
should do it anyway as part of the grand namespace cleanup.
I have fixed all of the uses of the non-prefixed types in the runtime
and trace directories. I haven't done it for the library and compiler
directories yet (no promises that I will do it in future either). But
if you see a non-prefixed type in code from now on, please consider it a
bug and fix it.
mercury_bootstrap.h contains #defines to map the non-prefixed types into
the prefixed ones. Like many of the other namespace cleaning backwards
compatibility macros, this can be turned off with
MR_NO_BACKWARDS_COMPAT.
This shouldn't break any code, but this kind of change affects so many
things that of course there could be problems lurking in there somewhere.
If you start getting errors from the C compiler after this change is
installed, you will want to make sure you at least have the runtime
system updated so that you are getting the backwards compatibility
definitions in mercury_bootstrap.h. Then if you continue to have
problems you can bug me about it.
compiler/export.m:
compiler/llds_out.m:
compiler/mlds_to_c.m:
Use MR_Word, MR_Float, MR_Bool, etc when generating C.
doc/reference_manual.texi:
Update the reference manual to talk about MR_Word, MR_String,
MR_Char, etc.
runtime/mercury_bootstrap.h:
Add bootstrapping typedefs.
runtime/*:
trace/*:
Change Word, Float, Bool, Code, String, etc to
MR_Word, MR_Float, MR_Bool, MR_Code, MR_String.
Estimated hours taken: 1
runtime/machdeps/regtest.c:
runtime/machdeps/regtest2.c:
runtime/machdeps/doregtest:
Add some more tests.
runtime/machdeps/SPARC_REGS:
Update the commentary here to reflect more a recent version
of GNU C.
Estimated hours taken: 90
An initial implementation of the accurate garbage collector.
WORK_IN_PROGRESS:
Add an entry for the accurate garbage collector.
library/builtin.m:
library/mercury_builtin.m:
library/std_util.m:
runtime/mercury_tabling.h:
Deep copy terms using the address of the value instead of
just the value.
library/io.m:
Initialize the garbage collector's rootset with the globals.
runtime/Mmakefile:
Add new files to the Mmakefile.
runtime/mercury_accurate_gc.h:
runtime/mercury_accurate_gc.c:
The new garbage collector.
runtime/mercury_agc_debug.c:
runtime/mercury_agc_debug.h:
Debugging utilities for the new garbage collector.
runtime/mercury_deep_copy.c:
runtime/mercury_deep_copy.h:
runtime/mercury_deep_copy_body.h:
Put the deep copy code in mercury_deep_copy_body.h, and #include
it with appropriate #defines in order to get a variant for
deep_copy(), and one for agc_deep_copy().
agc_deep_copy() forwards pointers as it copies.
Also, deep_copy (all variants) have been modified to take
a pointer to the data to be copied, because some variants
need to be able to modify it.
runtime/mercury_engine.c:
runtime/mercury_engine.h:
Add a second heap_zone which is the to-space of
the copying collector.
Add a debug_heap_zone, which is used as a scratch
heap for debugging.
runtime/mercury_label.c:
Instead of
realloc(entry_table, ....)
do
entry_table = realloc(entry_table, ....)
to avoid horrible bugs.
Also, make sure the tables get initialized before looking up
an entry label.
runtime/mercury_imp.h:
Include mercury_debug.h before most of the modules.
(mercury_engine.h adds a new MemoryZone only if we are
debugging accurate GC).
runtime/mercury_memory.c:
Setup the debug_memory_zone sizes.
Remove an unnecessary prototype.
runtime/mercury_memory_handlers.c:
Add code to get the program counter and the stack pointer
from the signal context.
Call MR_schedule_agc() from default_handler() if doing accurate gc.
runtime/mercury_memory_zones.c:
Setup the hardzone regardless of whether redzones are used.
Add some more debugging information.
runtime/mercury_regorder.h:
runtime/machdeps/alpha_regs.h:
runtime/machdeps/i386_regs.h:
Add definitions to make the real machine registers name/number
for MR_sp available.
runtime/mercury_trace_internal.c:
runtime/mercury_trace_util.c:
runtime/mercury_trace_util.h:
Add MR_trace_write_variable(), which writes terms given their
value and type_info.
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
Change the size of the heap redzone when doing accurate GC.
Use a small heap when debugging agc.
runtime/mercury_debug.h:
runtime/mercury_conf_param.h:
Add new debugging macros and document them.
runtime/mercury_type_info.c:
Add const to the pointer arguments of MR_make_type_info.
configure.in:
Add a test to find the number of words needed to represent a
synchronization term.
boehm_gc/gc.h:
fix a declaration by replacing the args () with (void).
boehm_gc/solaris_pthreads.c:
add a missing include
check the return values of pthread calls.
compiler/*.m:
Add handling for the new HLDS goal type par_conj.
Add handling for the four new LLDS instructions:
init_sync_term
fork
join_and_terminate
join_and_continue
compiler/code_info.m:
add a new alternative for slot_contents - sync_term.
compiler/handle_options.m:
add .par as part of the grade
compiler/hlds_goal.m:
add the new goal type par_conj.
compiler/instmap.m:
add instmap__unify which takes a list of instmaps
and abstractly unifies them.
add unify_instmap_delta which tajes two instmap deltas
and abstractly unifies them.
compiler/llds.m:
add the new llds instructions.
compiler/mode_info.m:
add par_conj as a lock reason.
library/Makefile:
work around a bug in the solaris version pthread.h
library/benchmarking.m:
reference the stack zones from the engine structure
rather than from global variables.
library/{nc,sp}_builtin.nl:
add an op declaration for &.
library/std_util.m:
change references to global variables to references inside
the engine structure.
runtime/Mmakefile:
add mercury_thread.{c,h}
add THREADLIBS to the libraries
runtime/*.{c,h}
Remove some old junk from the previous processes/shrd-mem
changes that found their way into the repository.
Add MR_ prefixes to lots of names.
runtime/mercury_context.c:
Add init_thread_stuff for creating and initializing a
context structure for the current thread.
runtime/mercury_context.h:
add a field to the mercury context which stores the thread id
of the thread where this context originated.
add various macros for implementing the new llds instructions.
runtime/mercury_engine.c:
initialize the engine structure, rather than a bunch of globals.
runtime/mercury_engine.h:
declare the mercury_engine structure.
runtime/mercury_regorder.h:
if MR_THREAD_SAFE, and there is at least one global register
then use mr0 as a pointer to the mercury engine structure.
scripts/init_grade_options.sh-subr
add thread_safe
scripts/mgnuc.in
add THREAD_OPTS
scripts/ml.in:
add THREAD_LIBS
runtime/mercury_regs.h:
Change `#if defined(_POWER)' to
`#if defined(_POWER) || defined(__powerpc)',
since gcc on Linux/PPC does not defined `_POWER'.
runtime/machdeps/rs6000_regs.h:
Fix a typo that broke the PPC port:
`restore_transient_reg_from_mem' should have been
`restore_transient_regs_from_mem'.
^
README.Linux-PPC:
Update to reflect recent developments: with egcs,
we now support global register variables.
Estimated hours taken: 0.25
Fix a bug reported by Bas De Becker <basde.bakker@pica.nl>.
runtime/machdeps/regtest.c:
Move #include statements after the global register variable
declaration, to avoid problems on systems which define
inline functions in the system header files.
Estimated hours taken: 0.75
runtime/machdeps/m68k.h:
Add declarations for global register for the 68000 architecture.
This code has not been tested, due to lack of a machine to test it on.
Hence I have not enabled it -- I have not added code to
runtime/regs.h to conditionally #include this header file.
The reason for adding this code now is just to make it easier
for whoever eventually does the 68k port.
Estimated hours taken: 0.5
Improve the support for shared libraries on Linux ELF.
runtime/mach_deps/i386_regs.h:
If `PIC_REG' is defined, don't use %ebx,
even if we're not compiling in PIC.
README.Linux:
Update the documentation: when using shared libraries, it's more
efficient to compile your main program with just `-DPIC_REG'
rather than `-fpic'; `-DPIC_REG' is enough to make it work,
and doesn't slow it down as much as `-fpic' does.
Estimated hours taken: 8
One of a number of changes to add support for ELF shared libraries on Linux.
runtime/machdeps/i386_regs.h:
If compiling with -fpic, register `ebx' is reserved for use by
gcc, so we can't use it.
Estimated hours taken: 5
Fix a bug in the C->Mercury interface: the Mercury code was using the
callee-save registers (as global register variables) and not restoring
them before returning to the C code.
runtime/machdeps/*.h:
Replace the macros
save_registers(),
restore_registers(),
save_transient_registers(), and
restore_transient_registers()
which were hard-coded to save/restore from `fake_reg',
with new ones called
save_regs_to_mem(save_area),
restore_regs_from_mem(save_area),
save_transient_regs_to_mem(save_area), and
restore_transient_regs_from_mem(save_area)
that take a `save_area' parameter indicating which memory
buffer to use.
Estimated hours taken: 0.25
runtime/machdeps/README:
New file, containing some general documentation about
how to define the registers for a new architecture.
Estimated hours taken: 0.1
When compiling on the SPARC in a grade that wants global registers but not
nonlocal gotos (i.e. reg and reg.*), give an error instead of silently
ignoring the request for global registers.
Estimated hours taken: 0.75
runtime/machdeps/alpha_regs.h:
Use register $15 as a seventh global register.
This should improve performance slightly, but
the main reason for the change is that it may
avoid some problems with $15 being clobbered
due to cross-function jumps skipping the save
and restore of it in the function prologue/epilogue.
Estimated hours taken: 0.25
(Plus about 6-12 hours debugging via email, over the course of
a week, to find the problem.)
A fix for global register variables on the RS/6000.
runtime/machdeps/rs6000_regs.h:
Work around a bug in gcc for the rs6000: gcc 2.7.2 sometimes
saves/restores global register variables in function
prologue/epilogues, which causes havoc, and goes against what
the gcc documentation says. In particular, it save and restores
all the registers from the lowest-numbered call-saved register
used through to r31. The work-around is to use only the
lowest-numbered call-saved registers for global register variables.
(This fix is as yet untested.)
Estimated hours taken: 0.5
runtime/machdeps/generic_regtest:
Add script for testing which gcc global registers can be used.
This script uses register numbers (0-100) rather than names,
so it will work on any machine.
Estimated hours taken: 0.5
Fix problem on Linux where global register declarations occur after
inline function definitions in system header files.
machdeps/*.h:
Use `register' rather than `reg' to avoid dependency on "std.h".