Remove shared from the allocators

This commit is contained in:
2016-11-30 21:20:18 +01:00
parent 965ca0088e
commit 192ee20bf7
12 changed files with 150 additions and 264 deletions

View File

@ -83,7 +83,7 @@ class MmapPool : Allocator
*
* Returns: The pointer to the new allocated memory.
*/
void[] allocate(size_t size) shared @nogc @trusted nothrow
void[] allocate(size_t size, TypeInfo ti = null) @nogc @trusted nothrow
{
if (!size)
{
@ -119,7 +119,7 @@ class MmapPool : Allocator
*
* Returns: Data the block points to or $(D_KEYWORD null).
*/
private void* findBlock(size_t size) shared @nogc nothrow
private void* findBlock(size_t size) @nogc nothrow
{
Block block1;
RegionLoop: for (auto r = head; r !is null; r = r.next)
@ -177,7 +177,7 @@ class MmapPool : Allocator
*
* Returns: Whether the deallocation was successful.
*/
bool deallocate(void[] p) shared @nogc @trusted nothrow
bool deallocate(void[] p) @nogc @trusted nothrow
{
if (p is null)
{
@ -233,7 +233,7 @@ class MmapPool : Allocator
*
* Returns: Whether the reallocation was successful.
*/
bool reallocate(ref void[] p, size_t size) shared @nogc @trusted nothrow
bool reallocate(ref void[] p, size_t size) @nogc @trusted nothrow
{
void[] reallocP;
@ -301,7 +301,7 @@ class MmapPool : Allocator
*
* Returns: Global $(D_PSYMBOL MmapPool) instance.
*/
static @property ref shared(MmapPool) instance() @nogc @trusted nothrow
static @property ref MmapPool instance() @nogc @trusted nothrow
{
if (instance_ is null)
{
@ -312,7 +312,7 @@ class MmapPool : Allocator
if (data !is null)
{
data[0..instanceSize] = typeid(MmapPool).initializer[];
instance_ = cast(shared MmapPool) data;
instance_ = cast(MmapPool) data;
instance_.head = head;
}
}
@ -334,7 +334,6 @@ class MmapPool : Allocator
*
* Returns: A pointer to the data.
*/
pragma(inline)
private static void* initializeRegion(size_t size,
ref Region head) @nogc nothrow
{
@ -409,7 +408,7 @@ class MmapPool : Allocator
}
/// Ditto.
private void* initializeRegion(size_t size) shared @nogc nothrow
private void* initializeRegion(size_t size) @nogc nothrow
{
return initializeRegion(size, head);
}
@ -451,13 +450,13 @@ class MmapPool : Allocator
return x / pageSize * pageSize + pageSize;
}
@property immutable(uint) alignment() shared const @nogc @safe pure nothrow
@property uint alignment() const @nogc @safe pure nothrow
{
return alignment_;
}
private enum alignment_ = 8;
private shared static MmapPool instance_;
private static MmapPool instance_;
private shared static immutable size_t pageSize;