1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 12:21:25 -08:00

Add and document new configuration options config_thread_single and config_protection_none.

Copied from Perforce
 Change: 185037
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-03-26 23:19:04 +00:00
parent 8e5ef07199
commit a683ecf9f3
6 changed files with 102 additions and 51 deletions

View file

@ -164,6 +164,33 @@
#endif
/* CONFIG_THREAD_SINGLE -- support single-threaded execution only
*
* This symbol causes the MPS to be built for single-threaded
* execution only, where locks are not needed and so lock operations
* can be defined as no-ops by lock.h.
*/
#if defined(CONFIG_THREAD_SINGLE)
#define THREAD_SINGLE
#else
#define THREAD_MULTI
#endif
/* CONFIG_PROTECTION_NONE -- no support for memory protection
*
* This symbol causes the MPS to built for an environment where there
* is no memory protection, and so segment summaries cannot be
* maintained by seg.c.
*/
#if defined(CONFIG_PROTECTION_NONE)
#define PROTECTION_NONE
#else
#define PROTECTION
#endif
#define MPS_VARIETY_STRING \
MPS_ASSERT_STRING "." MPS_LOG_STRING "." MPS_STATS_STRING
@ -517,8 +544,6 @@
#define MPS_PROD_STRING "mps"
#define MPS_PROD_MPS
#define THREAD_MULTI
#define PROTECTION
#define PROD_CHECKLEVEL_INITIAL CheckLevelSHALLOW
/* TODO: This should be proportional to the memory usage of the MPS, not

View file

@ -85,9 +85,6 @@
#define LockSig ((Sig)0x51970CC9) /* SIGnature LOCK */
#if defined(THREAD_MULTI)
/* LockSize -- Return the size of a LockStruct
*
* Supports allocation of locks.
@ -198,8 +195,7 @@ extern void LockClaimGlobal(void);
extern void LockReleaseGlobal(void);
#elif defined(THREAD_SINGLE)
#ifdef THREAD_SINGLE
#define LockSize() MPS_PF_ALIGN
#define LockInit(lock) UNUSED(lock)
@ -214,12 +210,7 @@ extern void LockReleaseGlobal(void);
#define LockClaimGlobal()
#define LockReleaseGlobal()
#else
#error "No threading defined."
#endif
#endif /* THREAD_SINGLE */
#endif /* lock_h */

View file

@ -58,7 +58,7 @@ typedef struct LockStruct {
/* LockSize -- size of a LockStruct */
size_t LockSize(void)
size_t (LockSize)(void)
{
return sizeof(LockStruct);
}
@ -66,7 +66,7 @@ size_t LockSize(void)
/* LockCheck -- check a lock */
Bool LockCheck(Lock lock)
Bool (LockCheck)(Lock lock)
{
CHECKS(Lock, lock);
/* While claims can't be very large, I don't dare to put a limit on it. */
@ -77,7 +77,7 @@ Bool LockCheck(Lock lock)
/* LockInit -- initialize a lock */
void LockInit(Lock lock)
void (LockInit)(Lock lock)
{
pthread_mutexattr_t attr;
int res;
@ -99,7 +99,7 @@ void LockInit(Lock lock)
/* LockFinish -- finish a lock */
void LockFinish(Lock lock)
void (LockFinish)(Lock lock)
{
int res;
@ -114,7 +114,7 @@ void LockFinish(Lock lock)
/* LockClaim -- claim a lock (non-recursive) */
void LockClaim(Lock lock)
void (LockClaim)(Lock lock)
{
int res;
@ -133,7 +133,7 @@ void LockClaim(Lock lock)
/* LockReleaseMPM -- release a lock (non-recursive) */
void LockReleaseMPM(Lock lock)
void (LockReleaseMPM)(Lock lock)
{
int res;
@ -148,7 +148,7 @@ void LockReleaseMPM(Lock lock)
/* LockClaimRecursive -- claim a lock (recursive) */
void LockClaimRecursive(Lock lock)
void (LockClaimRecursive)(Lock lock)
{
int res;
@ -168,7 +168,7 @@ void LockClaimRecursive(Lock lock)
/* LockReleaseRecursive -- release a lock (recursive) */
void LockReleaseRecursive(Lock lock)
void (LockReleaseRecursive)(Lock lock)
{
int res;
@ -203,7 +203,7 @@ static void globalLockInit(void)
/* LockClaimGlobalRecursive -- claim the global recursive lock */
void LockClaimGlobalRecursive(void)
void (LockClaimGlobalRecursive)(void)
{
int res;
@ -216,7 +216,7 @@ void LockClaimGlobalRecursive(void)
/* LockReleaseGlobalRecursive -- release the global recursive lock */
void LockReleaseGlobalRecursive(void)
void (LockReleaseGlobalRecursive)(void)
{
LockReleaseRecursive(globalRecLock);
}
@ -224,7 +224,7 @@ void LockReleaseGlobalRecursive(void)
/* LockClaimGlobal -- claim the global non-recursive lock */
void LockClaimGlobal(void)
void (LockClaimGlobal)(void)
{
int res;
@ -237,7 +237,7 @@ void LockClaimGlobal(void)
/* LockReleaseGlobal -- release the global non-recursive lock */
void LockReleaseGlobal(void)
void (LockReleaseGlobal)(void)
{
LockReleaseMPM(globalLock);
}

View file

@ -72,7 +72,7 @@ typedef struct LockStruct {
/* LockSize -- size of a LockStruct */
size_t LockSize(void)
size_t (LockSize)(void)
{
return sizeof(LockStruct);
}
@ -80,7 +80,7 @@ size_t LockSize(void)
/* LockCheck -- check a lock */
Bool LockCheck(Lock lock)
Bool (LockCheck)(Lock lock)
{
CHECKS(Lock, lock);
/* While claims can't be very large, I don't dare to put a limit on it. */
@ -91,7 +91,7 @@ Bool LockCheck(Lock lock)
/* LockInit -- initialize a lock */
void LockInit(Lock lock)
void (LockInit)(Lock lock)
{
pthread_mutexattr_t attr;
int res;
@ -113,7 +113,7 @@ void LockInit(Lock lock)
/* LockFinish -- finish a lock */
void LockFinish(Lock lock)
void (LockFinish)(Lock lock)
{
int res;
@ -128,7 +128,7 @@ void LockFinish(Lock lock)
/* LockClaim -- claim a lock (non-recursive) */
void LockClaim(Lock lock)
void (LockClaim)(Lock lock)
{
int res;
@ -147,7 +147,7 @@ void LockClaim(Lock lock)
/* LockReleaseMPM -- release a lock (non-recursive) */
void LockReleaseMPM(Lock lock)
void (LockReleaseMPM)(Lock lock)
{
int res;
@ -162,7 +162,7 @@ void LockReleaseMPM(Lock lock)
/* LockClaimRecursive -- claim a lock (recursive) */
void LockClaimRecursive(Lock lock)
void L(ockClaimRecursive)(Lock lock)
{
int res;
@ -182,7 +182,7 @@ void LockClaimRecursive(Lock lock)
/* LockReleaseRecursive -- release a lock (recursive) */
void LockReleaseRecursive(Lock lock)
void (LockReleaseRecursive)(Lock lock)
{
int res;
@ -217,7 +217,7 @@ static void globalLockInit(void)
/* LockClaimGlobalRecursive -- claim the global recursive lock */
void LockClaimGlobalRecursive(void)
void (LockClaimGlobalRecursive)(void)
{
int res;
@ -230,7 +230,7 @@ void LockClaimGlobalRecursive(void)
/* LockReleaseGlobalRecursive -- release the global recursive lock */
void LockReleaseGlobalRecursive(void)
void (LockReleaseGlobalRecursive)(void)
{
LockReleaseRecursive(globalRecLock);
}
@ -238,7 +238,7 @@ void LockReleaseGlobalRecursive(void)
/* LockClaimGlobal -- claim the global non-recursive lock */
void LockClaimGlobal(void)
void (LockClaimGlobal)(void)
{
int res;
@ -251,7 +251,7 @@ void LockClaimGlobal(void)
/* LockReleaseGlobal -- release the global non-recursive lock */
void LockReleaseGlobal(void)
void (LockReleaseGlobal)(void)
{
LockReleaseMPM(globalLock);
}

View file

@ -40,18 +40,18 @@ typedef struct LockStruct {
} LockStruct;
size_t LockSize(void)
size_t (LockSize)(void)
{
return sizeof(LockStruct);
}
Bool LockCheck(Lock lock)
Bool (LockCheck)(Lock lock)
{
CHECKS(Lock, lock);
return TRUE;
}
void LockInit(Lock lock)
void (LockInit)(Lock lock)
{
AVER(lock != NULL);
lock->claims = 0;
@ -60,7 +60,7 @@ void LockInit(Lock lock)
AVERT(Lock, lock);
}
void LockFinish(Lock lock)
void (LockFinish)(Lock lock)
{
AVERT(Lock, lock);
/* Lock should not be finished while held */
@ -69,7 +69,7 @@ void LockFinish(Lock lock)
lock->sig = SigInvalid;
}
void LockClaim(Lock lock)
void (LockClaim)(Lock lock)
{
AVERT(Lock, lock);
EnterCriticalSection(&lock->cs);
@ -79,7 +79,7 @@ void LockClaim(Lock lock)
lock->claims = 1;
}
void LockReleaseMPM(Lock lock)
void (LockReleaseMPM)(Lock lock)
{
AVERT(Lock, lock);
AVER(lock->claims == 1); /* The lock should only be held once */
@ -87,7 +87,7 @@ void LockReleaseMPM(Lock lock)
LeaveCriticalSection(&lock->cs);
}
void LockClaimRecursive(Lock lock)
void (LockClaimRecursive)(Lock lock)
{
AVERT(Lock, lock);
EnterCriticalSection(&lock->cs);
@ -95,7 +95,7 @@ void LockClaimRecursive(Lock lock)
AVER(lock->claims > 0);
}
void LockReleaseRecursive(Lock lock)
void (LockReleaseRecursive)(Lock lock)
{
AVERT(Lock, lock);
AVER(lock->claims > 0);
@ -129,27 +129,27 @@ static void lockEnsureGlobalLock(void)
}
}
void LockClaimGlobalRecursive(void)
void (LockClaimGlobalRecursive)(void)
{
lockEnsureGlobalLock();
AVER(globalLockInit);
LockClaimRecursive(globalRecLock);
}
void LockReleaseGlobalRecursive(void)
void (LockReleaseGlobalRecursive)(void)
{
AVER(globalLockInit);
LockReleaseRecursive(globalRecLock);
}
void LockClaimGlobal(void)
void (LockClaimGlobal)(void)
{
lockEnsureGlobalLock();
AVER(globalLockInit);
LockClaim(globalLock);
}
void LockReleaseGlobal(void)
void (LockReleaseGlobal)(void)
{
AVER(globalLockInit);
LockReleaseMPM(globalLock);

View file

@ -97,6 +97,10 @@ as a dimension of configuration since `.req.prod`_ has been retired.
_`.def.target`: The *target* is the result of the build.
_`.def.option`: An *option* is a feature of the MPS that is not
selected via the *platform* and *variety*. See `.opt`_.
Overview
--------
@ -150,7 +154,7 @@ _`.build.cc`: A consequence of this approach is that it should always
be possible to build a complete target with a single UNIX command line
calling the compiler driver (usually "cc" or "gcc"), for example::
cc -o main -DCONFIG_VAR_DF foo.c bar.c baz.s -lz
cc -o main -DCONFIG_VAR_COOL foo.c bar.c baz.s -lz
_`.build.defs`: The "defs" are the set of preprocessor macros which are to be
predefined when compiling the module sources::
@ -319,12 +323,14 @@ _`.pf.form`: This file consists of sets of directives of the form::
#elif <conjunction of builder predefinitions>
#define MPS_PF_<platform code>
#define MPS_PF_STRING "<platform code>"
#define MPS_OS_<operating system code>
#define MPS_ARCH_<architecture code>
#define MPS_BUILD_<builder code>
#define MPS_T_WORD <word type>
#define MPS_T_ULONGEST <longest unsigned integer type>
#define MPS_WORD_SHIFT <word shift>
#define MPS_WORD_WIDTH <word width in bits>
#define MPS_WORD_SHIFT <log to the base 2 of word width>
#define MPS_PF_ALIGN <minimum alignment>
_`.pf.detect`: The conjunction of builder predefinitions is a constant
@ -513,6 +519,35 @@ For example, this sort of thing::
This violates `.no-spaghetti`_.
Configuration options
---------------------
_`.opt`: Options select features of the MPS that are not selected by the *platform* and the *variety*.
_`.opt.support`: The features selected by options are not supported or
documented in the public interface. This is to keep the complexity of
the MPS manageable: at present the number of supported configuration
is *platforms* × *varieties* (at time of writing, 9 × 3 = 27). Each
supported option would double (or worse) the number of supported
configurations.
_`.opt.ansi`: ``CONFIG_PF_ANSI`` tells ``mps.c`` to exclude the
sources for the auto-detected platform, and use the generic ("ANSI")
platform instead.
_`.opt.thread`: ``CONFIG_THREAD_SINGLE`` causes the MPS to be built
for single-threaded execution only, where locks are not needed and so
lock operations can be defined as no-ops by ``lock.h``.
_`.opt.prot`: ``CONFIG_PROTECTION_NONE`` causes the MPS to be built
for an environment where there is no memory protection, and so segment summaries cannot be maintained by ``seg.c``.
_`.opt.prot.thread`: If both ``CONFIG_THREAD_SINGLE`` and
``CONFIG_PROTECTION_NONE`` are defined, then the shield is not needed
and so shield operations can be defined as no-ops by ``mpm.h``.
To document
-----------
- What about constants in config.h?