Skip to content

Commit 1b2d106

Browse files
committed
Use macro defs for exports as done in python#31164
1 parent 06815d8 commit 1b2d106

File tree

8 files changed

+346
-27
lines changed

8 files changed

+346
-27
lines changed

Include/internal/pycore_mimalloc.h

Lines changed: 301 additions & 0 deletions
Large diffs are not rendered by default.

Include/mimalloc/mimalloc/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ struct mi_heap_s {
524524
#define MI_DEBUG_UNINIT (0xD0)
525525
#endif
526526
#if !defined(MI_DEBUG_FREED)
527-
#define MI_DEBUG_FREED (0xDD)
527+
#define MI_DEBUG_FREED (0xDF)
528528
#endif
529529
#if !defined(MI_DEBUG_PADDING)
530530
#define MI_DEBUG_PADDING (0xDE)

Makefile.pre.in

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -341,30 +341,14 @@ IO_OBJS= \
341341
# mimalloc
342342

343343
MIMALLOC_HEADERS= \
344+
$(srcdir)/Include/internal/pycore_mimalloc.h \
344345
$(srcdir)/Include/mimalloc/mimalloc.h \
345346
$(srcdir)/Include/mimalloc/mimalloc/atomic.h \
346347
$(srcdir)/Include/mimalloc/mimalloc/internal.h \
347348
$(srcdir)/Include/mimalloc/mimalloc/prim.h \
348349
$(srcdir)/Include/mimalloc/mimalloc/track.h \
349350
$(srcdir)/Include/mimalloc/mimalloc/types.h
350351

351-
MIMALLOC_OBJS= \
352-
Objects/mimalloc/alloc-aligned.o \
353-
Objects/mimalloc/alloc-posix.o \
354-
Objects/mimalloc/alloc.o \
355-
Objects/mimalloc/arena.o \
356-
Objects/mimalloc/bitmap.o \
357-
Objects/mimalloc/heap.o \
358-
Objects/mimalloc/init.o \
359-
Objects/mimalloc/options.o \
360-
Objects/mimalloc/os.o \
361-
Objects/mimalloc/page.o \
362-
Objects/mimalloc/random.o \
363-
Objects/mimalloc/segment.o \
364-
Objects/mimalloc/segment-map.o \
365-
Objects/mimalloc/stats.o \
366-
Objects/mimalloc/prim/prim.o
367-
368352

369353
##########################################################################
370354
# Parser
@@ -520,7 +504,6 @@ OBJECT_OBJS= \
520504
Objects/unicodectype.o \
521505
Objects/unionobject.o \
522506
Objects/weakrefobject.o \
523-
@MIMALLOC_OBJS@ \
524507
@PERF_TRAMPOLINE_OBJ@
525508

526509
##########################################################################

Objects/mimalloc/static.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* ----------------------------------------------------------------------------
2+
Copyright (c) 2018-2020, Microsoft Research, Daan Leijen
3+
This is free software; you can redistribute it and/or modify it under the
4+
terms of the MIT license. A copy of the license can be found in the file
5+
"LICENSE" at the root of this distribution.
6+
-----------------------------------------------------------------------------*/
7+
#ifndef _DEFAULT_SOURCE
8+
#define _DEFAULT_SOURCE
9+
#endif
10+
#if defined(__sun)
11+
// same remarks as os.c for the static's context.
12+
#undef _XOPEN_SOURCE
13+
#undef _POSIX_C_SOURCE
14+
#endif
15+
16+
#include "mimalloc.h"
17+
#include "mimalloc/internal.h"
18+
19+
// For a static override we create a single object file
20+
// containing the whole library. If it is linked first
21+
// it will override all the standard library allocation
22+
// functions (on Unix's).
23+
#include "alloc.c" // includes alloc-override.c
24+
#include "alloc-aligned.c"
25+
#include "alloc-posix.c"
26+
#include "arena.c"
27+
#include "bitmap.c"
28+
#include "heap.c"
29+
#include "init.c"
30+
#include "options.c"
31+
#include "os.c"
32+
#include "page.c" // includes page-queue.c
33+
#include "random.c"
34+
#include "segment.c"
35+
#include "segment-map.c"
36+
#include "stats.c"
37+
#include "prim/prim.c"
38+
#if MI_OSX_ZONE
39+
#include "prim/osx/alloc-override-zone.c"
40+
#endif

Objects/obmalloc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include <stdlib.h> // malloc()
1212
#include <stdbool.h>
1313
#ifdef WITH_MIMALLOC
14-
#include "mimalloc.h"
14+
#include "pycore_mimalloc.h"
15+
#include "mimalloc/static.c"
1516
#include "mimalloc/internal.h" // for stats
1617
#endif
1718

Tools/build/smelly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import sysconfig
88

99

10-
ALLOWED_PREFIXES = ('Py', '_Py', 'mi_', '_mi_')
10+
ALLOWED_PREFIXES = ('Py', '_Py')
1111
if sys.platform == 'darwin':
1212
ALLOWED_PREFIXES += ('__Py',)
1313

configure

Lines changed: 0 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4548,13 +4548,11 @@ if test "$with_mimalloc" != no; then
45484548
with_mimalloc=yes
45494549
AC_DEFINE([WITH_MIMALLOC], [1], [Define if you want to compile in mimalloc memory allocator.])
45504550
AC_SUBST([MIMALLOC_HEADERS], ['$(MIMALLOC_HEADERS)'])
4551-
AC_SUBST([MIMALLOC_OBJS], ['$(MIMALLOC_OBJS)'])
45524551
fi
45534552

45544553
AC_MSG_RESULT([$with_mimalloc])
45554554
AC_SUBST([WITH_MIMALLOC])
45564555
AC_SUBST([MIMALLOC_HEADERS])
4557-
AC_SUBST([MIMALLOC_OBJS])
45584556

45594557
# Check for Python-specific malloc support
45604558
AC_MSG_CHECKING([for --with-pymalloc])

0 commit comments

Comments
 (0)