CR Feedback

Removed stub from message queue, and use an actual allocation.
This commit is contained in:
Matthew Parkinson
2019-07-02 14:01:16 +01:00
parent fdcbcf7016
commit eb4e28e8d0
10 changed files with 111 additions and 96 deletions

View File

@@ -11,13 +11,9 @@
# define HEADER_GLOBAL __declspec(selectany)
# define likely(x) !!(x)
# define unlikely(x) !!(x)
# define SLOW_PATH NOINLINE
# define FAST_PATH ALWAYSINLINE
# ifdef NDEBUG
# define ASSUME(x)
# else
# define ASSUME(x) assert(x);
# endif
# define SNMALLOC_SLOW_PATH NOINLINE
# define SNMALLOC_FAST_PATH ALWAYSINLINE
# define SNMALLOC_PURE
#else
# define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0)
@@ -25,15 +21,9 @@
# include <emmintrin.h>
# define ALWAYSINLINE __attribute__((always_inline))
# define NOINLINE __attribute__((noinline))
# define SLOW_PATH NOINLINE
# define FAST_PATH ALWAYSINLINE
# ifdef NDEBUG
# define ASSUME(x) \
if (!(x)) \
__builtin_unreachable();
# else
# define ASSUME(x) assert(x);
# endif
# define SNMALLOC_SLOW_PATH NOINLINE
# define SNMALLOC_FAST_PATH ALWAYSINLINE
# define SNMALLOC_PURE __attribute__((const))
# ifdef __clang__
# define HEADER_GLOBAL __attribute__((selectany))
# else
@@ -68,13 +58,17 @@
#define UNUSED(x) ((void)(x))
#if __has_builtin(__builtin_assume)
# define SNMALLOC_ASSUME(x) __builtin_assume(x)
#ifndef NDEBUG
# define SNMALLOC_ASSUME(x) assert(x)
#else
# define SNMALLOC_ASSUME(x) \
do \
{ \
} while (0)
# if __has_builtin(__builtin_assume)
# define SNMALLOC_ASSUME(x) __builtin_assume((x))
# else
# define SNMALLOC_ASSUME(x) \
do \
{ \
} while (0)
# endif
#endif
// #define USE_LZCNT

View File

@@ -4,7 +4,6 @@
#include "helpers.h"
#include <utility>
namespace snmalloc
{
template<class T>
@@ -15,8 +14,8 @@ namespace snmalloc
std::is_same<decltype(T::next), std::atomic<T*>>::value,
"T->next must be a std::atomic<T*>");
std::atomic<T*> back;
T* front;
std::atomic<T*> back = nullptr;
T* front = nullptr;
public:
void invariant()