1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-17 08:31:09 -08:00

Alas, mvff and mvt can't round up alignment because they need to support buffered allocation.

Copied from Perforce
 Change: 185381
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-04-09 13:01:58 +01:00
parent eb5c7f75cc
commit 2e053caffc
6 changed files with 21 additions and 28 deletions

View file

@ -254,6 +254,11 @@ static Res MVTInit(Pool pool, ArgList args)
}
AVERT(Align, align);
/* This restriction on the alignment is necessary because of the use
* of a Freelist to store the free address ranges in low-memory
* situations. See <design/freelist/#impl.grain.align>.
*/
AVER(AlignIsAligned(align, FreelistMinimumAlignment));
AVER(0 < minSize);
AVER(minSize <= meanSize);
AVER(meanSize <= maxSize);
@ -261,12 +266,6 @@ static Res MVTInit(Pool pool, ArgList args)
AVER(fragLimit <= 100);
/* TODO: More sanity checks possible? */
/* This restriction on the alignment is necessary because of the use
* of a Freelist to store the free address ranges in low-memory
* situations. See <design/freelist/#impl.grain.align>.
*/
align = AlignAlignUp(align, FreelistMinimumAlignment);
/* see <design/poolmvt/#arch.parameters> */
fillSize = SizeAlignUp(maxSize, ArenaAlign(arena));
/* see <design/poolmvt/#arch.fragmentation.internal> */

View file

@ -571,15 +571,14 @@ static Res MVFFInit(Pool pool, ArgList args)
AVER(avgSize > 0); /* .arg.check */
AVER(avgSize <= extendBy); /* .arg.check */
AVERT(Align, align);
AVERT(Bool, slotHigh);
AVERT(Bool, arenaHigh);
AVERT(Bool, firstFit);
/* This restriction on the alignment is necessary because of the use
* of a Freelist to store the free address ranges in low-memory
* situations. <design/freelist/#impl.grain.align>.
*/
align = AlignAlignUp(align, FreelistMinimumAlignment);
AVER(AlignIsAligned(align, FreelistMinimumAlignment));
AVERT(Bool, slotHigh);
AVERT(Bool, arenaHigh);
AVERT(Bool, firstFit);
mvff = Pool2MVFF(pool);

View file

@ -156,8 +156,8 @@ Blocks may use :term:`in-band headers`? yes yes yes yes yes
:c:macro:`MPS_PF_ALIGN`.
.. [7] :ref:`pool-mvt` and :ref:`pool-mvff` pools have
configurable alignment, but smaller values than
``sizeof(void *)`` are rounded up.
configurable alignment, but it may not be smaller than
``sizeof(void *)``.
.. [8] In pools with this property, each object may specify an
:term:`dependent object` which the client program

View file

@ -79,8 +79,8 @@ MVFF properties
* Allocations may be variable in size.
* The :term:`alignment` of blocks is configurable, but smaller
alignments than ``sizeof(void *)`` are rounded up.
* The :term:`alignment` of blocks is configurable, but may not be
smaller than ``sizeof(void *)``.
* Blocks do not have :term:`dependent objects`.
@ -130,8 +130,7 @@ MVFF interface
the pool. If an unaligned size is passed to :c:func:`mps_alloc`
or :c:func:`mps_free`, it will be rounded up to the pool's
alignment. The minimum alignment supported by pools of this
class is ``sizeof(void *)``; you can pass a smaller alignment
but it will be rounded up.
class is ``sizeof(void *)``.
* :c:macro:`MPS_KEY_MVFF_ARENA_HIGH` (type :c:type:`mps_bool_t`,
default false) determines whether new segments are acquired at high

View file

@ -78,8 +78,8 @@ MVT properties
* Allocations may be variable in size.
* The :term:`alignment` of blocks is configurable, but smaller
alignments than ``sizeof(void *)`` are rounded up.
* The :term:`alignment` of blocks is configurable, but may not be
smaller than ``sizeof(void *)``.
* Blocks do not have :term:`dependent objects`.
@ -120,8 +120,7 @@ MVT interface
the pool. If an unaligned size is passed to :c:func:`mps_alloc` or
:c:func:`mps_free`, it will be rounded up to the pool's alignment.
The minimum alignment supported by pools of this class is
``sizeof(void *)``; you can pass a smaller alignment but it will
be rounded up.
``sizeof(void *)``.
* :c:macro:`MPS_KEY_MIN_SIZE` (type :c:type:`size_t`, default is
:c:macro:`MPS_PF_ALIGN`) is the

View file

@ -34,13 +34,10 @@ Interface changes
in a :ref:`pool-mv` pool, by passing the :c:macro:`MPS_KEY_ALIGN`
keyword argument to :c:func:`mps_pool_create_k`.
#. It is now possible to specify any alignment for :ref:`pool-mvff`
and :ref:`pool-mvt` pools. Alignments smaller than
``sizeof(void *)`` are rounded up automatically. This means that on
the platforms ``w3i3mv`` and ``w3i6mv``, where
:c:macro:`MPS_PF_ALIGN` is larger than ``sizeof(void *)``, it is
now possible to specify the latter as the alignment for these
pools.
#. The alignment requirements for :ref:`pool-mvff` and :ref:`pool-mvt`
pools have been relaxed on the platforms ``w3i3mv`` and ``w3i6mv``.
On all platforms it is now possible to specify alignments down to
``sizeof(void *)`` as the alignment for pools of these classes.
Other changes