mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-11 08:42:35 +03:00
Fix iterations through arenas
This commit is contained in:
parent
19154a5478
commit
7d2ea7665f
|
@ -195,13 +195,13 @@ typedef struct ImagingMemoryArena {
|
||||||
* will allocate a set of arenas and associated them with threads one at a time.
|
* will allocate a set of arenas and associated them with threads one at a time.
|
||||||
*/
|
*/
|
||||||
#define IMAGING_ARENAS_COUNT 8
|
#define IMAGING_ARENAS_COUNT 8
|
||||||
extern struct ImagingMemoryArena ImagingArenas[IMAGING_ARENAS_COUNT];
|
extern struct ImagingMemoryArena ImagingArenas[IMAGING_ARENAS_COUNT+1];
|
||||||
|
|
||||||
/* Provide a macro that loops through each arena that has been
|
/* Provide a macro that loops through each arena that has been
|
||||||
* statically-allocated. This is necessary to properly handle stats.
|
* statically-allocated. This is necessary to properly handle stats.
|
||||||
*/
|
*/
|
||||||
#define IMAGING_ARENAS_FOREACH(arena) \
|
#define IMAGING_ARENAS_FOREACH(arena) \
|
||||||
for ((arena) = &ImagingArenas[0]; arena->block_size; ++(arena))
|
for ((arena) = &ImagingArenas[0]; (arena)->alignment >= 0; ++(arena))
|
||||||
#else
|
#else
|
||||||
/* In this case we either have the GIL or do not have thread-local storage, in
|
/* In this case we either have the GIL or do not have thread-local storage, in
|
||||||
* which case we will only allocate a single arena.
|
* which case we will only allocate a single arena.
|
||||||
|
|
|
@ -273,7 +273,7 @@ static uint64_t ImagingArenaIndex = 0;
|
||||||
static IMAGING_TLS uint64_t ImagingArenaThreadIndex = UINT64_MAX;
|
static IMAGING_TLS uint64_t ImagingArenaThreadIndex = UINT64_MAX;
|
||||||
|
|
||||||
/* These are the statically-allocated arenas. */
|
/* These are the statically-allocated arenas. */
|
||||||
struct ImagingMemoryArena ImagingArenas[IMAGING_ARENAS_COUNT] = {
|
struct ImagingMemoryArena ImagingArenas[IMAGING_ARENAS_COUNT+1] = {
|
||||||
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 0, {0}},
|
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 0, {0}},
|
||||||
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 1, {0}},
|
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 1, {0}},
|
||||||
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 2, {0}},
|
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 2, {0}},
|
||||||
|
@ -282,7 +282,7 @@ struct ImagingMemoryArena ImagingArenas[IMAGING_ARENAS_COUNT] = {
|
||||||
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 5, {0}},
|
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 5, {0}},
|
||||||
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 6, {0}},
|
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 6, {0}},
|
||||||
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 7, {0}},
|
{1, IMAGING_ARENA_BLOCK_SIZE, 0, 0, NULL, 0, 0, 0, 0, 0, 7, {0}},
|
||||||
{0}
|
{-1},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Get a pointer to the correct arena for this context. In this case where we
|
/* Get a pointer to the correct arena for this context. In this case where we
|
||||||
|
|
Loading…
Reference in New Issue
Block a user