ds/aba: rename ::load to ::ptr

`load` does not load (`read` and `compare_exchange` do) so give it a
different name.  For the cases where `ptr` was previously the pointer we
were guarding, rename it to `raw`.
This commit is contained in:
Nathaniel Filardo 2019-05-14 12:11:31 +01:00
Родитель c7d509e418
Коммит 997ebc5065
2 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -41,7 +41,7 @@ namespace snmalloc
Independent independent;
};
#else
std::atomic<T*> ptr;
std::atomic<T*> raw;
#endif
public:
@ -57,13 +57,18 @@ namespace snmalloc
independent.ptr.store(x, std::memory_order_relaxed);
independent.aba.store(0, std::memory_order_relaxed);
#else
ptr.store(x, std::memory_order_relaxed);
raw.store(x, std::memory_order_relaxed);
#endif
}
T* peek()
{
return independent.ptr.load(std::memory_order_relaxed);
return
#ifdef PLATFORM_IS_X86
independent.ptr.load(std::memory_order_relaxed);
#else
raw.load(std::memory_order_relaxed);
#endif
}
Cmp read()
@ -73,11 +78,11 @@ namespace snmalloc
Cmp{independent.ptr.load(std::memory_order_relaxed),
independent.aba.load(std::memory_order_relaxed)};
#else
ptr.load(std::memory_order_relaxed);
raw.load(std::memory_order_relaxed);
#endif
}
static T* load(Cmp& from)
static T* ptr(Cmp& from)
{
#ifdef PLATFORM_IS_X86
return from.ptr;
@ -105,7 +110,7 @@ namespace snmalloc
expect, xchg, std::memory_order_relaxed, std::memory_order_relaxed);
# endif
#else
return ptr.compare_exchange_weak(
return raw.compare_exchange_weak(
expect, value, std::memory_order_relaxed, std::memory_order_relaxed);
#endif
}

Просмотреть файл

@ -29,7 +29,7 @@ namespace snmalloc
do
{
T* top = ABAT::load(cmp);
T* top = ABAT::ptr(cmp);
last->next.store(top, std::memory_order_release);
} while (!stack.compare_exchange(cmp, first));
}
@ -44,7 +44,7 @@ namespace snmalloc
do
{
top = ABAT::load(cmp);
top = ABAT::ptr(cmp);
if (top == nullptr)
break;
@ -63,7 +63,7 @@ namespace snmalloc
do
{
top = ABAT::load(cmp);
top = ABAT::ptr(cmp);
if (top == nullptr)
break;