diff --git a/src/julia.h b/src/julia.h index 7bcce4bd07cb4..047611ef65349 100644 --- a/src/julia.h +++ b/src/julia.h @@ -19,7 +19,7 @@ #include #ifndef _OS_WINDOWS_ # define jl_jmp_buf sigjmp_buf -# if defined(_CPU_ARM_) +# if defined(_CPU_ARM_) || defined(_CPU_PPC_) # define MAX_ALIGN 8 # elif defined(_CPU_AARCH64_) // int128 is 16 bytes aligned on aarch64 diff --git a/src/julia_internal.h b/src/julia_internal.h index fcc29f42b1791..db4a2f97383e8 100644 --- a/src/julia_internal.h +++ b/src/julia_internal.h @@ -54,6 +54,10 @@ void *jl_gc_perm_alloc(size_t sz); static const int jl_gc_sizeclasses[JL_GC_N_POOLS] = { #ifdef _P64 8, +#elif defined(_CPU_ARM_) || defined(_CPU_PPC_) + // ARM and PowerPC has max alignment of 8, + // make sure allocation of size 8 has that alignment. + 4, 8, #else 4, 8, 12, #endif @@ -87,6 +91,10 @@ STATIC_INLINE int JL_CONST_FUNC jl_gc_szclass(size_t sz) if (sz <= 8) return 0; const int N = 0; +#elif defined(_CPU_ARM_) || defined(_CPU_PPC_) + if (sz <= 8) + return (sz + 3) / 4 - 1; + const int N = 1; #else if (sz <= 12) return (sz + 3) / 4 - 1; diff --git a/src/julia_threads.h b/src/julia_threads.h index 50a9bc36c2820..e18eb7283e1d4 100644 --- a/src/julia_threads.h +++ b/src/julia_threads.h @@ -55,9 +55,11 @@ typedef struct { // variables for allocating objects from pools #ifdef _P64 -#define JL_GC_N_POOLS 41 +# define JL_GC_N_POOLS 41 +#elif defined(_CPU_ARM_) || defined(_CPU_PPC_) +# define JL_GC_N_POOLS 42 #else -#define JL_GC_N_POOLS 43 +# define JL_GC_N_POOLS 43 #endif jl_gc_pool_t norm_pools[JL_GC_N_POOLS]; } jl_thread_heap_t;