change atomic initializer in pool_global Patch backported to 0.21.3 from https://github.com/ponylang/ponyc/pull/2668 --- a/src/libponyrt/mem/pool.c +++ b/src/libponyrt/mem/pool.c @@ -97,24 +97,30 @@ #define THREAD_MAX_BEFORE_SHARE(MAX_MEM, SIZE) \ (((MAX_MEM / SIZE)>=(1))?(MAX_MEM / SIZE):(1)) +#ifdef PLATFORM_IS_X86 +# define POOL_CENTRAL_INIT {{NULL, 0}} +#else +# define POOL_CENTRAL_INIT NULL +#endif + static pool_global_t pool_global[POOL_COUNT] = { - {POOL_MIN << 0, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 0), {{NULL, 0}}}, - {POOL_MIN << 1, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 1), {{NULL, 0}}}, - {POOL_MIN << 2, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 2), {{NULL, 0}}}, - {POOL_MIN << 3, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 3), {{NULL, 0}}}, - {POOL_MIN << 4, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 4), {{NULL, 0}}}, - {POOL_MIN << 5, THREAD_MAX_BEFORE_SHARE(0x10000, POOL_MIN << 5), {{NULL, 0}}}, - {POOL_MIN << 6, THREAD_MAX_BEFORE_SHARE(0x20000, POOL_MIN << 6), {{NULL, 0}}}, - {POOL_MIN << 7, THREAD_MAX_BEFORE_SHARE(0x40000, POOL_MIN << 7), {{NULL, 0}}}, - {POOL_MIN << 8, THREAD_MAX_BEFORE_SHARE(0x80000, POOL_MIN << 8), {{NULL, 0}}}, - {POOL_MIN << 9, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 9), {{NULL, 0}}}, - {POOL_MIN << 10, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 10), {{NULL, 0}}}, - {POOL_MIN << 11, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 11), {{NULL, 0}}}, - {POOL_MIN << 12, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 12), {{NULL, 0}}}, - {POOL_MIN << 13, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 13), {{NULL, 0}}}, - {POOL_MIN << 14, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 14), {{NULL, 0}}}, - {POOL_MIN << 15, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 15), {{NULL, 0}}}, + {POOL_MIN << 0, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 0), POOL_CENTRAL_INIT}, + {POOL_MIN << 1, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 1), POOL_CENTRAL_INIT}, + {POOL_MIN << 2, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 2), POOL_CENTRAL_INIT}, + {POOL_MIN << 3, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 3), POOL_CENTRAL_INIT}, + {POOL_MIN << 4, THREAD_MAX_BEFORE_SHARE(0x8000, POOL_MIN << 4), POOL_CENTRAL_INIT}, + {POOL_MIN << 5, THREAD_MAX_BEFORE_SHARE(0x10000, POOL_MIN << 5), POOL_CENTRAL_INIT}, + {POOL_MIN << 6, THREAD_MAX_BEFORE_SHARE(0x20000, POOL_MIN << 6), POOL_CENTRAL_INIT}, + {POOL_MIN << 7, THREAD_MAX_BEFORE_SHARE(0x40000, POOL_MIN << 7), POOL_CENTRAL_INIT}, + {POOL_MIN << 8, THREAD_MAX_BEFORE_SHARE(0x80000, POOL_MIN << 8), POOL_CENTRAL_INIT}, + {POOL_MIN << 9, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 9), POOL_CENTRAL_INIT}, + {POOL_MIN << 10, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 10), POOL_CENTRAL_INIT}, + {POOL_MIN << 11, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 11), POOL_CENTRAL_INIT}, + {POOL_MIN << 12, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 12), POOL_CENTRAL_INIT}, + {POOL_MIN << 13, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 13), POOL_CENTRAL_INIT}, + {POOL_MIN << 14, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 14), POOL_CENTRAL_INIT}, + {POOL_MIN << 15, THREAD_MAX_BEFORE_SHARE(POOL_MAX, POOL_MIN << 15), POOL_CENTRAL_INIT}, }; static pool_block_t pool_block_global;