Fix problems noted in review.

Copied from Perforce
 Change: 192357
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2016-09-13 17:19:07 +01:00
parent cb0c6eabef
commit d43cc4ef35
6 changed files with 31 additions and 16 deletions

View file

@ -78,7 +78,7 @@ extern void LockRelease(Lock lock);
extern Bool LockCheck(Lock lock);
/* LockIsHeld -- test whether lock is held */
/* LockIsHeld -- test whether lock is held by any thread */
extern Bool LockIsHeld(Lock lock);

View file

@ -264,6 +264,7 @@ void mps_arena_postmortem(mps_arena_t arena)
{
/* Don't call ArenaEnter -- one of the purposes of this function is
* to release the arena lock if it's held */
AVER(TESTT(Arena, arena));
ArenaPostmortem(ArenaGlobals(arena));
}
@ -386,6 +387,9 @@ void mps_arena_destroy(mps_arena_t arena)
mps_bool_t mps_arena_busy(mps_arena_t arena)
{
/* Don't call ArenaEnter -- the purpose of this function is to
* determine if the arena lock is held */
AVER(TESTT(Arena, arena));
return ArenaBusy(arena);
}

View file

@ -830,6 +830,7 @@ void ArenaRestoreProtection(Globals globals)
}
}
}
arenaForgetProtection(globals);
}

View file

@ -62,7 +62,9 @@ recursive lock.)
_`.req.held`: Provide a means to test if a lock is held. (This is
needed for debugging a dynamic function table callback on Windows on
x86-64. See ``mps_arena_busy()`` for a detailed description of this
use case.)
use case. Note that in this use case the program is running
single-threaded and so there is no need for this feature to be
thread-safe.)
_`.req.global`: Provide *global* locks: that is locks that need not be
allocated or initialized by the user.
@ -131,7 +133,8 @@ corresponding ``LockClaimRecursive()`` call.
``Bool LockIsHeld(Lock lock)``
Return true if the lock is held, false otherwise.
Return true if the lock is held by any thread, false otherwise. Note
that this function need not be thread-safe (see `.req.held`_).
``void LockClaimGlobal(void)``

View file

@ -179,14 +179,15 @@ Memory Management Glossary: P
.. mps:specific::
One of the three states an :term:`arena` can be in (the
others being the :term:`clamped state` and the
:term:`unclamped state`). In the parked state, no
:term:`garbage collection` is in progress, no object
motion occurs and the staleness of :term:`location
dependencies` does not change. Call
:c:func:`mps_arena_park` or :c:func:`mps_arena_collect` to
put an arena into the parked state.
One of the four states an :term:`arena` can be in (the
others being the :term:`clamped state`, the
:term:`postmortem state`, and the :term:`unclamped
state`). In the parked state, no :term:`garbage
collection` is in progress, no object motion occurs and
the staleness of :term:`location dependencies` does not
change. Call :c:func:`mps_arena_park` or
:c:func:`mps_arena_collect` to put an arena into the
parked state.
perfect fit

View file

@ -676,7 +676,6 @@ New collections may start? yes
Objects may move? yes no no no
Location dependencies may become stale? yes no no no
Memory may be returned to the OS? yes no no no
Memory protection may be applied? yes yes yes no
Safe to continue running? yes yes yes no
Functions that leave the arena in this state :c:func:`mps_arena_create_k`, :c:func:`mps_arena_clamp`, :c:func:`mps_arena_park`, :c:func:`mps_arena_postmortem`
:c:func:`mps_arena_release`, :c:func:`mps_arena_step` :c:func:`mps_arena_collect`
@ -762,10 +761,17 @@ can only be called in this state.
.. warning::
After calling this function, memory managed by the arena is not
in a consistent state, and so it is no longer safe to continue
running the client program. This functions is intended for
postmortem debugging only.
1. After calling this function, memory managed by the arena is
not in a consistent state, and so it is no longer safe to
continue running the client program. This functions is
intended for postmortem debugging only.
2. This function must be called from the thread that holds the
arena lock (if any thread holds it). This is the case if the
program is single-threaded, or if it is called from an MPS
assertion handler. When calling this function from the
debugger, check the stack to see which thread has the MPS
arena lock.
.. index::