for review: clean up handling of config macros
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Mar 15 22:10:09 AEDT 1998
Hi,
Tyson, can you please review this one?
-------------------------------------------------------------------------------
Clean up the handling of configuration macros in the runtime.
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
Move the code to set configuration parameters based on
the values of other configuration parameters from
mercury_conf.h.in to a new file mercury_conf_param.h,
because otherwise autoconf munges the code in undesirable ways
(it replaces all `#undef <foo>' statements with `/* #undef <foo> */').
runtime/mercury_conf.h.in:
runtime/mercury_conf_param.h:
runtime/*.h:
runtime/*.c:
Use more meaningful names, starting with the usual `MR_' prefix,
for various configuration parameters:
- replace the existing configuration macros SPEED with
three new macros MR_CHECK_OVERFLOW, MR_LOWLEVEL_DEBUG,
and MR_DEBUG_NONDET_STACK;
- rename DEBUG_GOTOS as MR_DEBUG_GOTOS, and make it
implied by MR_LOWLEVEL_DEBUG;
- rename DEBUG_LABELS as MR_CHOOSE_ENTRY_POINT.
(But there are still many configuration parameters that don't
start with `MR_', I'm afraid.)
runtime/CFLAGSFILE:
runtime/mercury_conf_param.h:
Removed CFLAGSFILE. The documentation there was had rotted badly.
I moved most of it to mercury_conf_param.h where hopefully
it will stand a better chance of being kept up-to-date.
I added documentation for the configuration parameters added in
the last year or so. The documentation here now covers
every configuration parameter that we use; please keep it that way!
runtime/mercury_debug.h:
Fix a bug: there was a misplaced "#endif".
runtime/mercury_stack_trace.c:
Fix yet another misspelling of "deterministic".
-------------------------------------------------------------------------------
New file: mercury_conf_param.h
-------------------------------------------------------------------------------
/*
** Copyright (C) 1997-1998 The University of Melbourne.
** This file may only be copied under the terms of the GNU Library General
** Public License - see the file COPYING.LIB in the Mercury distribution.
*/
/*
** mercury_conf_param.h:
** Defines various configuration parameters.
**
** Configuration parameters fall into three groups.
** They can be set automatically by autoconf.
** They can be passed on the command line (e.g. the mgnuc
** script sets some options based on the grade).
** Or their values can be implied by the settings of other parameters.
**
** The ones defined in mercury_conf.h are determined by autoconf.
** The remainder are documented and/or defined by this file,
** #included by mercury_conf.h.
*/
/*
** IMPORTANT NOTE:
** This file must not contain any #include statements,
** and may not define any global variables,
** for reasons explained in mercury_imp.h.
** This file should contain _only_ configuration macros.
*/
#ifndef MERCURY_CONF_PARAM_H
#define MERCURY_CONF_PARAM_H
/*---------------------------------------------------------------------------*/
/*
** Documentation for configuration parameters which can be set on the
** command line via `-D'.
*/
/*
** Code generation options:
**
** USE_GCC_GLOBAL_REGISTERS
** USE_GCC_NONLOCAL_GOTOS
** USE_ASM_LABELS
** CONSERVATIVE_GC
** NATIVE_GC [not yet working]
** COMPACT_ARGS
** NO_TYPE_LAYOUT
** BOXED_FLOAT
** USE_TRAIL
** See the documentation for
** --gcc-global-registers
** --gcc-non-local-gotos
** --gcc-asm-labels
** --gc conservative
** --gc accurate [not yet working]
** --args compact
** --no-type-layout
** --unboxed-float
** --use-trail
** (respectively) in the mmc help message or the Mercury User's Guide.
**
** USE_SINGLE_PREC_FLOAT:
** Use C's `float' rather than C's `double' for the
** Mercury floating point type (`Float').
**
** USE_TYPE_TO_TERM:
** Include `type_to_term' and `term_to_type' fields in type_infos.
** [This is obsolete. USE_TYPE_LAYOUT is a better solution.]
**
** PARALLEL
** Enable support for parallelism [not yet working].
*/
/*
** Runtime checking options:
**
** MR_CHECK_FOR_OVERFLOW
** (Implied by MR_LOWLEVEL_DEBUG.)
** Check for overflow of the various memory
** areas, e.g. heap, det stack, nondet stack,
** before every access that might result in overflow.
** Causes the generated code to become bigger and less efficient.
** Slows down compilation.
**
** Normally MR_CHECK_FOR_OVERFLOW is not set, since
** we trap overflows using mprotect().
*/
/*
** Debugging options:
**
** MR_USE_DEBUGGER:
** Make MR_trace() use an external process debugger
** (with communication done via a socket interface)
** rather than using the debugger that is part of
** the Mercury runtime.
** [The external debugger has not yet been written.]
**
** MR_LOWLEVEL_DEBUG
** Enables various low-level debugging stuff,
** that was in the distant past used to debug
** the low-level code generation.
** Causes the generated code to become VERY big and VERY inefficient.
** Slows down compilation a LOT.
**
** MR_DEBUG_GOTOS
** (Implied by MR_LOWLEVEL_DEBUG.)
** Enables low-level debugging of gotos.
** Causes the generated code to become bigger and less efficient.
** Slows down compilation.
**
** MR_DEBUG_NONDET_STACK
** Include a "name" field in the nondet stack frames.
** (Since this affects binary compatibility,
** This is a "compilation model" option which affects the grade.)
*/
/*
** Profiling options:
**
** MEASURE_REGISTER_USAGE
** Enable this if you want to measure the number of times
** each register is used. (Note that the measurement includes
** uses which occur inside debugging routines, so to get an accurate
** count you should not also enable low-level debugging.)
**
** PROFILE_CALLS
** Enables call count profiling.
**
** PROFILE_TIME
** Enables time profiling.
**
** PROFILE_MEMORY
** Enables profiling of memory usage.
*/
/*
** Miscellaneous options:
**
** MR_CHOOSE_ENTRY_POINT
** Enables support for the `-w' (entry point) command
** in the MERCURY_OPTIONS environment variable.
** (`-w' also happens to work if you set certain other
** options instead, include MR_LOWLEVEL_DEBUGGING.)
*/
/*---------------------------------------------------------------------------*/
/*
** Settings of configuration parameters which can be passed on
** the command line, but which are also implied by other parameters.
*/
/* MR_LOWLEVEL_DEBUG implies MR_DEBUG_GOTOS and MR_CHECK_FOR_OVERFLOW */
#if defined(MR_LOWLEVEL_DEBUG)
#define MR_DEBUG_GOTOS
#define MR_CHECK_FOR_OVERFLOW
#endif
/*---------------------------------------------------------------------------*/
/*
** Configuration parameters whose values are determined by the settings
** of other configuration parameters.
*/
/*
** MR_USE_STACK_LAYOUTS -- stack layouts are in use, generate stack
** layout structures.
*/
#if defined(MR_STACK_TRACE) || defined(NATIVE_GC)
#define MR_USE_STACK_LAYOUTS
#else
#undef MR_USE_STACK_LAYOUTS
#endif
/*
** MR_INSERT_LABELS -- labels need to be inserted into the label table.
** (this also means the initialization code needs
** to be run).
*/
#if defined(MR_STACK_TRACE) || defined(NATIVE_GC) || defined(MR_DEBUG_GOTOS)
#define MR_INSERT_LABELS
#else
#undef MR_INSERT_LABELS
#endif
/*
** Static code addresses are available unless using gcc non-local gotos,
** without assembler labels.
*/
#if (defined(USE_GCC_NONLOCAL_GOTOS) && !defined(USE_ASM_LABELS))
#undef MR_STATIC_CODE_ADDRESSES
#else
#define MR_STATIC_CODE_ADDRESSES
#endif
/*
** MR_NEED_INITIALIZATION_CODE -- the module specific initialization code
** is needed (doesn't actually run the code,
** however).
**
** You need to run initialization code for grades without static
** code addresses, for profiling, and any time you need to insert
** labels into the label table.
*/
#if !defined(MR_STATIC_CODE_ADDRESSES) || defined(PROFILE_CALLS) \
|| defined(DEBUG_LABELS) || defined(MR_INSERT_LABELS)
#define MR_NEED_INITIALIZATION_CODE
#else
#undef MR_NEED_INITIALIZATION_CODE
#endif
/*---------------------------------------------------------------------------*/
#endif /* MERCURY_CONF_PARAM_H */
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list