Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:mcepl:branches:devel:languages:python:Factory
python36
align-allocations-PyGC_Head.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File align-allocations-PyGC_Head.patch of Package python36
From f499b12ed3026f2188fffd9642cb58ef23d2007f Mon Sep 17 00:00:00 2001 From: Inada Naoki <songofacandy@gmail.com> Date: Mon, 3 Jun 2019 10:51:32 +0900 Subject: [PATCH] align allocations and PyGC_Head to 16 bytes on 64-bit platforms Combination of two upstream commits: - gh#python/cpython@1b85f4ec45a5 (3.7.17) - gh#python/cpython@8766cb74e186 (3.7.17) Fixes: bpo#27987 Fixes: rh#1923658 Patch: align-allocations-PyGC_Head.patch --- Include/objimpl.h | 6 +++++- Objects/obmalloc.c | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Include/objimpl.h b/Include/objimpl.h index e7a3696d7a1..90d71b87ea1 100644 --- a/Include/objimpl.h +++ b/Include/objimpl.h @@ -255,7 +255,11 @@ typedef union _gc_head { union _gc_head *gc_prev; Py_ssize_t gc_refs; } gc; - double dummy; /* force worst-case alignment */ + long double dummy; /* force worst-case alignment */ + // malloc returns memory block aligned for any built-in types and + // long double is the largest standard C type. + // On amd64 linux, long double requires 16 byte alignment. + // See bpo-27987 for more discussion. } PyGC_Head; extern PyGC_Head *_PyGC_generation0; diff --git a/Objects/obmalloc.c b/Objects/obmalloc.c index d46d1493110..47283354f4c 100644 --- a/Objects/obmalloc.c +++ b/Objects/obmalloc.c @@ -650,8 +650,14 @@ static int running_on_valgrind = -1; * * 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_SHIFT 3 +#endif /* Return the number of bytes in size class I, as a uint. */ #define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT) -- 2.46.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor