1
0
mirror of https://github.com/deadw00d/AROS.git synced 2026-03-17 17:09:26 +00:00

Name change from ALLOCPOOLED_USER_OFFSET to MEMPOOL_WORSTALIGN and let it be at least 8, and AROS_WORSTALIGN if that is larger.

This commit is contained in:
Johan Gill
2025-09-08 22:25:59 +02:00
parent d1a0445080
commit 92980dde37
3 changed files with 8 additions and 9 deletions

View File

@ -88,14 +88,14 @@
/*
* puddleSize needs to include MEMHEADER_TOTAL, allocator context size and
* ALLOCPOOLED_USER_OFFSET.
* MEMPOOL_WORSTALIGN.
* This is because our puddles must be able to accommodate an allocation
* of own size. Allocations of larger size will always use enlarged puddles.
* Pointer is used for pointing back to the MemHeader from which the block
* was allocated, in AllocVec()-alike manner. This way we get rid of slow
* lookup in FreePooled().
*/
puddleSize += MEMHEADER_TOTAL + mhac_GetCtxSize() + ALLOCPOOLED_USER_OFFSET;
puddleSize += MEMHEADER_TOTAL + mhac_GetCtxSize() + MEMPOOL_WORSTALIGN;
/* If mungwall is enabled, count also size of walls, at least for one allocation */
if (PrivExecBase(SysBase)->IntFlags & EXECF_MungWall)

View File

@ -934,7 +934,7 @@ APTR InternalAllocPooled(APTR poolHeader, IPTR memSize, ULONG flags, struct Trac
* This is done in AllocVec()-alike manner; the pointer is placed before the block.
* The Amiga platform has extra padding to not destroy the alignment.
*/
memSize += ALLOCPOOLED_USER_OFFSET;
memSize += MEMPOOL_WORSTALIGN;
origSize = memSize;
/* If mungwall is enabled, count also size of walls */
@ -1062,7 +1062,7 @@ APTR InternalAllocPooled(APTR poolHeader, IPTR memSize, ULONG flags, struct Trac
/* Remember where we were allocated from */
*((struct MemHeader **)ret) = mh;
ret += ALLOCPOOLED_USER_OFFSET;
ret += MEMPOOL_WORSTALIGN;
}
/* Everything fine */
@ -1088,8 +1088,8 @@ void InternalFreePooled(APTR poolHeader, APTR memory, IPTR memSize, struct Trace
if (!memory || !memSize) return;
/* Get MemHeader pointer. It is stored right before our block. */
freeStart = memory - ALLOCPOOLED_USER_OFFSET;
freeSize = memSize + ALLOCPOOLED_USER_OFFSET;
freeStart = memory - MEMPOOL_WORSTALIGN;
freeSize = memSize + MEMPOOL_WORSTALIGN;
mh = *((struct MemHeader **)freeStart);
/* Check walls first */

View File

@ -32,10 +32,9 @@
/* On AGA Amigas, AmiBlitz 3 allocation of wide sprites relies on that AllocPooled
* returns at least eight byte aligned memory.
* Testing AmigaOS 3.1 on WinUAE with A600 and A1200 setups did not reproduce any
* AllocPooled results without eight bytes alignment, so it should be a decent
* approach to align to eight bytes.
* AllocPooled results with less than eight bytes alignment.
*/
#define ALLOCPOOLED_USER_OFFSET 8
#define MEMPOOL_WORSTALIGN (AROS_WORSTALIGN > 8 ? AROS_WORSTALIGN : 8)
/* Private Pool structure */
struct Pool