summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaan <daanl@outlook.com>2021-11-23 19:04:41 -0800
committerdaan <daanl@outlook.com>2021-11-23 19:04:41 -0800
commit9183b1eec005be9863e58d51ba0f96b97721d48c (patch)
treeac8b3da8e13fcb75d71a303b6d5619a083ed4dd1
parent3548d8d716569f96967af4da0fdc57d2f09e7c38 (diff)
remove experiment with unsafe_free_with_threadid
-rw-r--r--include/mimalloc-internal.h3
-rw-r--r--include/mimalloc.h3
-rw-r--r--src/alloc.c24
3 files changed, 3 insertions, 27 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h
index 1333c80..cf5b678 100644
--- a/include/mimalloc-internal.h
+++ b/include/mimalloc-internal.h
@@ -20,17 +20,14 @@ terms of the MIT license. A copy of the license can be found in the file
#if defined(_MSC_VER)
#pragma warning(disable:4127) // suppress constant conditional warning (due to MI_SECURE paths)
#define mi_decl_noinline __declspec(noinline)
-#define mi_decl_always_inline __forceinline
#define mi_decl_thread __declspec(thread)
#define mi_decl_cache_align __declspec(align(MI_CACHE_LINE))
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) // includes clang and icc
#define mi_decl_noinline __attribute__((noinline))
-#define mi_decl_always_inline __attribute__((always_inline))
#define mi_decl_thread __thread
#define mi_decl_cache_align __attribute__((aligned(MI_CACHE_LINE)))
#else
#define mi_decl_noinline
-#define mi_decl_always_inline inline
#define mi_decl_thread __thread // hope for the best :-)
#define mi_decl_cache_align
#endif
diff --git a/include/mimalloc.h b/include/mimalloc.h
index f90af4a..06a1670 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -271,9 +271,6 @@ mi_decl_export int mi_reserve_huge_os_pages_at(size_t pages, int numa_node, size
mi_decl_export int mi_reserve_os_memory(size_t size, bool commit, bool allow_large) mi_attr_noexcept;
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;
-mi_decl_export size_t mi_get_current_threadid(void) mi_attr_noexcept;
-mi_decl_export void mi_unsafe_free_with_threadid(void* p, size_t current_tid ) mi_attr_noexcept;
-
// deprecated
mi_decl_export int mi_reserve_huge_os_pages(size_t pages, double max_secs, size_t* pages_reserved) mi_attr_noexcept;
diff --git a/src/alloc.c b/src/alloc.c
index e916784..ca32cab 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -475,12 +475,13 @@ static inline mi_segment_t* mi_checked_ptr_segment(const void* p, const char* ms
return segment;
}
-// Free a block with a known threadid
-static mi_decl_always_inline void _mi_free_with_threadid(void* p, mi_threadid_t tid) mi_attr_noexcept
+// Free a block
+void mi_free(void* p) mi_attr_noexcept
{
const mi_segment_t* const segment = mi_checked_ptr_segment(p,"mi_free");
if (mi_unlikely(segment == NULL)) return;
+ mi_threadid_t tid = _mi_thread_id();
mi_page_t* const page = _mi_segment_page_of(segment, p);
mi_block_t* const block = (mi_block_t*)p;
@@ -505,25 +506,6 @@ static mi_decl_always_inline void _mi_free_with_threadid(void* p, mi_threadid_t
}
}
-// Get the current thread id
-size_t mi_get_current_threadid(void) mi_attr_noexcept {
- return _mi_thread_id();
-}
-
-// Free a block passing the current thread id explicitly
-void mi_decl_noinline mi_unsafe_free_with_threadid(void* p, size_t current_tid ) mi_attr_noexcept
-{
- mi_assert(current_tid == _mi_thread_id());
- _mi_free_with_threadid(p,current_tid);
-}
-
-
-// Free a block
-void mi_decl_noinline mi_free(void* p) mi_attr_noexcept {
- _mi_free_with_threadid(p, _mi_thread_id());
-}
-
-
bool _mi_free_delayed_block(mi_block_t* block) {
// get segment and page
const mi_segment_t* const segment = _mi_ptr_segment(block);