Skip to content

Commit 5d26f85

Browse files
naschemeneonene
andauthored
[3.10] gh-94841: Ensure arena_map_get() is inlined in PyObject_Free() (GH-94842)
Need to define ALWAYS_INLINE macro for 3.10. Co-authored-by: neonene <[email protected]>
1 parent 1cf0305 commit 5d26f85

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the possible performance regression of :c:func:`PyObject_Free` compiled with MSVC version 1932.

Objects/obmalloc.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -1397,9 +1397,19 @@ static int arena_map_bot_count;
13971397
static arena_map_bot_t arena_map_root;
13981398
#endif
13991399

1400+
#if defined(Py_DEBUG)
1401+
# define ALWAYS_INLINE
1402+
#elif defined(__GNUC__) || defined(__clang__) || defined(__INTEL_COMPILER)
1403+
# define ALWAYS_INLINE __attribute__((always_inline))
1404+
#elif defined(_MSC_VER)
1405+
# define ALWAYS_INLINE __forceinline
1406+
#else
1407+
# define ALWAYS_INLINE
1408+
#endif
1409+
14001410
/* Return a pointer to a bottom tree node, return NULL if it doesn't exist or
14011411
* it cannot be created */
1402-
static arena_map_bot_t *
1412+
static ALWAYS_INLINE arena_map_bot_t *
14031413
arena_map_get(block *p, int create)
14041414
{
14051415
#ifdef USE_INTERIOR_NODES

0 commit comments

Comments
 (0)