Commit f24a9f3b authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-27987: pymalloc: align by 16bytes on 64bit platform (GH-12850) (GH-13319)

(cherry picked from commit f0be4bbb)
parent 353f8d22
pymalloc returns memory blocks aligned by 16 bytes, instead of 8 bytes, on
64-bit platforms to conform x86-64 ABI. Recent compilers assume this alignment
more often. Patch by Inada Naoki.
...@@ -154,8 +154,14 @@ static int running_on_valgrind = -1; ...@@ -154,8 +154,14 @@ static int running_on_valgrind = -1;
* *
* You shouldn't change this unless you know what you are doing. * You shouldn't change this unless you know what you are doing.
*/ */
#if SIZEOF_VOID_P > 4
#define ALIGNMENT 16 /* must be 2^N */
#define ALIGNMENT_SHIFT 4
#else
#define ALIGNMENT 8 /* must be 2^N */ #define ALIGNMENT 8 /* must be 2^N */
#define ALIGNMENT_SHIFT 3 #define ALIGNMENT_SHIFT 3
#endif
#define ALIGNMENT_MASK (ALIGNMENT - 1) #define ALIGNMENT_MASK (ALIGNMENT - 1)
/* Return the number of bytes in size class I, as a uint. */ /* Return the number of bytes in size class I, as a uint. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment