mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-25 20:14:12 +08:00
Merge branch 'dev' into dev-slice
This commit is contained in:
commit
998401b6d7
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -10,4 +10,3 @@
|
|||||||
*.dll binary
|
*.dll binary
|
||||||
*.lib binary
|
*.lib binary
|
||||||
*.exe binary
|
*.exe binary
|
||||||
bin export-ignore
|
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@ ide/vs20??/VTune*
|
|||||||
out/
|
out/
|
||||||
docs/
|
docs/
|
||||||
*.zip
|
*.zip
|
||||||
|
*.tar
|
||||||
|
*.gz
|
||||||
|
28
docker/alpine-arm32v7/Dockerfile
Normal file
28
docker/alpine-arm32v7/Dockerfile
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
# install from an image
|
||||||
|
# download first an appropiate tar.gz image into the current directory
|
||||||
|
# from: <https://github.com/alpinelinux/docker-alpine/tree/edge/armv7>
|
||||||
|
FROM scratch
|
||||||
|
|
||||||
|
# Substitute the image name that was downloaded
|
||||||
|
ADD alpine-minirootfs-20240329-armv7.tar.gz /
|
||||||
|
|
||||||
|
# Install tools
|
||||||
|
RUN apk add build-base make cmake
|
||||||
|
RUN apk add git
|
||||||
|
RUN apk add vim
|
||||||
|
|
||||||
|
RUN mkdir -p /home/dev
|
||||||
|
WORKDIR /home/dev
|
||||||
|
|
||||||
|
# Get mimalloc
|
||||||
|
RUN git clone https://github.com/microsoft/mimalloc -b dev-slice
|
||||||
|
RUN mkdir -p mimalloc/out/release
|
||||||
|
RUN mkdir -p mimalloc/out/debug
|
||||||
|
|
||||||
|
# Build mimalloc debug
|
||||||
|
WORKDIR /home/dev/mimalloc/out/debug
|
||||||
|
RUN cmake ../.. -DMI_DEBUG_FULL=ON
|
||||||
|
RUN make -j
|
||||||
|
RUN make test
|
||||||
|
|
||||||
|
CMD ["/bin/sh"]
|
23
docker/alpine/Dockerfile
Normal file
23
docker/alpine/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# alpine image
|
||||||
|
FROM alpine
|
||||||
|
|
||||||
|
# Install tools
|
||||||
|
RUN apk add build-base make cmake
|
||||||
|
RUN apk add git
|
||||||
|
RUN apk add vim
|
||||||
|
|
||||||
|
RUN mkdir -p /home/dev
|
||||||
|
WORKDIR /home/dev
|
||||||
|
|
||||||
|
# Get mimalloc
|
||||||
|
RUN git clone https://github.com/microsoft/mimalloc -b dev-slice
|
||||||
|
RUN mkdir -p mimalloc/out/release
|
||||||
|
RUN mkdir -p mimalloc/out/debug
|
||||||
|
|
||||||
|
# Build mimalloc debug
|
||||||
|
WORKDIR /home/dev/mimalloc/out/debug
|
||||||
|
RUN cmake ../.. -DMI_DEBUG_FULL=ON
|
||||||
|
RUN make -j
|
||||||
|
RUN make test
|
||||||
|
|
||||||
|
CMD ["/bin/sh"]
|
23
docker/manylinux-x64/Dockerfile
Normal file
23
docker/manylinux-x64/Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
FROM quay.io/pypa/manylinux2014_x86_64
|
||||||
|
|
||||||
|
# Install tools
|
||||||
|
RUN yum install -y openssl-devel
|
||||||
|
RUN yum install -y gcc gcc-c++ kernel-devel make
|
||||||
|
RUN yum install -y git cmake
|
||||||
|
RUN yum install -y vim
|
||||||
|
|
||||||
|
RUN mkdir -p /home/dev
|
||||||
|
WORKDIR /home/dev
|
||||||
|
|
||||||
|
# Get mimalloc
|
||||||
|
RUN git clone https://github.com/microsoft/mimalloc -b dev-slice
|
||||||
|
RUN mkdir -p mimalloc/out/release
|
||||||
|
RUN mkdir -p mimalloc/out/debug
|
||||||
|
|
||||||
|
# Build mimalloc debug
|
||||||
|
WORKDIR /home/dev/mimalloc/out/debug
|
||||||
|
RUN cmake ../.. -DMI_DEBUG_FULL=ON
|
||||||
|
RUN make -j
|
||||||
|
RUN make test
|
||||||
|
|
||||||
|
CMD ["/bin/sh"]
|
10
docker/readme.md
Normal file
10
docker/readme.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Various example docker files used for testing.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
```
|
||||||
|
> cd <host>
|
||||||
|
> docker build -t <host>-mimalloc .
|
||||||
|
> docker run -it <host>-mimalloc
|
||||||
|
>> make test
|
||||||
|
```
|
@ -198,7 +198,7 @@ static inline void mi_prim_tls_slot_set(size_t slot, void* value) mi_attr_noexce
|
|||||||
tcb[slot] = value;
|
tcb[slot] = value;
|
||||||
#elif defined(__APPLE__) && defined(__POWERPC__) // ppc, issue #781
|
#elif defined(__APPLE__) && defined(__POWERPC__) // ppc, issue #781
|
||||||
MI_UNUSED(ofs);
|
MI_UNUSED(ofs);
|
||||||
pthread_setspecific(slot, value);
|
pthread_setspecific(slot, value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,13 +208,18 @@ static inline void mi_prim_tls_slot_set(size_t slot, void* value) mi_attr_noexce
|
|||||||
// but unfortunately, it seems we cannot test for this reliably at this time (see issue #883)
|
// but unfortunately, it seems we cannot test for this reliably at this time (see issue #883)
|
||||||
// Nevertheless, it seems needed on older graviton platforms (see issue #851).
|
// Nevertheless, it seems needed on older graviton platforms (see issue #851).
|
||||||
// For now, we only enable this for specific platforms.
|
// For now, we only enable this for specific platforms.
|
||||||
#if defined(__GNUC__) && (__GNUC__ >= 7) && defined(__aarch64__) /* special case aarch64 for older gcc versions (issue #851) */ \
|
#if !defined(__APPLE__) /* on apple (M1) the wrong register is read (tpidr_el0 instead of tpidrro_el0) so fall back to TLS slot assembly (<https://github.com/microsoft/mimalloc/issues/343#issuecomment-763272369>)*/ \
|
||||||
&& !defined(__APPLE__) /* on apple (M1) the wrong register is read (tpidr_el0 instead of tpidrro_el0) so fall back to TLS slot assembly (<https://github.com/microsoft/mimalloc/issues/343#issuecomment-763272369>)*/ \
|
&& !defined(MI_LIBC_MUSL) \
|
||||||
&& (!defined(__clang_major__) || __clang_major__ >= 14) /* older clang versions emit bad code; fall back to using the TLS slot (<https://lore.kernel.org/linux-arm-kernel/202110280952.352F66D8@keescook/T/>) */
|
&& (!defined(__clang_major__) || __clang_major__ >= 14) /* older clang versions emit bad code; fall back to using the TLS slot (<https://lore.kernel.org/linux-arm-kernel/202110280952.352F66D8@keescook/T/>) */
|
||||||
#define MI_USE_BUILTIN_THREAD_POINTER 1
|
#if (defined(__GNUC__) && (__GNUC__ >= 7) && defined(__aarch64__)) /* aarch64 for older gcc versions (issue #851) */ \
|
||||||
|
|| (defined(__GNUC__) && (__GNUC__ >= 11) && defined(__x86_64__)) \
|
||||||
|
|| (defined(__clang_major__) && (__clang_major__ >= 14) && (defined(__aarch64__) || defined(__x86_64__)))
|
||||||
|
#define MI_USE_BUILTIN_THREAD_POINTER 1
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// defined in `init.c`; do not use these directly
|
// defined in `init.c`; do not use these directly
|
||||||
extern mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate from
|
extern mi_decl_thread mi_heap_t* _mi_heap_default; // default heap to allocate from
|
||||||
extern bool _mi_process_is_initialized; // has mi_process_init been called?
|
extern bool _mi_process_is_initialized; // has mi_process_init been called?
|
||||||
@ -239,11 +244,11 @@ static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
|
|||||||
return (uintptr_t)NtCurrentTeb();
|
return (uintptr_t)NtCurrentTeb();
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif MI_USE_BUILTIN_THREAD_POINTER
|
#elif MI_USE_BUILTIN_THREAD_POINTER
|
||||||
|
|
||||||
static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
|
static inline mi_threadid_t _mi_prim_thread_id(void) mi_attr_noexcept {
|
||||||
// Works on most Unix based platforms with recent compilers
|
// Works on most Unix based platforms with recent compilers
|
||||||
return (uintptr_t)__builtin_thread_pointer();
|
return (uintptr_t)__builtin_thread_pointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(MI_HAS_TLS_SLOT)
|
#elif defined(MI_HAS_TLS_SLOT)
|
||||||
|
@ -422,6 +422,7 @@ __attribute__((constructor(0)))
|
|||||||
#else
|
#else
|
||||||
__attribute__((constructor)) // seems not supported by g++-11 on the M1
|
__attribute__((constructor)) // seems not supported by g++-11 on the M1
|
||||||
#endif
|
#endif
|
||||||
|
__attribute__((used))
|
||||||
static void _mi_macos_override_malloc(void) {
|
static void _mi_macos_override_malloc(void) {
|
||||||
malloc_zone_t* purgeable_zone = NULL;
|
malloc_zone_t* purgeable_zone = NULL;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user