Skip to content

Commit 9183b1e

Browse files
committed
remove experiment with unsafe_free_with_threadid
1 parent 3548d8d commit 9183b1e

File tree

3 files changed

+3
-27
lines changed

3 files changed

+3
-27
lines changed

include/mimalloc-internal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,14 @@ terms of the MIT license. A copy of the license can be found in the file
2020
#if defined(_MSC_VER)
2121
#pragma warning(disable:4127) // suppress constant conditional warning (due to MI_SECURE paths)
2222
#define mi_decl_noinline __declspec(noinline)
23-
#define mi_decl_always_inline __forceinline
2423
#define mi_decl_thread __declspec(thread)
2524
#define mi_decl_cache_align __declspec(align(MI_CACHE_LINE))
2625
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) // includes clang and icc
2726
#define mi_decl_noinline __attribute__((noinline))
28-
#define mi_decl_always_inline __attribute__((always_inline))
2927
#define mi_decl_thread __thread
3028
#define mi_decl_cache_align __attribute__((aligned(MI_CACHE_LINE)))
3129
#else
3230
#define mi_decl_noinline
33-
#define mi_decl_always_inline inline
3431
#define mi_decl_thread __thread // hope for the best :-)
3532
#define mi_decl_cache_align
3633
#endif

include/mimalloc.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,6 @@ mi_decl_export int mi_reserve_huge_os_pages_at(size_t pages, int numa_node, size
271271
mi_decl_export int mi_reserve_os_memory(size_t size, bool commit, bool allow_large) mi_attr_noexcept;
272272
mi_decl_export bool mi_manage_os_memory(void* start, size_t size, bool is_committed, bool is_large, bool is_zero, int numa_node) mi_attr_noexcept;
273273

274-
mi_decl_export size_t mi_get_current_threadid(void) mi_attr_noexcept;
275-
mi_decl_export void mi_unsafe_free_with_threadid(void* p, size_t current_tid ) mi_attr_noexcept;
276-
277274
// deprecated
278275
mi_decl_export int mi_reserve_huge_os_pages(size_t pages, double max_secs, size_t* pages_reserved) mi_attr_noexcept;
279276

src/alloc.c

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,13 @@ static inline mi_segment_t* mi_checked_ptr_segment(const void* p, const char* ms
475475
return segment;
476476
}
477477

478-
// Free a block with a known threadid
479-
static mi_decl_always_inline void _mi_free_with_threadid(void* p, mi_threadid_t tid) mi_attr_noexcept
478+
// Free a block
479+
void mi_free(void* p) mi_attr_noexcept
480480
{
481481
const mi_segment_t* const segment = mi_checked_ptr_segment(p,"mi_free");
482482
if (mi_unlikely(segment == NULL)) return;
483483

484+
mi_threadid_t tid = _mi_thread_id();
484485
mi_page_t* const page = _mi_segment_page_of(segment, p);
485486
mi_block_t* const block = (mi_block_t*)p;
486487

@@ -505,25 +506,6 @@ static mi_decl_always_inline void _mi_free_with_threadid(void* p, mi_threadid_t
505506
}
506507
}
507508

508-
// Get the current thread id
509-
size_t mi_get_current_threadid(void) mi_attr_noexcept {
510-
return _mi_thread_id();
511-
}
512-
513-
// Free a block passing the current thread id explicitly
514-
void mi_decl_noinline mi_unsafe_free_with_threadid(void* p, size_t current_tid ) mi_attr_noexcept
515-
{
516-
mi_assert(current_tid == _mi_thread_id());
517-
_mi_free_with_threadid(p,current_tid);
518-
}
519-
520-
521-
// Free a block
522-
void mi_decl_noinline mi_free(void* p) mi_attr_noexcept {
523-
_mi_free_with_threadid(p, _mi_thread_id());
524-
}
525-
526-
527509
bool _mi_free_delayed_block(mi_block_t* block) {
528510
// get segment and page
529511
const mi_segment_t* const segment = _mi_ptr_segment(block);

0 commit comments

Comments
 (0)