diff --git a/mps/code/poolmv2.c b/mps/code/poolmv2.c index e134f0737be..0a700f401b7 100644 --- a/mps/code/poolmv2.c +++ b/mps/code/poolmv2.c @@ -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 . + */ + 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 . - */ - align = AlignAlignUp(align, FreelistMinimumAlignment); - /* see */ fillSize = SizeAlignUp(maxSize, ArenaAlign(arena)); /* see */ diff --git a/mps/code/poolmvff.c b/mps/code/poolmvff.c index 37215540c35..ecb99d441c8 100644 --- a/mps/code/poolmvff.c +++ b/mps/code/poolmvff.c @@ -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. . */ - align = AlignAlignUp(align, FreelistMinimumAlignment); + AVER(AlignIsAligned(align, FreelistMinimumAlignment)); + AVERT(Bool, slotHigh); + AVERT(Bool, arenaHigh); + AVERT(Bool, firstFit); mvff = Pool2MVFF(pool); diff --git a/mps/manual/source/pool/intro.rst b/mps/manual/source/pool/intro.rst index b44fea4de98..53caa616c59 100644 --- a/mps/manual/source/pool/intro.rst +++ b/mps/manual/source/pool/intro.rst @@ -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 diff --git a/mps/manual/source/pool/mvff.rst b/mps/manual/source/pool/mvff.rst index 199b56f0a28..02721fc1e20 100644 --- a/mps/manual/source/pool/mvff.rst +++ b/mps/manual/source/pool/mvff.rst @@ -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 diff --git a/mps/manual/source/pool/mvt.rst b/mps/manual/source/pool/mvt.rst index 351adc9ff8f..4f89b8d5178 100644 --- a/mps/manual/source/pool/mvt.rst +++ b/mps/manual/source/pool/mvt.rst @@ -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 diff --git a/mps/manual/source/release.rst b/mps/manual/source/release.rst index 71e88e48c9f..a5ece72768e 100644 --- a/mps/manual/source/release.rst +++ b/mps/manual/source/release.rst @@ -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