Commit Graph

28 Commits

Author SHA1 Message Date
Peter Wang
388938ac1e Delete use of signal handlers taking sigcontext arguments.
The configure checks for sigcontext (aka sigcontext_struct) have failed
for a long time without anyone noticing. The MR_GET_FAULT_ADDR macro
that is also needed for the sigcontext code paths was only ever defined
for __i386__ and __mc68000__.

According to the sigaction(2) man page, the struct sigcontext
argument was obsoleted by the introduction of the SA_SIGINFO flag
(which we also have code for, though also not working either).

configure.ac:
    Delete checks related to struct sigcontext.

    Delete check for asm/sigcontext.h

runtime/mercury_conf.h.in:
    Delete macros that are no longer defined.

runtime/mercury_memory_handlers.c:
runtime/mercury_signal.c:
runtime/mercury_signal.h:
    Delete code for using signal handlers that take a sigcontext argument.

    Add XXX where native GC casts a context parameter to
    struct sigcontext * when it should be a ucontext_t *.
    Possibly never tested.

runtime/mercury_faultaddr.h:
    Delete this file containing only the MR_GET_FAULT_ADDR macro which is
    no longer used.

runtime/RESERVED_MACRO_NAMES:
ssdb/RESERVED_MACRO_NAMES:
trace/RESERVED_MACRO_NAMES:
    Delete macros that are no longer defined.

tools/configure_mingw_cross:
    Don't need to set variables mercury_cv_sigcontext_struct_2arg and
    mercury_cv_sigcontext_struct_3arg any more.
2020-10-13 13:32:32 +11:00
Peter Wang
3162997f14 Delete GNU getopt implementation.
runtime/GETOPT/getopt.c:
runtime/GETOPT/getopt.h:
runtime/GETOPT/getopt1.c:
runtime/mercury_getopt.c:
runtime/mercury_getopt.h:
runtime/mercury_getopt1.c:
    Delete files.

runtime/RESERVED_MACRO_NAMES:
    Delete __GNU_LIBRARY__ macro.
2019-06-10 13:30:43 +10:00
Zoltan Somogyi
ba57f4a5df Reorganize the way we handle reserved C macro names.
RESERVED_MACRO_NAMES:
*/RESERVED_MACRO_NAMES:
    Add a macro, _FORTIFY_SOURCE, that gcc defines by default on some recent
    versions of Linux.

    I could have added it in SIX separate RESERVED_MACRO_NAMES files.
    Instead, I moved the content common to all these files to a
    RESERVED_MACRO_NAMES file in the top directory, leaving the
    RESERVED_MACRO_NAMES files of the subdirectories containing only
    macros that *don't* occur in all those subdirectories.

tools/bootcheck:
   Copy the top-level RESERVED_MACRO_NAMES names to the stage 2 directory.

Mmake.common.in:
   Filter out the contents of the top level RESERVED_MACRO_NAMES file,
   as well as the RESERVED_MACRO_NAMES file in the current directory.
2014-01-22 08:55:58 +11:00
Julien Fischer
fc29b6c0b6 Update the list of reserved macro names.
browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
mdbcomp/RESERVED_MACRO_NAMES:
runtime/RESERVED_MACRO_NAMES:
ssdb/RESERVED_MACRO_NAMES:
trace/RESERVED_MACRO_NAMES:
	Ignore the __USE_MINGW_ANSI_STDIO macro which we
	need to define on MinGW64.

	Ignore the __GCC_HAVE_DWARF2_CFI_ASM macro which
	some versions of GCC define if -g is enabled.

compiler/.gitignore:
deep_profiler/.gitignore:
profiler/.gitignore:
slice/.gitignore:
util/.gitignore:
	Have git ignore .exe files in these directories.
2013-04-03 15:21:22 +11:00
Peter Wang
ec8f199bc5 Define GC_LINUX_THREADS instead of LINUX_THREADS.
Pass -DGC_LINUX_THREADS for Boehm GC instead of -DLINUX_THREADS.
The latter is a deprecated synonym.

configure.ac:
	As above.

*/RESERVED_MACRO_NAMES:
	LINUX_THREADS no longer needs to be excluded from the
	namespace check.
2013-02-20 11:55:48 +11:00
Julien Fischer
333bff9036 Fix several problems in the recently added mercury_windows header.
Branches: 11.07, main

Fix several problems in the recently added mercury_windows header.

runtime/mercury_windows.h
	Fix a typo: s/WIN2_/WIN32_/

	We need to wrap the contents of this file in
	#if defined(MR_WIN32) ... #endif; otherwise the
	namespace cleanliness check fails on non-Windows
	systems.

runtime/RESERVED_MACRO_NAMES:
	Ignore the WIN32_LEAN_NAD_MEAN macro since the runtime
	may define it in order to control the behaviour of windows.h.
2011-10-27 14:14:10 +00:00
Julien Fischer
5b1105b6a3 Avoid failures in the namespace cleanliness check in .par grade on MinGW.
Branches: main, 11.07

Avoid failures in the namespace cleanliness check in .par grade on MinGW.

*/RESERVED_MACRO_NAMES:
	Add some macros automatically defined by GCC on MinGW.
2011-09-14 07:00:44 +00:00
Peter Wang
9170c98eca Make it possible to use gcc global registers and non-local gotos with gcc 4.x.
Branches: main

Make it possible to use gcc global registers and non-local gotos with gcc 4.x.

Tested with asm_fast.gc on Linux/x86 with gcc 4.1.2, 4.2.4, 4.3.3, 4.4.2;
and on Linux/x86-64 with gcc 4.1.3, 4.2.4, 4.3.3.  I also did limited testing
of reg.gc, which also worked.

Some low-level C grades do not build with the current version of the compiler
so were not tested: fast.gc, jump.gc, asm_jump.gc.

configure.in:
	Check if the C compiler accepts `-fno-move-loop-invariants'.

	Add `-fno-move-loop-invariants' to gcc flags for non-local gotos.
	This is enough for `asm_jump.gc' to work (tested with an earlier
	version of the compiler).

	Comment out code to force `none' grades with gcc 4.x.

runtime/mercury_goto.h:
	Add a hack to prevent gcc 4.x removing stores to the succip register
	before a jump.  Along with `-fno-move-loop-invariants', this lets
	`asm_fast.gc' work.

	This hack is currently only used for the x86 and x86-64 definitions of
	MR_ASM_JUMP/MR_JUMP, but is possibly required on other architectures,
	too.

runtime/RESERVED_MACRO_NAMES:
	Add a macro which can be defined by gcc.
2009-11-24 23:49:45 +00:00
Julien Fischer
54a8a4f99d Avoid failing the namespace cleanliness check in .par grades.
Estimated hours taken: 0.1
Branches: main

Avoid failing the namespace cleanliness check in .par grades.
Boehm GC now intercepts several pthread functions.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
runtime/RESERVED_MACRO_NAMES:
trace/RESERVED_MACRO_NAMES:
	Conform to the recent update of the Boehm collector.
2006-08-30 14:11:48 +00:00
Julien Fischer
17027670e2 Fix an omission: add LINUX_THREADS.
runtime/RESERVED_MACRO_NAMES:
	Fix an omission: add LINUX_THREADS.
2006-08-30 13:31:07 +00:00
Peter Wang
c6a14c35b0 Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
Estimated hours taken: 5
Branches: main

Upgrade to version 7.0 alpha 6 (CVS 2006-08-14) of the Boehm garbage
collector.  The main reason is that thread-local allocation is not
supported on Solaris in version 6.x of the collector.

boehm_gc/*:
	Merge in changes from the vendor branch.

.README.in:
	Update Boehm GC version number and copyright notice.

Mmake.common.in:
configure.in:
runtime/RESERVED_MACRO_NAMES:
scripts/mgnuc.in:
	Don't define `THREAD_LOCAL_ALLOC' nor `GC_REDIRECT_TO_LOCAL' as
	thread-local allocation is automatically enabled in gc 7.0.

	Consistently use `GC_WIN32_THREADS' and `GC_LINUX_THREADS' as the
	non-prefixed versions of those symbols are deprecated.

	Don't define `NO_SIGNALS' as it is no longer necessary.

	Add librt to the list of thread libraries on Solaris.  This is
	needed for the POSIX semaphore functions now used on Solaris.

runtime/mercury_prof_mem.c:
runtime/mercury_prof_mem.h:
	Update comments mentioning `NO_SIGNALS'.

compiler/compile_target_code.m:
	Make `--inline-alloc' do nothing as inline allocation is currently
	broken in gc 7.0.

runtime/mercury.h:
runtime/mercury_heap.h:
	Include `gc_inline.h' instead of `gc_inl.h' as the latter no longer
	exists.

extras/concurrency/semaphore.m:
library/par_builtin.m:
robdd/bryant.c:
	Replace instances of `GC_PTR' by `void *' as the former no longer
	exists.

runtime/mercury_wrapper.c:
	Remove references to `GC_quiet' which no longer exists.

	Replace uses of `GC_quiet' for the MPS collector by a new variable
	`MR_mps_quiet'.

tools/bootcheck:
	Copy libatomic_ops-related files and directories when copying
	boehm_gc.
2006-08-15 04:19:40 +00:00
Peter Wang
257dcf24ca This patch adds preliminary support for deterministic, dependent
Estimated hours taken: 50
Branches: main

This patch adds preliminary support for deterministic, dependent
parallel conjunctions to the low-level backend.  In other backends
dependent parallel conjunctions are converted into plain conjunctions.

For a parallel conjunction (A & B), if the goal B is dependent on a variable
X which is bound by goal A, we transform the conjunction such that
goal B must wait for the value to be produced by A before it begins
executing.  This transformation is not yet useful in practice (you might as
well use a sequential conjunction).  A later version of this transformation
will move the synchronisation deeper into the goals so that B can execute as
much as possible before it waits for the value from A.

There is no coroutining support yet so if there are not enough threads
available then dependent parallel conjunctions can cause the program to
deadlock.


configure.in:
runtime/mercury_conf.h.in:
	Check for existence of semaphore.h and #define MR_HAVE_SEMAPHORE_H
	if it does.

library/library.m:
library/par_builtin.m:
library/private_builtin.m:
mdbcomp/prim_data.m:
mdbcomp/program_representation.m:
	Add a new module `par_builtin' to hold synchronisation primitives.

compiler/modules.m:
	Import `par_builtin' module in parallel grades.

compiler/dep_par_conj.m:
compiler/transform_hlds.m:
compiler/mercury_compile.m:
	Add a transformation to detect dependent parallel conjunctions
	and insert the necessary synchronisation code.

compiler/hlds_goal.m:
	Consider empty parallel conjunctions as atomic, the same as plain
	conjunctions.

compiler/inlining.m:
	Flatten parallel conjunctions when inlining, as for plain conjunctions.

compiler/live_vars.m:
	Fix build_live_sets_in_par_conj to handle dependent parallel
	conjunctions.

compiler/liveness.m:
	Delay deaths in parallel conjunctions the same way as for plain
	conjunctions.

	Update detect_resume_points_in_par_conj for dependent parallel
	conjunctions.

compiler/mode_util.m:
	Treat parallel and plain conjunctions equally when recomputing instmap
	deltas.

compiler/modes.m:
compiler/unique_modes.m:
	Treat parallel and plain conjunctions equally when checking modes and
	uniqueness.  However, don't flatten parallel conjunctions into plain
	conjunctions and vice versa.

compiler/simplify.m:
	Don't reset instmaps and seen calls after each conjunct of a parallel
	conjunction.

compiler/store_alloc.m:
	Update allocation for dependent parallel conjunctions.

compiler/switch_detection.m:
	Detect switches in parallel conjunctions the same as plain
	conjunctions.

compiler/par_conj_gen.m:
	Add a todo comment.

tests/Mmakefile:
tests/par_conj/.cvsignore:
tests/par_conj/Mmakefile:
tests/par_conj/dep_par_1.m:
tests/par_conj/dep_par_10.m:
tests/par_conj/dep_par_11.m:
tests/par_conj/dep_par_11b.m:
tests/par_conj/dep_par_11c.m:
tests/par_conj/dep_par_12.m:
tests/par_conj/dep_par_13.m:
tests/par_conj/dep_par_14.m:
tests/par_conj/dep_par_14b.m:
tests/par_conj/dep_par_14c.m:
tests/par_conj/dep_par_14d.m:
tests/par_conj/dep_par_16.m:
tests/par_conj/dep_par_17.m:
tests/par_conj/dep_par_18.m:
tests/par_conj/dep_par_2.m:
tests/par_conj/dep_par_20.m:
tests/par_conj/dep_par_21.m:
tests/par_conj/dep_par_22.m:
tests/par_conj/dep_par_23.m:
tests/par_conj/dep_par_3.m:
tests/par_conj/dep_par_3b.m:
tests/par_conj/dep_par_3c.m:
tests/par_conj/dep_par_4.m:
tests/par_conj/dep_par_5.m:
tests/par_conj/dep_par_5b.m:
tests/par_conj/dep_par_5c.m:
tests/par_conj/dep_par_5d.m:
tests/par_conj/dep_par_6.m:
tests/par_conj/dep_par_7.m:
tests/par_conj/dep_par_8.m:
tests/par_conj/dep_par_9.m:
tests/par_conj/indep_par_append.exp:
tests/par_conj/indep_par_append.m:
tests/par_conj/indep_par_nested.exp:
tests/par_conj/indep_par_nested.m:
	Add some parallel conjunction test cases.  The dependent parallel
	conjunction tests are not yet executed as they can deadlock if there
	are not enough threads available.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
runtime/RESERVED_MACRO_NAMES:
trace/RESERVED_MACRO_NAMES:
	Add LINUX_THREADS, _REENTRANT and _THREAD_SAFE.
2006-06-28 04:46:26 +00:00
Zoltan Somogyi
95b64f73a1 Move changes in the library on the mode-constraints branch onto the trunk.
Estimated hours taken: unknown (but probably several weeks by dmo)
Branches: main

Move changes in the library on the mode-constraints branch onto the trunk.

library/eqvclass.m:
	Add some utility functions and predicates.

library/map.m:
	Add some utility functions and predicates, and some type
	specialization directives.

library/tree234.m:
	Add some utility functions and predicates.

library/robdd.m:
	Add this module, which provides a Mercury interface to the C code in
	robdd/bryant.c. In some places, robustness has been sacrificed for
	speed, and the module is not (yet) as well documented as it could be;
	therefore it is not (yet) included in the documentation.

library/pprint.m:
	Print robdds nicely, since this is essential to debugging code handling
	robdds. (This is why adding robdd.m in some other directory, e.g. the
	compiler, wouldn't really work.)

library/term.m:
	Add a function that returns the highest numbered vars created from
	a var_supply.

library/varset.m:
	Add a function that returns the highest numbered vars created from
	a varset.

library/unsafe.m:
	Add this module here, since it may be needed to debug code in the
	library (e.g. in robdd.m.).

library/library.m:
	Add a reference to the robdd module, and a commented out reference
	to the unsafe module. If a developer needs to use unsafe.m anywhere
	in the Mercury implementation, they can uncomment this reference
	in the relevant workspace.

	Make the list of modules easier to maintain (especially in the case
	of CVS conflicts) by listing one module per line.

	Fix formatting of some foreign_procs.

NEWS:
	Mention the new predicates and functions.

Mmake.workspace:
	Add a new make variable that specifies the location of the robdd
	subdirectory.

Mmakefile:
	Add rules for handling the robdd subdirectory.

configure.in:
	Check whether the compiler can handle local foreign_decls, since
	robdd.m now needs this.

tools/bootcheck:
	Add the robdd subdirectory to the stage 2 & 3 directories.

deep_profiler/unsafe.m:
	Remove this module from this directory.

doc/Mmakefile:
	Do not include the robdd and unsafe modules in the documentation.
	The robdd module because (in its present state) it is not stable
	enough, the unsafe module because it is not enabled in installed
	versions of the library.

robdd/Makefile:
	Update the set of default compilation flags. The main code in this
	directory, bryant.c, is #included in library/robdd.m, and the only
	other programs in this directory are test programs.

robdd/Mmakefile:
	New file. Includes a mechanism to compile bryant.c in the robdd
	subdirectory, since this can give cleaner error messages than
	compiling library/robdd.m.

robdd/bryant.[ch]:
	Huge cleanup of these files. Add MR_ROBDD_ prefixes to global symbols,
	make the formatting conform to our standards, and fix irregularities
	in the uses of the macros that control the use of optional facilities.

robdd/bryantPrint.[ch]:
robdd/table.[ch]:
robdd/test_abexit.c:
robdd/test_abunify.c:
robdd/test_abglb.c:
robdd/test_iff.c:
robdd/test_rename.c:
robdd/test_restrict.c:
robdd/test_rglb.c:
robdd/test_upclose.c:
robdd/test_var.c:
robdd/test_vars.c:
robdd/timing.[ch]:
robdd/var.h:
	Conform to the changes in bryant.h. Note that since the code in these
	files won't end up in Mercury program code, they don't need to be
	namespace clean.

runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
	#define GC_I_HIDE_POINTERS before each #include of gc.h (bryant.c
	hides pointers). This impact of this #define is so small that it is
	not measurable.

runtime/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	Add HIDE_POINTER and REVEAL_POINTER, since defining GC_I_HIDE_POINTERS
	makes these macros from gc.h visible.

runtime/mercury_reg_workarounds.[ch]:
	Add the MR_memset function.

tests/debugger/declarative/if_then_else.{inp,exp}:
tests/debugger/declarative/ite_2.{inp,exp,exp2}:
	Avoid a name conflict with the predicate ite in robdd.m.
2004-12-15 06:58:00 +00:00
Zoltan Somogyi
f83cc54e0a Fix spurious failures of namespace cleanliness on aral, which has gcc 3.2
Estimated hours taken: 1
Branches: main

Fix spurious failures of namespace cleanliness on aral, which has gcc 3.2
installed. These are caused by the fact that gcc 3.2 apparently has no way
to get gcc -E -dN to not include builtin macros and command line arguments
in its output.

Mmake.common.in:
	Modify the rule for checking namespace cleanliness to check
	not the set of macros defined in the program under test, but the
	set of macros defined in the program under test that aren't also
	defined by an empty program. (The macros defined by an empty
	program are namespace pollution, but they aren't *our* pollution;
	they are the C compiler's.)

runtime/RESERVED_MACRO_NAMES:
	Add some macros that mgnuc causes gcc to define that aren't
	defined by gcc by default.
2003-04-08 04:39:29 +00:00
Zoltan Somogyi
e4bc841a87 Add two macros defined by mercury_signal.h.
Estimated hours taken: 0.1
Branches: main

runtime/RESERVED_MACRO_NAMES:
	Add two macros defined by mercury_signal.h.
2002-09-27 08:51:44 +00:00
Zoltan Somogyi
b7e55aa8ad Enforce namespace cleanliness in the library and browser directories
Estimated hours taken: 6
Branches: main

Enforce namespace cleanliness in the library and browser directories
as well as in the runtime and trace directories.

Mmake.common.in:
	Move the rules check_namespace here (they used to be in the Mmakefiles
	of the runtime and trace directories), together with the variables they
	need. Generalize them to also handle the needs of the browser, library
	and bytecode directories. The former two in particular need the
	ability to check automatically generated .mh files.

	Make all the rules used by check_namespace conditional on a macro
	that is defined by the Makefiles in all the directories that are
	checked for namespace cleanliness.

trace/Mmakefile:
runtime/Mmakefile:
	Replace the old rules for check_namespace, which are now in
	../Mmake.common.in, with the macros needed to control their behavior.

bytecode/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

	Move the lists of files to the start, before the include of
	../Mmake.common.

browser/Mmakefile:
library/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

runtime/RESERVED_MACRO_NAMES:
	Update comments, and delete obsolete exceptions.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	New files to contain the exceptions from the naming scheme.

tools/bootcheck:
	Invoke "mmake check_namespace" in the library and browser directories
	as well as the runtime and the trace directories. Perform the
	invocation before we delete the object files we are checking for
	cleanliness.

	Clean up object files in all stage2 directories, not just the library,
	as soon as we can.

library/array.m:
library/builtin.m:
library/io.m:
library/time.m:
	Fix namespace violations.
2002-09-24 06:55:36 +00:00
Fergus Henderson
17d5aa732e Add support for interfacing Mercury with the MPS garbage collector.
Estimated hours taken: 20
Branches: main

Add support for interfacing Mercury with the MPS garbage collector.

This change is broken into three parts:

	1. Import version 1.100.1 of the MPS kit into the Mercury
	   CVS repository, in the directory `mps_gc'.

	2. Make some changes to the MPS kit for Mercury,
	   to support fully-conservative collection and tagged pointers,
	   and to wrap it in an interface that is similar to that of
	   the Boehm collector.

	3. Modify the rest of the Mercury implementation
	   to support linking with the MPS kit instead
	   of the Boehm collector.  This involved defining
	   `mps' as a new GC method and a new grade component.

This is part 3 of 3.

Mmake.workspace:
	Include the MPS directories in the header file and library search
	paths.

tools/bootcheck:
	Link the mps_gc directory into the stage2 and stage3 directories.

Mmake.workspace:
runtime/Mmakefile:
scripts/ml.in:
	For *.mps grades, link in mps.a.
	(XXX ml.in is linking in libmps.a, which is wrong.)

runtime/Mmakefile:
trace/Mmakefile:
	In the rule for `check_headers', which checks macro namespace
	cleanliness, allow names to start with `MPS_' or `mps_'.

runtime/RESERVED_MACRO_NAMES:
	Add `mercury_mps_h', which is used by mps_gc/code/mercury_mps.h
	for its header guard.  (Normally it would be better to use
	uppercase for header guard macro names, but that would be
	inconsistent with the coding style used in mps_gc/code.)

scripts/canonical_grade.sh-subr:
scripts/init_grade_options.sh-subr:
scripts/parse_grade_options.sh-subr:
scripts/canonical_grade.sh-subr:
	Handle the new `mps' GC method and grade component.

compiler/globals.m:
compiler/options.m:
doc/user_guide.texi:
	Replace gc_method `conservative' with two alternatives
	`boehm' and `mps'. ("--gc conservative" is still allowed,
	and treated as equivalent to "--gc boehm".)
	Add new function `gc_is_conservative' to globals.m.

compiler/mercury_compile.m:
compiler/handle_options.m:
	Use `gc_is_conservative' rather than `= conservative'.

compiler/handle_options.m:
	Handle the "mps" grade component.
	(XXX need to document this in options.m and user_guide.texi)

compiler/compile_target_code.m:
	Pass the appropriate C defines for the new GC methods.

compiler/mercury_compile.m:
	Wrap the work-around for a Boehm GC bug inside `#ifndef MR_MPS_GC'.

library/array.m:
	Use GC_FREE() rather than GC_free().
	This is needed for two reasons:
	- so that it works with MPS, which only defines GC_FREE
	- so that it works with then Boehm collector when
	  GC debugging is enabled

library/benchmarking.m:
	Output GC statistics for the MPS collector.

runtime/mercury.h:
runtime/mercury_heap.h:
runtime/mercury_init.h:
runtime/mercury_memory.h:
	If MR_MPS_GC is defined, use mercury_mps.h rather than gc.h.

runtime/mercury_conf_param.h:
	Add configuration macros MR_BOEHM_GC and MR_MPS_GC.
	Set MR_CONSERVATIVE_GC if either of these is set.
	Default to MR_BOEHM_GC if only MR_CONSERVATIVE_GC is set.

runtime/mercury_context.h:
runtime/mercury_deep_copy.h:
runtime/mercury_engine.h:
runtime/mercury_float.h:
runtime/mercury_heap.h:
	Explictly #include "mercury_conf.h", so that
	MR_CONSERVATIVE_GC will be set properly before it is tested.

runtime/mercury_grade.h:
	Handle the .mps grade component.

runtime/mercury_memory.c:
runtime/mercury_wrapper.c:
runtime/mercury_memory_handlers.c:
	Move the call to MR_setup_signals() earlier in the
	initialization sequence, so that the MPS signal handlers
	get installed after our signal handlers.  This is needed
	because our signal handlers assume that any signals that
	they can't handle are fatal errors, which interfere's
	with MPS's use of signal handlers for memory barriers.

runtime/mercury_wrapper.c:
	Add code to initialize the MPS collector.
	Put code which is specific to the Boehm collector inside
	#ifdef MR_BOEHM_GC rather than #ifdef MR_CONSERVATIVE_GC.

runtime/mercury_wrapper.h:
	Update a comment.
2002-08-21 11:28:01 +00:00
Simon Taylor
b7c4a317e9 Add MR_ prefixes to the remaining non-prefixed symbols.
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.
2002-02-18 07:01:33 +00:00
Simon Taylor
c66cea0665 Add MR_ prefixes to uses of configuration macros.
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.
2002-02-13 09:56:49 +00:00
Simon Taylor
3dc7964b6c Add MR_ prefixes to the configuration macros.
Estimated hours taken: 5

Add MR_ prefixes to the configuration macros. This change only
adds prefixes to the definitions of the macros, not the uses.

configure.in:
aclocal.m4:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
	Add MR_ prefixes to all configuration macros.

	Consistently use a `_H' suffix for macros which indicate
	whether a header file exists.

	Remove unused macros RETSIGTYPE and USE_TYPE_LAYOUT.

runtime/Mmakefile:
runtime/mercury_conf_bootstrap.h:
	Define the non-prefixed macros for backwards compatibility.
2002-02-11 12:11:43 +00:00
Zoltan Somogyi
eee5c27261 Extend the workaround for a module qualification bug that we use for
Estimated hours taken: 0.1
Branches: main

runtime/mercury.h:
runtime/RESERVED_MACRO_NAMES:
	Extend the workaround for a module qualification bug that we use for
	the other builtin types to void and func.
2002-02-02 16:52:30 +00:00
Simon Taylor
1b127a6111 Improve the handling of the mdb's `--window' option.
Estimated hours taken: 10

Improve the handling of the mdb's `--window' option.
`mdb --window' now creates a window for mdb, not the program.
The main advantage of this is that redirection of the program's
input and output now works. The new behaviour should also be
implementable using the Windows API. The old behaviour is still
available with `mdb --program-in-window'.

Unfortunately, the code to open a pseudo-terminal for mdb's I/O
isn't very portable. It works on everything we run nightly tests on,
but isn't likely to work on older systems or BSD systems.

NEWS:
	Document the change.

scripts/mdb.in:
	Handle the new behaviour of `--window'.
	Add `--program-in-window'.

trace/mercury_trace_internal.c:
	If `--window' was passed in MERCURY_OPTIONS, redirect
	mdb's I/O to a window created using `xterm -S'.

	Rename occurrences of `close' to avoid gcc warnings.

runtime/mercury_trace_base.h:
runtime/mercury_trace_base.c:
	Kill the mdb window on exit.

runtime/mercury_wrapper.h:
runtime/mercury_wrapper.c:
	Add a runtime options `--mdb-in-window' for use by the mdb script.

runtime/mercury_signal.h:
runtime/mercury_signal.c:
	Add a version of MR_setup_signal which doesn't cause
	system calls to be restarted after a signal is received.
	This is needed to allow a read() from the mdb window
	to timeout if the window failed to start.

	Add functions to get and set the action for a given signal.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES.
	Check for functions open, close, dup, dup2, fdopen, setpgid,
	fork, execlp, wait, kill, grantpt, unlockpt, pstname, tcgetattr,
	tcsetattr and ioctl.

	Check for type pid_t.

	Check for header files <fcntl.h>, <termios.h>, <sys/ioctl.h>,
	<sys/stropts.h>.

	Check for /dev/ptmx, used to open pseudo-terminals.

runtime/mercury_misc.c:
runtime/mercury_misc.h:
	Add MR_mdb_warning, which prefixes messages from the
	debugger with "mdb: ".

	Add MR_perror and MR_mdb_perror, which are versions
	of perror which prefix the printed message with
	"Mercury runtime: " and "mdb: " respectively.

runtime/mercury_prof_time.c:
runtime/mercury_prof.c:
runtime/mercury_memory_handlers.c:
	Don't prefix error messages passed to MR_setup_signal
	with "Mercury runtime:". MR_setup_signal now uses
	MR_perror.
2002-01-30 14:51:11 +00:00
Fergus Henderson
eaa8674407 Fix some problems with mdb and readline 4.2 that arose due to the use
Estimated hours taken: 6
Branches: main

Fix some problems with mdb and readline 4.2 that arose due to the use
of readline when input is redirected from an input file.  Readline 4.2
issues a run-time warning, complaining that it can't get the terminal
characteristics.

One unfortunate consequence of this change is that none of the test
cases in our test suite actually test the use of readline anymore.
However, none of the line-editing features were being tested anyway,
and it's not really possible to test the use of readline properly
with our current test framework.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
	Check for the existence of isatty().

trace/mercury_trace_readline.c:
	Only use readline() if the input is a terminal.

trace/mercury_trace_internal.c:
	Delete the special handling of the `echo' command when readline
	is enabled, because whether or not readline is enabled now has
	no effect on echoing when the input is not a terminal.
	Double-echoing when the input *is* a terminal and the "echo on"
	command was used is probably appropriate anyway.

tests/debugger/Mmakefile:
tests/debugger/interactive.inp:
tests/debugger/interactive.exp:
	Reenable the `interactive' test case, since the spurious
	readline-related failures should not occur anymore.
	This required updating the input file and expected output
	file to reflect various earlier changes:
	- readline is used for query input,
	  so queries have to be all on one line
	- queries are now echoed properly when `echo on' is set
	- detailed stack traces include goal paths
	- we fixed a bug with the display of caller line numbers
	- we fixed a bug with the display of switch goal paths
2001-12-11 09:01:25 +00:00
Simon Taylor
b224002a74 Add HAVE_GETHOSTNAME and HAVE_GETPID, which are used by
Estimated hours taken: 0.1

runtime/RESERVED_MACRO_NAMES:
	Add HAVE_GETHOSTNAME and HAVE_GETPID, which are used by
	the mdb view command.
2001-11-02 06:23:50 +00:00
Zoltan Somogyi
bbccf83461 Associate optional ignore counts with breakpoints.
Estimated hours taken: 12
Branches: main

Associate optional ignore counts with breakpoints.

trace/mercury_trace_spy.[ch]:
	Add a mechanism for ignoring break points until execution has gone
	through a given number of events matching the breakpoint; these events
	may be required to be of a given port type (call events or interface
	events).

trace/mercury_trace_internal.c:
	Add options to the break command to allow the ignore type and count to
	be set when a breakpoint is created.

	Add a new command, ignore, to allow the ignore type and count to be set
	when the breakpoint already exists.

	Add a new command, scope, to specify the default scope of new
	breakpoints.

doc/user_guide.texi:
	Document the ignore and scope commands and the new options of the
	break command.

configure.in:
runtime/mercury_conf.h.in:
	Check whether the system has the snprintf function.

runtime/RESERVED_MACRO_NAMES:
	Add HAVE_SNPRINTF to the list.

tests/debugger/mdb_command_test.inp:
	Test the new ignore commands' documentation.

tests/debugger/breakpoints.{inp,exp}:
	Extend this test case to test ignore counts.
2001-08-07 02:16:07 +00:00
Simon Taylor
9dd11b2fc6 Smart recompilation. Record version numbers for each item
Estimated hours taken: 400

Smart recompilation. Record version numbers for each item
in interface files. Record which items are used in each compilation.
Only recompile a module if the output file does not exist or
nothing has changed.

There is still some work to do on this:
- it doesn't work with inter-module optimization.
- it doesn't work when the module name doesn't match the file name.
  (this problem will go away when mmake functionality is moved into
  the compiler.

I'll hold off documenting this change in the NEWS file and
on the web page for a month or so, until I've had a bit more
experience using it.

compiler/options.m:
compiler/handle_options.m:
doc/user_guide.texi:
	Add an option `--smart-recompilation', currently off by default.

	Add an internal option `--generate-version-numbers' to control
	whether version numbers are written to the interface files. If
	`--smart-recompilation' is disabled because the module
	is being compiled with `--intermodule-optimization' (e.g. in the
	standard library), we still want to write the version numbers
	to the interface files.

	Add an option `--verbose-recompilation' (default off)
	to write messages describing why recompilation is needed.

	Add an option `--warn-smart-recompilation' (default on)
	to control warnings relating to the smart recompilation
	system. Warn if smart recompilation will not work with
	the output and inter-module optimization options given.

compiler/recompilation.m:
	Type declarations for smart recompilation.
	Predicates to record program items used by compilation.

compiler/recompilation_version.m:
	Compute version numbers for program items in interface files.

compiler/recompilation_usage.m:
	Find all items used by a compilation.

compiler/recompilation_check.m:
	Check whether recompilation is necessary.

compiler/timestamp.m:
	Timestamp ADT for smart recompilation.

compiler/mercury_compile.m:
	Invoke the smart recompilation passes.

compiler/modules.m:
compiler/prog_io.m:
	Return timestamps for modules read.

	When reading a module make sure the current input stream
	is reset to its old value, not stdin.

	Handle version number items in interface files.

compiler/module_qual.m:
compiler/unify_proc.m:
compiler/make_hlds.m:
	Record all items used by local items.

compiler/make_hlds.m:
	Process `:- pragma type_spec' declarations in
	add_item_list_clauses. The qual_info is needed
	when processing `:- pragma type_spec' declarations
	so that any equivalence types used by the declaration
	can be recorded as used by the predicate or function to
	which the `:- pragma type_spec' applies.

compiler/equiv_type.m:
	For each imported item, record which equivalence types
	are used by that item.

compiler/hlds_module.m:
	Add a field to the module_info to store information about
	items used during compilation of a module.

compiler/check_typeclass.m:
	Make sure any items used in clauses for typeclass method
	implementations are recorded in the `.used' file.

compiler/prog_data.m:
compiler/*.m:
	Factor out some duplicated code by combining the
	pred and func, and pred_mode and func_mode items.

	Make it easier to extract the name of a type, inst or mode
	from its declaration.

	Add an item type to hold the version numbers for an interface file.

	Allow warnings to be reported for `nothing' items (used for
	reporting when version numbers are written using an
	obsolete format).

compiler/prog_io.m:
compiler/prog_io_util.m:
compiler/typecheck.m:
compiler/type_util.m:
compiler/*.m:
	Strip contexts from all types, not just those in class constraints.
	This makes it possible to use ordinary unification to check
	whether items have changed (with the exception of clauses).

	Remove code to create types with contexts in typechecking.

	Remove code scattered through the compiler to remove contexts
	from types in class constraints.

compiler/hlds_pred.m:
compiler/prog_util.m:
	Move hlds_pred__adjust_func_arity to prog_util, so that it
	can be used by the pre-hlds passes.

compiler/typecheck.m:
compiler/hlds_module.m:
	Move typecheck__visible_modules to hlds_module.m, so it can
	be used by recompilation_usage.m.

compiler/typecheck.m:
	Add a comment telling where updates may be required if the
	code to typecheck a var-functor unification changes.

compiler/error_util.m:
	Allow writing messages without contexts (used for the verbose
	recompilation messages).

	Add functions to format sym_name and sym_name_and_arity,
	and to add punctuation to the end of an error message
	without unwanted line breaks before the punctuation.

scripts/Mmake.rules:
compiler/modules.m:
	Don't remove the output file before running the compiler. We need
	to leave the old output file intact if smart recompilation detects
	that recompilation is not needed.

compiler/notes/compiler_design.html:
	Document the new modules.

library/io.m:
NEWS:
	Add predicates to find the modification time of files
	and input_streams.

library/set.m:
NEWS:
	Add a predicate version of set__fold

	Don't sort the output of set__filter, it's already sorted.

library/std_util.m:
NEWS:
	Add a predicate `std_util__map_maybe/3' and a function
  	`std_util__map_maybe/2' to apply a predicate or a function to
    	a value stored in a term of type `std_util__maybe'.

configure.in:
runtime/mercury_conf.h.in:
runtime/RESERVED_MACRO_NAMES:
	When checking whether the compiler is recent enough, check for
	the --warn-smart-recompilation option.

	Check for stat().

library/Mmakefile:
	Disable warnings about smart recompilation not working with
	`--intermodule-optimization'.

browser/Mmakefile:
	Disable warnings about smart recompilation not working when
	the module name doesn't match the file name.

runtime/mercury_string.h:
	Add a macro MR_make_string_const() which automates computation
	of the length of string argument to MR_string_const().

tests/recompilation/Mmakefile:
tests/recompilation/runtests:
tests/recompilation/test_functions:
tests/recompilation/TESTS:
tests/recompilation/README:
	A framework for testing smart recompilation.
	The option currently only works for the recompilation directory.

tests/recompilation/TEST.m.{1,2}:
tests/recompilation/TEST_2.m.{1,2}:
tests/recompilation/TEST.exp.{1,2}:
tests/recompilation/TEST.err_exp.2:
	Test cases, where TEST is one of add_constructor_r, add_instance_r,
	add_instance_2_r, add_type_nr, change_class_r, change_instance_r,
	change_mode_r, field_r, func_overloading_nr, func_overloading_r,
	lambda_mode_r, nested_module_r, no_version_numbers_r,
	pragma_type_spec_r, pred_ctor_ambiguity_r, pred_overloading_r,
	add_type_re, remove_type_re, type_qual_re.

tests/handle_options:
	Add an option `-e' to generate any missing expected output files.
2001-06-27 05:05:21 +00:00
Fergus Henderson
9836a0ba12 Add HAVE_SYS_SIGNAL, since this is used by some code that I
Estimated hours taken: 0.25
Branches: release, main

runtime/RESERVED_MACRO_NAMES:
	Add HAVE_SYS_SIGNAL, since this is used by some code that I
	added recently.  (XXX This is not really the right fix; the right
	fix would be to rename all the HAVE_* symbols has MR_HAVE_*.
	But that's too likely to be destabilizing to do just before
	a release.)
2001-03-19 02:34:48 +00:00
Fergus Henderson
2f737704b9 Add some Mmake rules to the runtime and some code to tools/bootcheck
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:
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.
2000-12-04 18:28:57 +00:00