@@ -114,20 +114,20 @@ static jl_array_t *_new_array_(jl_value_t *atype, uint32_t ndims, size_t *dims,
114114 }
115115
116116 int ndimwords = jl_array_ndimwords (ndims );
117- int tsz = JL_ARRAY_ALIGN ( sizeof (jl_array_t ) + ndimwords * sizeof (size_t ), JL_CACHE_BYTE_ALIGNMENT );
117+ int tsz = sizeof (jl_array_t ) + ndimwords * sizeof (size_t );
118118 if (tot <= ARRAY_INLINE_NBYTES ) {
119119 if (isunboxed && elsz >= 4 )
120120 tsz = JL_ARRAY_ALIGN (tsz , JL_SMALL_BYTE_ALIGNMENT ); // align data area
121121 size_t doffs = tsz ;
122122 tsz += tot ;
123- tsz = JL_ARRAY_ALIGN ( tsz , JL_SMALL_BYTE_ALIGNMENT ); // align whole object
123+ // jl_array_t is large enough that objects will always be aligned 16
124124 a = (jl_array_t * )jl_gc_alloc (ct -> ptls , tsz , atype );
125+ assert (((size_t )a & 15 ) == 0 );
125126 // No allocation or safepoint allowed after this
126127 a -> flags .how = 0 ;
127128 data = (char * )a + doffs ;
128129 }
129130 else {
130- tsz = JL_ARRAY_ALIGN (tsz , JL_CACHE_BYTE_ALIGNMENT ); // align whole object
131131 data = jl_gc_managed_malloc (tot );
132132 // Allocate the Array **after** allocating the data
133133 // to make sure the array is still young
@@ -223,7 +223,7 @@ JL_DLLEXPORT jl_array_t *jl_reshape_array(jl_value_t *atype, jl_array_t *data,
223223 assert (jl_types_equal (jl_tparam0 (jl_typeof (data )), jl_tparam0 (atype )));
224224
225225 int ndimwords = jl_array_ndimwords (ndims );
226- int tsz = JL_ARRAY_ALIGN ( sizeof (jl_array_t ) + ndimwords * sizeof (size_t ) + sizeof (void * ), JL_SMALL_BYTE_ALIGNMENT );
226+ int tsz = sizeof (jl_array_t ) + ndimwords * sizeof (size_t ) + sizeof (void * );
227227 a = (jl_array_t * )jl_gc_alloc (ct -> ptls , tsz , atype );
228228 // No allocation or safepoint allowed after this
229229 a -> flags .pooled = tsz <= GC_MAX_SZCLASS ;
@@ -304,7 +304,7 @@ JL_DLLEXPORT jl_array_t *jl_string_to_array(jl_value_t *str)
304304 jl_array_t * a ;
305305
306306 int ndimwords = jl_array_ndimwords (1 );
307- int tsz = JL_ARRAY_ALIGN ( sizeof (jl_array_t ) + ndimwords * sizeof (size_t ) + sizeof (void * ), JL_SMALL_BYTE_ALIGNMENT );
307+ int tsz = sizeof (jl_array_t ) + ndimwords * sizeof (size_t ) + sizeof (void * );
308308 a = (jl_array_t * )jl_gc_alloc (ct -> ptls , tsz , jl_array_uint8_type );
309309 a -> flags .pooled = tsz <= GC_MAX_SZCLASS ;
310310 a -> flags .ndims = 1 ;
@@ -351,7 +351,7 @@ JL_DLLEXPORT jl_array_t *jl_ptr_to_array_1d(jl_value_t *atype, void *data,
351351 "unsafe_wrap: pointer %p is not properly aligned to %u bytes" , data , align );
352352
353353 int ndimwords = jl_array_ndimwords (1 );
354- int tsz = JL_ARRAY_ALIGN ( sizeof (jl_array_t ) + ndimwords * sizeof (size_t ), JL_CACHE_BYTE_ALIGNMENT );
354+ int tsz = sizeof (jl_array_t ) + ndimwords * sizeof (size_t );
355355 a = (jl_array_t * )jl_gc_alloc (ct -> ptls , tsz , atype );
356356 // No allocation or safepoint allowed after this
357357 a -> flags .pooled = tsz <= GC_MAX_SZCLASS ;
@@ -418,7 +418,7 @@ JL_DLLEXPORT jl_array_t *jl_ptr_to_array(jl_value_t *atype, void *data,
418418 "unsafe_wrap: pointer %p is not properly aligned to %u bytes" , data , align );
419419
420420 int ndimwords = jl_array_ndimwords (ndims );
421- int tsz = JL_ARRAY_ALIGN ( sizeof (jl_array_t ) + ndimwords * sizeof (size_t ), JL_CACHE_BYTE_ALIGNMENT );
421+ int tsz = sizeof (jl_array_t ) + ndimwords * sizeof (size_t );
422422 a = (jl_array_t * )jl_gc_alloc (ct -> ptls , tsz , atype );
423423 // No allocation or safepoint allowed after this
424424 a -> flags .pooled = tsz <= GC_MAX_SZCLASS ;
0 commit comments